mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-02 10:31:37 +08:00
FlightTask Smoothing: check dt before dividing
This commit is contained in:
committed by
Daniel Agar
parent
9a23295a40
commit
d3d549b8e6
@@ -146,7 +146,12 @@ void
|
||||
ManualSmoothingZ::velocitySlewRate(float &vel_sp, const float dt)
|
||||
{
|
||||
// limit vertical acceleration
|
||||
float acc = (vel_sp - _vel_sp_prev) / dt;
|
||||
float acc = 0.f;
|
||||
|
||||
if (dt > FLT_EPSILON) {
|
||||
acc = (vel_sp - _vel_sp_prev) / dt;
|
||||
}
|
||||
|
||||
float max_acc = (acc < 0.0f) ? -_acc_state_dependent : _acc_state_dependent;
|
||||
|
||||
if (fabsf(acc) > fabsf(max_acc)) {
|
||||
|
||||
Reference in New Issue
Block a user