From 67cd1e9ad2478b85d1ccb7860ed86edf0b08bf72 Mon Sep 17 00:00:00 2001 From: Balduin Date: Tue, 20 Oct 2026 18:28:45 +0200 Subject: [PATCH] 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. --- .../FwLateralLongitudinalControl.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp b/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp index 0de1353f46c..8b1536485bb 100644 --- a/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp +++ b/src/modules/fw_lateral_longitudinal_control/FwLateralLongitudinalControl.cpp @@ -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) {