From 8c5b079d8ef174cd37730316256b2f3b7b893abf Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Tue, 24 Aug 2021 20:11:42 +0900 Subject: [PATCH] Copter: implement get_circle_radius, set_circle_rate --- ArduCopter/Copter.cpp | 14 ++++++++++++++ ArduCopter/Copter.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/ArduCopter/Copter.cpp b/ArduCopter/Copter.cpp index 66316d0c64..c66f39f68e 100644 --- a/ArduCopter/Copter.cpp +++ b/ArduCopter/Copter.cpp @@ -337,6 +337,20 @@ bool Copter::set_target_angle_and_climbrate(float roll_deg, float pitch_deg, flo mode_guided.set_angle(q, climb_rate_ms*100, use_yaw_rate, radians(yaw_rate_degs), false); return true; } + +// circle mode controls +bool Copter::get_circle_radius(float &radius_m) +{ + radius_m = circle_nav->get_radius() * 0.01f; + return true; +} + +bool Copter::set_circle_rate(float rate_dps) +{ + circle_nav->set_rate(rate_dps); + return true; +} + #endif // ENABLE_SCRIPTING diff --git a/ArduCopter/Copter.h b/ArduCopter/Copter.h index 24617a8925..a542a46fdd 100644 --- a/ArduCopter/Copter.h +++ b/ArduCopter/Copter.h @@ -651,6 +651,8 @@ private: bool set_target_posvel_NED(const Vector3f& target_pos, const Vector3f& target_vel) override; bool set_target_velocity_NED(const Vector3f& vel_ned) override; bool set_target_angle_and_climbrate(float roll_deg, float pitch_deg, float yaw_deg, float climb_rate_ms, bool use_yaw_rate, float yaw_rate_degs) override; + bool get_circle_radius(float &radius_m) override; + bool set_circle_rate(float rate_dps) override; #endif // ENABLE_SCRIPTING void rc_loop(); void throttle_loop();