fix(fw_latlon_control): prioritise min airspeed if above max airspeed

The load factor compensated min airspeed can exceed FW_AIRSPD_MAX
(heavy configuration, high bank angle).

With an explicit airspeed setpoint (e.g. altitude/position mode) the
slew rate state was then reset to the min and to the max airspeed on
alternating iterations, resulting in a discontinuous airspeed setpoint
jumping between the two.

Raise the effective max airspeed to the min airspeed in that case, so
the bounds are consistent and stall protection takes priority.
This commit is contained in:
Balduin authored and Balduin committed 2026-11-05 08:32:46 +01:00
1 parent 31a13c3e90
commit 67cd1e9ad2
1 file changed
+3 -1
@@ -746,7 +746,9 @@ FwLateralLongitudinalControl::adapt_airspeed_setpoint(const float control_interv
{
float system_min_airspeed = _performance_model.getMinimumCalibratedAirspeed(_load_factor_from_bank_angle, _flaps_setpoint);
const float system_max_airspeed = _performance_model.getMaximumCalibratedAirspeed();
// If min exceeds max (high load factor), prioritise the min (stall margin). Should
// not happen on proper configuration, checked by PerformanceModel::runSanityChecks.
const float system_max_airspeed = math::max(_performance_model.getMaximumCalibratedAirspeed(), system_min_airspeed);
// airspeed setpoint adjustments
if (!PX4_ISFINITE(calibrated_airspeed_setpoint) || calibrated_airspeed_setpoint <= FLT_EPSILON) {