fix(fw_lateral_longitudinal_control): reject a negative lateral acceleration limit

A finite negative lateral_control_configuration.lateral_accel_max was
stored as the limit, and constrain(setpoint, -max, +max) with inverted
bounds returns +|max| for every setpoint, holding the vehicle in a bank.
Treat a negative limit like NaN and use the roll-limit default.
This commit is contained in:
treston authored and Balduin committed 2026-10-13 15:49:35 +02:00
1 parent 004f014719
commit f63f2343f4
1 file changed
+2 -1
@@ -372,7 +372,8 @@ void FwLateralLongitudinalControl::updateControllerConfiguration(hrt_abstime tim
_lateral_control_configuration_sub.copy(&configuration_in);
_lateral_configuration.timestamp = configuration_in.timestamp;
if (PX4_ISFINITE(configuration_in.lateral_accel_max)) {
// a negative limit would invert the constrain() bounds of the setpoint; treat it like an unset one
if (PX4_ISFINITE(configuration_in.lateral_accel_max) && (configuration_in.lateral_accel_max >= 0.f)) {
_lateral_configuration.lateral_accel_max = min(configuration_in.lateral_accel_max, tanf(radians(
_param_fw_r_lim.get())) * CONSTANTS_ONE_G);