mc_att_control: use attitude timestamp for dt

This commit is contained in:
Daniel Agar
2020-08-07 21:37:09 -04:00
parent 9992bd05db
commit 45ee16d236
@@ -287,10 +287,10 @@ MulticopterAttitudeControl::Run()
_attitude_control.adaptAttitudeSetpoint(delta_q_reset);
}
const hrt_abstime now = hrt_absolute_time();
const hrt_abstime now = _v_att.timestamp;
// Guard against too small (< 0.2ms) and too large (> 20ms) dt's.
const float dt = math::constrain(((now - _last_run) / 1e6f), 0.0002f, 0.02f);
const float dt = math::constrain(((now - _last_run) * 1e-6f), 0.0002f, 0.02f);
_last_run = now;
/* check for updates in other topics */