-
Notifications
You must be signed in to change notification settings - Fork 16.5k
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
Leverage yaw lock/follow support on gimbal manager v2 protocol #26474
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -799,6 +799,8 @@ uint16_t AP_Mount_Backend::get_gimbal_device_flags() const | |
{ | ||
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) | | ||
(_yaw_lock ? GIMBAL_DEVICE_FLAGS_YAW_LOCK : 0) | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is mixing up the target angles or rates vs the actual angles or rates. "get_gimbal_device_flags()" is only used to fill in the GIMBAL_DEVICE_ATTITUDE_STATUS message's flags field that is sent to the GCS. Even if the target are in earth-frame, the angles and rates we're reporting are always in body-frame. I could be wrong but I think this change would lead to us sometimes tell the GCS the angles and rates are earth-frame when they're not. |
||
GIMBAL_DEVICE_FLAGS_YAW_IN_VEHICLE_FRAME | // Yaw angle is always in vehicle-frame | ||
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 | ||
return flags; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,9 @@ class AP_Mount_Backend | |
// If false (aka "follow") the gimbal's yaw is maintained in body-frame meaning it will rotate with the vehicle | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, it's an existing issue but we should add a comment above "set_yaw_lock" to clarify that it only applies in RC_TARGETING mode. We should add a similar comment besides the _yaw_lock member declaration. |
||
void set_yaw_lock(bool yaw_lock) { _yaw_lock = yaw_lock; } | ||
|
||
// get yaw lock state | ||
bool get_yaw_lock() { return _yaw_lock; } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's make this const. e.g. "bool get_yaw_lock() const { ... }" |
||
|
||
// set angle target in degrees | ||
// yaw_is_earth_frame (aka yaw_lock) should be true if yaw angle is earth-frame, false if body-frame | ||
void set_angle_target(float roll_deg, float pitch_deg, float yaw_deg, bool yaw_is_earth_frame); | ||
|
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.
I think we should return success as long as the actual yaw lock state is in the requested state. So it shouldn't matter if it was changed or not.