From 0d02bb2612e4023a1cda0db28e059716fa6db0b6 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Tue, 13 Sep 2016 23:15:14 -0400 Subject: [PATCH] ecl attitude_fw fix excessive body fixed turn offset -limit body fixed turn offset contrained roll to possible roll setpoint range -fixes #181 --- attitude_fw/ecl_pitch_controller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/attitude_fw/ecl_pitch_controller.cpp b/attitude_fw/ecl_pitch_controller.cpp index 05640282ed..d638209bf9 100644 --- a/attitude_fw/ecl_pitch_controller.cpp +++ b/attitude_fw/ecl_pitch_controller.cpp @@ -127,7 +127,7 @@ float ECL_PitchController::control_bodyrate(const struct ECL_ControlData &ctl_da /* roll is used as feedforward term and inverted flight needs to be considered */ if (fabsf(ctl_data.roll) < math::radians(90.0f)) { /* not inverted, but numerically still potentially close to infinity */ - constrained_roll = math::constrain(ctl_data.roll, math::radians(-80.0f), math::radians(80.0f)); + constrained_roll = math::constrain(ctl_data.roll, -ctl_data.roll_setpoint, ctl_data.roll_setpoint); } else { /* inverted flight, constrain on the two extremes of -pi..+pi to avoid infinity */