multicopter: minimize dt jitter by using estimate timestamp_sample

This commit is contained in:
Daniel Agar
2021-12-17 17:52:28 -05:00
parent dcf69144cb
commit 019eaf7038
3 changed files with 4 additions and 4 deletions
@@ -263,8 +263,8 @@ MulticopterAttitudeControl::Run()
}
// Guard against too small (< 0.2ms) and too large (> 20ms) dt's.
const float dt = math::constrain(((v_att.timestamp - _last_run) * 1e-6f), 0.0002f, 0.02f);
_last_run = v_att.timestamp;
const float dt = math::constrain(((v_att.timestamp_sample - _last_run) * 1e-6f), 0.0002f, 0.02f);
_last_run = v_att.timestamp_sample;
/* check for updates in other topics */
_manual_control_setpoint_sub.update(&_manual_control_setpoint);