Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iris: update iris_with_gimbal model to 3d gimbal #102

Merged
merged 6 commits into from
Jul 7, 2024

Conversation

srmainwaring
Copy link
Collaborator

@srmainwaring srmainwaring commented Jun 27, 2024

Updates #86 which was on a main branch preventing maintainer edits.

  • Update the gimbal model used by the Iris to 3d and add yaw control channel.
  • Use the iris_with_gimbal model as default in example worlds.
  • Reduce position controller PID gains to reduce potential oscillation.
  • Update channels to match servo gimbal wiki doc: https://ardupilot.org/copter/docs/common-camera-gimbal.html
  • Update servo control direction
Action Channel RC Low RC High Min (deg) Max (deg)
Roll RC6 Roll Left Roll Right -30 +30
Pitch RC7 Pitch Dn Pitch Up -135 +45
Yaw RC8 Yaw Left Yaw Right -160 160

Copter params

# Iris is X frame
FRAME_CLASS	     1
FRAME_TYPE	     1

# Match servo out for motors
MOT_PWM_MIN      1100
MOT_PWM_MAX      1900

# Gimbal on mount 1 has 3 DOF
MNT1_TYPE        1           # Servo
MNT1_PITCH_MAX   45
MNT1_PITCH_MIN   -135
MNT1_ROLL_MAX    30
MNT1_ROLL_MIN    -30
MNT1_YAW_MAX     160
MNT1_YAW_MIN     -160

# Gimbal RC in
RC6_MAX          1900
RC6_MIN          1100
RC6_OPTION       212         # Mount1 Roll
RC7_MAX          1900
RC7_MIN          1100
RC7_OPTION       213         # Mount1 Pitch
RC8_MAX          1900
RC8_MIN          1100
RC8_OPTION       214         # Mount1 Yaw
RC8_REVERSED     0           # Normal
RC9_MAX          1900
RC9_MIN          1100
RC9_OPTION       0           # Do Nothing

# Gimbal servo out
SERVO9_FUNCTION  8           # Mount1Roll
SERVO10_FUNCTION 7           # Mount1Pitch
SERVO11_FUNCTION 6           # Mount1Yaw

Figure: gimbal tracking ROI located at the home position while Iris circles
iris-gimbal-3d-roi

The GstCameraPlugin is also enabled by default. To view the video in QGC edit Application Settings > Video Settings. Select UDP h.264 Video Stream and use the default port 5600.

iris-gimbal-3d-qcg

Testing

Tested on macOS Sonoma 14.5 and Ubuntu 22.04 (VM). Both running ArduPilot master with Gazebo Harmonic.

snktshrma and others added 2 commits June 27, 2024 14:37
- Match gimbal channels to servo gimbal wiki.
- Reduce gains on controllers.
- Change direction of pitch and yaw.

Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
@rmackay9
Copy link

@srmainwaring,

Thanks so much for this. This is quite important for the high-altitude-non-GPS GSoC project!

@rmackay9
Copy link

Hi @srmainwaring,

What should MNT1_TYPE be set to? I think it will be either 1 (Servo) or 7 (BrushlessPWM?)

@srmainwaring
Copy link
Collaborator Author

srmainwaring commented Jun 28, 2024

What should MNT1_TYPE be set to? I think it will be either 1 (Servo) or 7 (BrushlessPWM?)

Forgot to add that: yes MNT1_TYPE should be 1 for servo. Updated PR notes at top.

@rmackay9
Copy link

rmackay9 commented Jul 5, 2024

Hi @srmainwaring,

Sanket, Tridge and I were playing around with this today and noticed a couple of issues:

  1. the servos seem slightly laggy which causes the gimbal to move when the vehicle moves. In our high altitude project we expect that users will use brushless gimbals that will be very stable so we'd like to get close to perfect stabilization
  2. The gimbal's pitch servo seems to be limited to 90 degrees downwards so when the vehicle pitches backwards the gimbal physically can't point downwards

Anyway, thanks again for this though, it is on the critical path for both the HighAlt project and the Visual follow-me project!

@srmainwaring
Copy link
Collaborator Author

  1. the servos seem slightly laggy which causes the gimbal to move when the vehicle moves

There's a couple of possible causes for the lag which I'll look into. The most likely is the PID gains on the servo joint controllers in the simulation.

  1. The gimbal's pitch servo seems to be limited to 90 degrees downwards so when the vehicle pitches backwards the gimbal physically can't point downwards

I'll adjust the joint limits and update the AP params to match the specs for the SIYI A8

  • Controllable Pitch Angle: -135° ~ +45°
  • Controllable Yaw Angle: -160° ~ +160°
  • Controllable Roll Angle: -30° ~ +30°

Finally, the iris model could also do with a tune. IIRC from some other analysis the default params for gazebo-iris are quite close to the limit where roll oscillations become noticeable. There could be some cross-coupling with the gimbal movement that is also contributing to stability.

@rmackay9
Copy link

rmackay9 commented Jul 5, 2024

Hi @srmainwaring,

Thanks very much! By the way, in the instructions at the top of the PR (and maybe eventually on the wiki or in the README) we should specify what these MNT1_xxx parameters should be set to:

  • MNT1_ROLL_MIN/MAX -90 and +90?
  • MNT1_PITCH_MIN/MAX -90 and +90?
  • MNT1_YAW_MIN/MAX -90 and +90

and I wonder if we also need to set these values? They seem to be ok that the defaults 1100 ~ 1900 but just in case

  • SERVO9_MIN/MAX (used for roll, 1100~1900 is OK?)
  • SERVO10_MIN/MAX (used for pitch, 1100~1900 is OK?)
  • SERVO11_MIN/MAX (used for yaw, 1100~1900 is OK?)

Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
@srmainwaring
Copy link
Collaborator Author

@rmackay9 and @snktshrma - should be much snappier now. The limits now match the SIYI A8. Main change to joint control is reducing the damping (equivalent to increasing the PID gains and max force exerted). The original physics settings were carried over from the model from Gazebo Classic - and correspond to a very stiff joint, not that appropriate for a small gimbal.

Figure: gimbal tracking ROI located at home position (location of axis), response is faster with new settings.
iris-gimbal-3d-qcg-stabilized

Signed-off-by: Rhys Mainwaring <rhys.mainwaring@me.com>
Copy link

@rmackay9 rmackay9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again @srmainwaring for this!

@snktshrma has told me that the latest changes greatly improve the attitude control of the gimbal which resolves the biggest blocker he was facing in the high-altitude-non-gps project

@srmainwaring srmainwaring merged commit 0eaa3c6 into ArduPilot:main Jul 7, 2024
3 checks passed
@srmainwaring srmainwaring deleted the prs/pr-iris-gimbal-3d branch July 7, 2024 08:54
@srmainwaring srmainwaring mentioned this pull request Jul 7, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants