Copter: fix do-mount-control yaw scaling #21639
Merged
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.
This fixes a scaling issue in Copter's consumption of the MAV_CMD_DO_MOUNT_CONTROL message. The command's yaw was being interpreted as if it was centi-degrees but the mavlink spec says degrees. This only affects Copters with a 2-axis gimbal
This is related to PR #21530 (which solved a similar problem in the AP_Mount driver but didn't resolve this Copter vehicle level issue).
This resolves issue #15699
I've tested this in SITL and confirmed that before, the vehicle was always pointed quite close to zero (e.g. a request for 90 degrees would point the vehicle at 0.9 deg) and that after it points in the correct direction.
As a side note, the handling of DO_MOUNT_CONTROL is odd in that the angles are treated as earth-frame angles with a 2-axis gimbal but body-frame angles when using a 3-axis gimbal. This odd difference is another good reason why we should encourage use of the new gimbalv2 messages like DO_GIMBAL_MANAGER_PITCHYAW.