From 6b2a61b551a4c828c8053633bdfe85f09b01a226 Mon Sep 17 00:00:00 2001 From: Yuri Date: Thu, 30 Jun 2022 13:45:14 -0500 Subject: [PATCH] Rover: implement set_desired_speed --- Rover/Rover.cpp | 6 ++++++ Rover/Rover.h | 1 + 2 files changed, 7 insertions(+) diff --git a/Rover/Rover.cpp b/Rover/Rover.cpp index b4f552083f..2fa30a6df5 100644 --- a/Rover/Rover.cpp +++ b/Rover/Rover.cpp @@ -214,6 +214,12 @@ bool Rover::set_desired_turn_rate_and_speed(float turn_rate, float speed) return true; } +// set desired nav speed (m/s). Used for scripting. +bool Rover::set_desired_speed(float speed) +{ + return control_mode->set_desired_speed(speed); +} + // get control output (for use in scripting) // returns true on success and control_value is set to a value in the range -1 to +1 bool Rover::get_control_output(AP_Vehicle::ControlOutput control_output, float &control_value) diff --git a/Rover/Rover.h b/Rover/Rover.h index 2cab6b2651..df3be89fa1 100644 --- a/Rover/Rover.h +++ b/Rover/Rover.h @@ -273,6 +273,7 @@ private: bool set_steering_and_throttle(float steering, float throttle) override; // set desired turn rate (degrees/sec) and speed (m/s). Used for scripting bool set_desired_turn_rate_and_speed(float turn_rate, float speed) override; + bool set_desired_speed(float speed) override; bool get_control_output(AP_Vehicle::ControlOutput control_output, float &control_value) override; bool nav_scripting_enable(uint8_t mode) override; bool nav_script_time(uint16_t &id, uint8_t &cmd, float &arg1, float &arg2) override;