From 570ecdc2e0a2c9f319fd8d955e0fd846776525a0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 9 Oct 2021 19:33:47 +1100 Subject: [PATCH] Plane: don't apply fw pitch limit in VTOL control for tailsitters tailsitters may have narrow fixed wing limits but need high limits for landing in high wind found this on a HWing which was essentially impossible to auto land --- ArduPlane/quadplane.cpp | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/ArduPlane/quadplane.cpp b/ArduPlane/quadplane.cpp index 54796034d8..48cca80850 100644 --- a/ArduPlane/quadplane.cpp +++ b/ArduPlane/quadplane.cpp @@ -2359,25 +2359,27 @@ void QuadPlane::vtol_position_controller(void) plane.nav_roll_cd = pos_control->get_roll_cd(); plane.nav_pitch_cd = pos_control->get_pitch_cd(); - /* - limit the pitch down with an expanding envelope. This - prevents the velocity controller demanding nose down during - the initial slowdown if the target velocity curve is higher - than the actual velocity curve (for a high drag - aircraft). Nose down will cause a lot of downforce on the - wings which will draw a lot of current and also cause the - aircraft to lose altitude rapidly.pitch limit varies also with speed - to prevent inability to progress to position if moving from a loiter - to landing - */ - float minlimit_cd = linear_interpolate(-300, MAX(-aparm.angle_max,plane.aparm.pitch_limit_min_cd), - poscontrol.time_since_state_start_ms(), - 0, 5000); - if (plane.nav_pitch_cd < minlimit_cd) { - plane.nav_pitch_cd = minlimit_cd; - // tell the pos controller we have limited the pitch to - // stop integrator buildup - pos_control->set_externally_limited_xy(); + if (!tailsitter.enabled()) { + /* + limit the pitch down with an expanding envelope. This + prevents the velocity controller demanding nose down during + the initial slowdown if the target velocity curve is higher + than the actual velocity curve (for a high drag + aircraft). Nose down will cause a lot of downforce on the + wings which will draw a lot of current and also cause the + aircraft to lose altitude rapidly.pitch limit varies also with speed + to prevent inability to progress to position if moving from a loiter + to landing + */ + float minlimit_cd = linear_interpolate(-300, MAX(-aparm.angle_max,plane.aparm.pitch_limit_min_cd), + poscontrol.time_since_state_start_ms(), + 0, 5000); + if (plane.nav_pitch_cd < minlimit_cd) { + plane.nav_pitch_cd = minlimit_cd; + // tell the pos controller we have limited the pitch to + // stop integrator buildup + pos_control->set_externally_limited_xy(); + } } // call attitude controller