Copter: Fix circle radius pitch stick control

Pitch stick up will reduce the radius, as in moving forward.  Pitch stick back will increase the radius, as in moving backwards.
This commit is contained in:
Matt Lawrence 2020-02-03 16:23:08 -05:00 committed by Randy Mackay
parent 06f9c6a210
commit 4552b89067
1 changed files with 1 additions and 1 deletions

View File

@ -47,7 +47,7 @@ void ModeCircle::run()
const float radius_current = copter.circle_nav->get_radius(); // circle controller's radius target, which begins as the circle_radius parameter const float radius_current = copter.circle_nav->get_radius(); // circle controller's radius target, which begins as the circle_radius parameter
const float pitch_stick = channel_pitch->norm_input_dz(); // pitch stick normalized -1 to 1 const float pitch_stick = channel_pitch->norm_input_dz(); // pitch stick normalized -1 to 1
const float nav_speed = copter.wp_nav->get_default_speed_xy(); // copter WP_NAV parameter speed const float nav_speed = copter.wp_nav->get_default_speed_xy(); // copter WP_NAV parameter speed
const float radius_pilot_change = (-pitch_stick * nav_speed) * G_Dt; // rate of change (inverted so pushing stick up reduces radius, as in moving forward) const float radius_pilot_change = (pitch_stick * nav_speed) * G_Dt; // rate of change (pitch stick up reduces the radius, as in moving forward)
const float radius_new = MAX(radius_current + radius_pilot_change,0); // new radius target const float radius_new = MAX(radius_current + radius_pilot_change,0); // new radius target
if (!is_equal(radius_current, radius_new)) { if (!is_equal(radius_current, radius_new)) {