From d56d222971696ca5fd54a01dc2a884db95743733 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Tue, 1 Aug 2017 16:07:59 +0900 Subject: [PATCH] Rover: set-attitude-target consumes thrust in -1 to +1 range This makes the processing consistent with the mavlink spec --- APMrover2/GCS_Mavlink.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/APMrover2/GCS_Mavlink.cpp b/APMrover2/GCS_Mavlink.cpp index 4ea14c1a42..974a6853d2 100644 --- a/APMrover2/GCS_Mavlink.cpp +++ b/APMrover2/GCS_Mavlink.cpp @@ -1049,15 +1049,8 @@ void GCS_MAVLINK_Rover::handleMessage(mavlink_message_t* msg) } // convert thrust to ground speed - packet.thrust = constrain_float(packet.thrust, 0.0f, 1.0f); - float target_speed = 0.0f; - if (is_equal(packet.thrust, 0.5f)) { - target_speed = 0.0f; - } else if (packet.thrust > 0.5f) { - target_speed = (packet.thrust - 0.5f) * 2.0f * rover.g.speed_cruise; - } else { - target_speed = (0.5f - packet.thrust) * 2.0f * rover.g.speed_cruise; - } + packet.thrust = constrain_float(packet.thrust, -1.0f, 1.0f); + float target_speed = rover.g.speed_cruise * packet.thrust; // if the body_yaw_rate field is ignored, use the commanded yaw position // otherwise use the commanded yaw rate