From 0c923bda4e0d662bd4b91937e76c7c0d3288092f Mon Sep 17 00:00:00 2001 From: Silvan Fuhrer Date: Tue, 29 Nov 2022 17:10:21 +0100 Subject: [PATCH] FW Attitude Control: fix integral resetting Signed-off-by: Silvan Fuhrer --- .../fw_att_control/FixedwingAttitudeControl.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/modules/fw_att_control/FixedwingAttitudeControl.cpp b/src/modules/fw_att_control/FixedwingAttitudeControl.cpp index 214bc534f4..f1b7084b92 100644 --- a/src/modules/fw_att_control/FixedwingAttitudeControl.cpp +++ b/src/modules/fw_att_control/FixedwingAttitudeControl.cpp @@ -389,20 +389,19 @@ void FixedwingAttitudeControl::Run() const float airspeed = get_airspeed_and_update_scaling(); - /* reset integrals where needed */ - if (_att_sp.reset_integral) { - _rates_sp.reset_integral = true; - } - - /* Reset integrators if the aircraft is on ground + /* Reset integrators if commanded by attitude setpoint, or the aircraft is on ground * or a multicopter (but not transitioning VTOL or tailsitter) */ - if (_landed + if (_att_sp.reset_integral + || _landed || (_vehicle_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING && !_vehicle_status.in_transition_mode && !_vehicle_status.is_vtol_tailsitter)) { _rates_sp.reset_integral = true; _wheel_ctrl.reset_integrator(); + + } else { + _rates_sp.reset_integral = false; } // update saturation status from control allocation feedback