Skip to content

Commit

Permalink
AP_Mount: do-gimbal-manager-pitch-yaw can set lock state
Browse files Browse the repository at this point in the history
Co-authored-by: davidsastresas <[email protected]>
  • Loading branch information
rmackay9 and Davidsastresas committed Mar 20, 2024
1 parent 621ca12 commit 94b23e4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions libraries/AP_Mount/AP_Mount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,12 @@ MAV_RESULT AP_Mount::handle_command_do_gimbal_manager_pitchyaw(const mavlink_com
return MAV_RESULT_ACCEPTED;
}

// if neither angles nor rates were provided set the RC_TARGETING yaw lock state
if (isnan(pitch_angle_deg) && isnan(yaw_angle_deg) && isnan(pitch_rate_degs) && isnan(yaw_rate_degs)) {
backend->set_yaw_lock(flags & GIMBAL_MANAGER_FLAGS_YAW_LOCK);
return MAV_RESULT_ACCEPTED;
}

return MAV_RESULT_FAILED;
}

Expand Down Expand Up @@ -498,6 +504,12 @@ void AP_Mount::handle_gimbal_manager_set_pitchyaw(const mavlink_message_t &msg)
backend->set_rate_target(0, pitch_rate_degs, yaw_rate_degs, flags & GIMBAL_MANAGER_FLAGS_YAW_LOCK);
return;
}

// if neither angles nor rates were provided set the RC_TARGETING yaw lock state
if (isnan(packet.pitch) && isnan(packet.yaw) && isnan(packet.pitch_rate) && isnan(packet.yaw_rate)) {
backend->set_yaw_lock(flags & GIMBAL_MANAGER_FLAGS_YAW_LOCK);
return;
}
}

MAV_RESULT AP_Mount::handle_command_do_set_roi_sysid(const mavlink_command_int_t &packet)
Expand Down

0 comments on commit 94b23e4

Please sign in to comment.