From 29ccd0e106d576eaad0307bf7d8efe647cde6986 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 30 Jul 2022 10:56:33 +1000 Subject: [PATCH] Plane: limit target accel in POSITION1 don't ask for more than 2* transition limit, and reset when we enter overshoot case --- ArduPlane/quadplane.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ArduPlane/quadplane.cpp b/ArduPlane/quadplane.cpp index a57c270961..0fcd7f5f96 100644 --- a/ArduPlane/quadplane.cpp +++ b/ArduPlane/quadplane.cpp @@ -2498,7 +2498,7 @@ void QuadPlane::vtol_position_controller(void) Vector2f target_accel_cms; bool have_target_yaw = false; float target_yaw_deg; - const float target_accel = accel_needed(distance, sq(closing_groundspeed)); + const float target_accel = MIN(accel_needed(distance, sq(closing_groundspeed)), transition_decel*2); if (distance > 0.1) { Vector2f diff_wp_norm = diff_wp.normalized(); target_speed_xy_cms = diff_wp_norm * target_speed * 100; @@ -2510,6 +2510,7 @@ void QuadPlane::vtol_position_controller(void) gcs().send_text(MAV_SEVERITY_INFO,"VTOL Overshoot d=%.1f cs=%.1f yerr=%.1f", distance, closing_groundspeed, yaw_err_deg); poscontrol.overshoot = true; + pos_control->set_accel_desired_xy_cmss(Vector2f()); } if (poscontrol.overshoot) { /* we have overshot the landing point or our nose is