mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 05:01:37 +08:00
FlightTask Smoothing: check dt before dividing
This commit is contained in:
committed by
Daniel Agar
parent
9a23295a40
commit
d3d549b8e6
@@ -197,7 +197,11 @@ void
|
||||
ManualSmoothingXY::_velocitySlewRate(matrix::Vector2f &vel_sp, const float dt)
|
||||
{
|
||||
// Adjust velocity setpoint if demand exceeds acceleration. /
|
||||
matrix::Vector2f acc = (vel_sp - _vel_sp_prev) / dt;
|
||||
matrix::Vector2f acc{};
|
||||
|
||||
if (dt > FLT_EPSILON) {
|
||||
acc = (vel_sp - _vel_sp_prev) / dt;
|
||||
}
|
||||
|
||||
if (acc.length() > _acc_state_dependent) {
|
||||
vel_sp = acc.normalized() * _acc_state_dependent * dt + _vel_sp_prev;
|
||||
|
||||
Reference in New Issue
Block a user