AP_Mount: Add delta_yaw and delta_yaw_velocity support for AP_Mount_MAVLink - #33870
Open
jnomikos wants to merge 3 commits into
Open
AP_Mount: Add delta_yaw and delta_yaw_velocity support for AP_Mount_MAVLink#33870jnomikos wants to merge 3 commits into
jnomikos wants to merge 3 commits into
Conversation
…AVLink 1. Added get_attitude_deltas to AP_Mount.h and AP_Mount_Backend.h 2. In send_gimbal_device_attitude_status, if we are able to get_attitude_deltas, attach it as part of the MAVLink message. 3. Added AP_Mount_MAVLink implementation of get_attitude_deltas. Only true if we ever receive a non-zero value for either of them.
jnomikos
force-pushed
the
dev-mount-delta-support
branch
from
July 29, 2026 02:32
2b96237 to
8c2f616
Compare
jnomikos
force-pushed
the
dev-mount-delta-support
branch
from
July 29, 2026 05:31
8c2f616 to
3ff87d5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Added delta_yaw and delta_yaw_velocity support in
AP_Mountand added anAP_Mount_MAVLinkimplementation, forGIMBAL_DEVICE_ATTITUDE_STATUS.Classification & Testing (check all that apply and add your own)
Tested on cube blue with Gremsy Pixy LR payload (v7.8.7) (with ArduCopter).
Description
get_attitude_deltasto AP_Mount.h and AP_Mount_Backend.hsend_gimbal_device_attitude_status, if we are able toget_attitude_deltas, attach it as part of the MAVLink message.AP_Mount_MAVLinkimplementation ofget_attitude_deltas. Only true if we ever receive a non-zero value for either of them (indicating the gimbal sends the extended value).Rationale: A gimbal device maintains its own yaw estimate, which can differ from the vehicle's heading. The difference may be small (separate compass with different calibration) or arbitrarily large (some gimbals reference yaw to an arbitrary zero, such as their power-on direction, rather than to north). Some gimbals, such as the Gremsy Pixy LR, report their attitude quaternion in vehicle frame in both follow and lock modes (
GIMBAL_DEVICE_FLAGS_YAW_IN_VEHICLE_FRAME), so a consumer must always add a vehicle heading to compute the gimbal's earth-frame azimuth.ArduPilot currently always sends NaN for
delta_yawanddelta_yaw_velocityinGIMBAL_DEVICE_ATTITUDE_STATUS, even when the gimbal reports them. A GCS therefore has to either use the autopilot's vehicle heading, which is offset from the gimbal's own estimate, or bypass the gimbal manager and listen forGIMBAL_DEVICE_ATTITUDE_STATUSdirectly from the gimbal device's component, contrary to the intent of the gimbal protocol v2, and impossible when the gimbal is not visible on the GCS link. The offset produces real failures: on the Pixy LR, switching from follow to lock commands an azimuth computed from vehicle heading, which the gimbal executes against its own heading estimate, so the gimbal visibly slews by the difference (in testing, sometimes more than 180 degrees, with the size of the error depending on vehicle heading).delta_yawexists in the spec for exactly this: it is the vehicle heading as estimated by the gimbal itself. Converting between body and earth frames with the gimbal's own estimate makes the round trip self-consistent, so the frame offset cancels regardless of its cause or size. With this change, when the gimbal reportsdelta_yaw, ArduPilot forwards it inGIMBAL_DEVICE_ATTITUDE_STATUS, so a GCS can do that conversion without relying on vehicle heading. Vehicle heading and gimbal attitude also arrive at different rates, so using the gimbal's own value avoids mixing estimates sampled at different times.