mc_att_control: att rate integral fix

This commit is contained in:
Anton Babushkin 2014-01-31 16:46:54 +01:00
parent 5a7a356c20
commit d933d523eb
1 changed files with 7 additions and 5 deletions

View File

@ -654,8 +654,9 @@ MulticopterAttitudeControl::control_attitude_rates(float dt)
_rates_prev = rates; _rates_prev = rates;
/* update integral only if not saturated on low limit */ /* update integral only if not saturated on low limit */
if (_thrust_sp > 0.1f && _att_control.length() < _thrust_sp) { if (_thrust_sp > 0.1f) {
for (int i = 0; i < 3; i++) { for (int i = 0; i < 3; i++) {
if (fabsf(_att_control(i)) < _thrust_sp) {
float rate_i = _rates_int(i) + _params.rate_i(i) * rates_err(i) * dt; float rate_i = _rates_int(i) + _params.rate_i(i) * rates_err(i) * dt;
if (isfinite(rate_i) && rate_i > -RATES_I_LIMIT && rate_i < RATES_I_LIMIT && if (isfinite(rate_i) && rate_i > -RATES_I_LIMIT && rate_i < RATES_I_LIMIT &&
@ -664,6 +665,7 @@ MulticopterAttitudeControl::control_attitude_rates(float dt)
} }
} }
} }
}
} }
void void