mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-01 15:44:07 +08:00
l1 position controller: make sure that a NAN roll setpoint
does not keep the roll setpoint state at NAN forever Signed-off-by: Roman <bapstroman@gmail.com>
This commit is contained in:
parent
34cd1366b7
commit
aa134d5a61
@ -51,16 +51,14 @@ void ECL_L1_Pos_Controller::update_roll_setpoint()
|
||||
float roll_new = atanf(_lateral_accel * 1.0f / CONSTANTS_ONE_G);
|
||||
roll_new = math::constrain(roll_new, -_roll_lim_rad, _roll_lim_rad);
|
||||
|
||||
// no slew rate limiting active
|
||||
if (_dt <= 0.0f || _roll_slew_rate <= 0.0f) {
|
||||
_roll_setpoint = roll_new;
|
||||
return;
|
||||
if (_dt > 0.0f && _roll_slew_rate > 0.0f) {
|
||||
// slew rate limiting active
|
||||
roll_new = math::constrain(roll_new, _roll_setpoint - _roll_slew_rate * _dt, _roll_setpoint + _roll_slew_rate * _dt);
|
||||
}
|
||||
|
||||
// slew rate limiting active
|
||||
roll_new = math::constrain(roll_new, _roll_setpoint - _roll_slew_rate * _dt, _roll_setpoint + _roll_slew_rate * _dt);
|
||||
|
||||
_roll_setpoint = roll_new;
|
||||
if (ISFINITE(roll_new)) {
|
||||
_roll_setpoint = roll_new;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user