From d3b7112dd94ac75a9a94ceef788d934f55c56c53 Mon Sep 17 00:00:00 2001 From: KonradRudin <98741601+KonradRudin@users.noreply.github.com> Date: Wed, 25 Jan 2023 09:16:11 +0100 Subject: [PATCH] [TECS]: If in airspeedless mode, add the throttle integrator term to the throttle setpoint, if the integrator term is positive. This should avoid reducing airspeed when switching to airspeedless mode. (#20987) --- src/lib/tecs/TECS.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/tecs/TECS.cpp b/src/lib/tecs/TECS.cpp index 6c044b8d77..85dd3fee64 100644 --- a/src/lib/tecs/TECS.cpp +++ b/src/lib/tecs/TECS.cpp @@ -609,8 +609,13 @@ float TECSControl::_calcThrottleControlOutput(const STERateLimit &limit, const C // Add the integrator feedback during closed loop operation with an airspeed sensor throttle_setpoint += _throttle_integ_state; + } else { + /* We want to avoid reducing the throttle output when switching from airspeed enabled mode into airspeedless mode. + Thus, if the throttle integrator has a positive value, add it still to the throttle setpoint. */ + throttle_setpoint += math::max(0.0f, _throttle_integ_state); } + // ramp in max throttle setting with underspeediness value throttle_setpoint = _ratio_undersped * param.throttle_max + (1.0f - _ratio_undersped) * throttle_setpoint;