|
|
|
@ -648,16 +648,21 @@ MAV_RESULT GCS_MAVLINK_Rover::handle_command_long_packet(const mavlink_command_l
@@ -648,16 +648,21 @@ MAV_RESULT GCS_MAVLINK_Rover::handle_command_long_packet(const mavlink_command_l
|
|
|
|
|
{ |
|
|
|
|
// param1 : yaw angle to adjust direction by in centidegress
|
|
|
|
|
// param2 : Speed - normalized to 0 .. 1
|
|
|
|
|
// param3 : 0 = absolute, 1 = relative
|
|
|
|
|
|
|
|
|
|
// exit if vehicle is not in Guided mode
|
|
|
|
|
if (!rover.control_mode->in_guided_mode()) { |
|
|
|
|
return MAV_RESULT_FAILED; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// send yaw change and target speed to guided mode controller
|
|
|
|
|
const float speed_max = rover.control_mode->get_speed_default(); |
|
|
|
|
const float target_speed = constrain_float(packet.param2 * speed_max, -speed_max, speed_max); |
|
|
|
|
rover.mode_guided.set_desired_heading_delta_and_speed(packet.param1, target_speed); |
|
|
|
|
// get final angle, 1 = Relative, 0 = Absolute
|
|
|
|
|
if (packet.param3 > 0) { |
|
|
|
|
// relative angle
|
|
|
|
|
rover.mode_guided.set_desired_heading_delta_and_speed(packet.param1 * 100.0f, packet.param2); |
|
|
|
|
} else { |
|
|
|
|
// absolute angle
|
|
|
|
|
rover.mode_guided.set_desired_heading_and_speed(packet.param1 * 100.0f, packet.param2); |
|
|
|
|
} |
|
|
|
|
return MAV_RESULT_ACCEPTED; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|