From 55401ec1b0a1941857d2d3aa5fbe49ec870c22d8 Mon Sep 17 00:00:00 2001 From: Roman Date: Tue, 24 Jan 2017 15:50:39 +0100 Subject: [PATCH] fw attitude control: compute integrator correctly - I gain was applied wrongly, such that the integrator value was depending direcly on the I gain. This made the integrator value jump when the gain was changed Signed-off-by: Roman --- attitude_fw/ecl_roll_controller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attitude_fw/ecl_roll_controller.cpp b/attitude_fw/ecl_roll_controller.cpp index 4d438bad68..12d2480643 100644 --- a/attitude_fw/ecl_roll_controller.cpp +++ b/attitude_fw/ecl_roll_controller.cpp @@ -124,7 +124,7 @@ float ECL_RollController::control_bodyrate(const struct ECL_ControlData &ctl_dat /* integrator limit */ //xxx: until start detection is available: integral part in control signal is limited here - float integrator_constrained = math::constrain(_integrator * _k_i, -_integrator_max, _integrator_max); + float integrator_constrained = math::constrain(_integrator, -_integrator_max, _integrator_max); /* Apply PI rate controller and store non-limited output */ _last_output = _bodyrate_setpoint * _k_ff * ctl_data.scaler +