Skip to content

Commit

Permalink
AP_Mount: Don't set GIMBAL_DEVICE_FLAGS_YAW_IN_VEHICLE_FRAME if yaw i…
Browse files Browse the repository at this point in the history
…s locked
  • Loading branch information
nexton-winjeel committed May 16, 2024
1 parent ce04c33 commit ab4df6c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions libraries/AP_Mount/AP_Mount_Backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -857,12 +857,14 @@ uint16_t AP_Mount_Backend::get_gimbal_device_flags() const
break;
}

const uint16_t yaw_ef_flags = GIMBAL_DEVICE_FLAGS_YAW_IN_EARTH_FRAME | GIMBAL_DEVICE_FLAGS_YAW_LOCK;
const uint16_t yaw_bf_flags = GIMBAL_DEVICE_FLAGS_YAW_IN_VEHICLE_FRAME;

const uint16_t flags = (get_mode() == MAV_MOUNT_MODE_RETRACT ? GIMBAL_DEVICE_FLAGS_RETRACT : 0) |
(get_mode() == MAV_MOUNT_MODE_NEUTRAL ? GIMBAL_DEVICE_FLAGS_NEUTRAL : 0) |
GIMBAL_DEVICE_FLAGS_ROLL_LOCK | // roll angle is always earth-frame
GIMBAL_DEVICE_FLAGS_PITCH_LOCK| // pitch angle is always earth-frame, yaw_angle is always body-frame
GIMBAL_DEVICE_FLAGS_YAW_IN_VEHICLE_FRAME | // yaw angle is always in vehicle-frame
(yaw_lock_state ? GIMBAL_DEVICE_FLAGS_YAW_LOCK : 0);
GIMBAL_DEVICE_FLAGS_ROLL_LOCK | // roll angle is always earth-frame
GIMBAL_DEVICE_FLAGS_PITCH_LOCK | // pitch angle is always earth-frame
(yaw_lock_state ? yaw_ef_flags : yaw_bf_flags); // yaw angle can be either earth-frame or body-frame
return flags;
}

Expand Down

0 comments on commit ab4df6c

Please sign in to comment.