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

Copter: Handle DO_MOUNT_CONTROL yaw angle as body frame #27071

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nexton-winjeel
Copy link
Contributor

The demanded yaw angles in the MOUNT_CONTROL and DO_MOUNT_CONTROL commands are in body frame (and are handled this way in AP_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

And only accept if the mode is MAV_MOUNT_MODE_MAVLINK_TARGETING. This matches the handlers in AP_Mount.
@@ -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
Copy link
Contributor Author

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?

@joshanne
Copy link
Contributor

@rmackay9 you might have some interest on this one.

@rmackay9
Copy link
Contributor

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:

  • move Pan control to 45 deg
  • move Tilt up and down

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

@rmackay9
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants