-
Notifications
You must be signed in to change notification settings - Fork 18k
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
Copter: Handle DO_MOUNT_CONTROL yaw angle as body frame #27071
Copter: Handle DO_MOUNT_CONTROL yaw angle as body frame #27071
Conversation
@@ -1219,6 +1219,7 @@ MAV_MISSION_RESULT AP_Mission::mavlink_int_to_mission_cmd(const mavlink_mission_ | |||
break; | |||
|
|||
case MAV_CMD_DO_MOUNT_CONTROL: // MAV ID: 205 | |||
// TODO: this is only valid if packet.z == MAV_MOUNT_MODE_MAVLINK_TARGETING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be returning MAV_MISSION_INVALID_PARAM7
if the mode (packet.z
) is not set to MAV_MOUNT_MODE_MAVLINK_TARGETING
?
@rmackay9 you might have some interest on this one. |
We talked about this on the dev call and discussed the concern that users of MP may find that if they use the payload control tab that the vehicle may end up doing circles. The procedure would be to setup a vehicle with a 2-axis gimbal and then:
Each time the Tilt is moved the yaw would be re-sent and because after this change it would be in body-frame the vehicle would rotate On the other hand, the Pan control changing the vehicle's heading to an absolute heading (e.g. North) also doesn't seem very good I'll test and see what happens in SITL |
Hi @nexton-winjeel, I've tested this and I agree that it is an improvement. The existing behaviour results in the vehicle turning to point North if the user clicks on MP's the Payload Control pitch or roll controls which is certainly unexpected. One small issue I noticed is that this essentially locks in any yaw error so if the user constantly adjusts roll or pitch the vehicle will also yaw slightly. I think we could fix this by using the current target yaw instead of the actual yaw. |
cb594fa
to
85e0f10
Compare
I've updated to use the current yaw target. I've also added an autotest. |
85e0f10
to
214cce6
Compare
Rebased on |
And now |
214cce6
to
d6b2a79
Compare
And only accept if the mode is MAV_MOUNT_MODE_MAVLINK_TARGETING. This matches the handlers in AP_Mount.
d6b2a79
to
6ec5817
Compare
The demanded yaw angles in the
MOUNT_CONTROL
andDO_MOUNT_CONTROL
commands are in body frame (and are handled this way inAP_Mount
). This fixes the Copter handlers where they were being treated as earth frame.It also rejects these messages if an invalid mode is provided, as the yaw control is only applicable when the mode is
MAV_MOUNT_MODE_MAVLINK_TARGETING
.FYI: @rmackay9