Browse Source

FlightTaskAuto: check yawspeed saturation before constraining

to avoid possible numerical float equality issues.
sbg
Matthias Grob 5 years ago
parent
commit
1efc8c27eb
  1. 4
      src/lib/flight_tasks/tasks/Auto/FlightTaskAuto.cpp

4
src/lib/flight_tasks/tasks/Auto/FlightTaskAuto.cpp

@ -117,10 +117,10 @@ void FlightTaskAuto::_limitYawRate() @@ -117,10 +117,10 @@ void FlightTaskAuto::_limitYawRate()
}
if (PX4_ISFINITE(_yawspeed_setpoint)) {
_yawspeed_setpoint = math::constrain(_yawspeed_setpoint, -yawrate_max, yawrate_max);
// The yaw setpoint is aligned when its rate is not saturated
_yaw_sp_aligned = _yaw_sp_aligned && (fabsf(_yawspeed_setpoint) < yawrate_max);
_yawspeed_setpoint = math::constrain(_yawspeed_setpoint, -yawrate_max, yawrate_max);
}
}

Loading…
Cancel
Save