From 45ee16d2367e759fb1f3c72c4c88c9deeae63684 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Fri, 7 Aug 2020 21:37:09 -0400 Subject: [PATCH] mc_att_control: use attitude timestamp for dt --- src/modules/mc_att_control/mc_att_control_main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/mc_att_control/mc_att_control_main.cpp b/src/modules/mc_att_control/mc_att_control_main.cpp index 0af4095381..3e45815957 100644 --- a/src/modules/mc_att_control/mc_att_control_main.cpp +++ b/src/modules/mc_att_control/mc_att_control_main.cpp @@ -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 */