multicopter: minimize dt jitter by using estimate timestamp_sample

This commit is contained in:
Daniel Agar
2021-12-15 10:30:17 -05:00
parent dcf69144cb
commit 019eaf7038
3 changed files with 4 additions and 4 deletions
@@ -291,7 +291,7 @@ void MulticopterPositionControl::Run()
vehicle_local_position_s local_pos;
if (_local_pos_sub.update(&local_pos)) {
const hrt_abstime time_stamp_now = local_pos.timestamp;
const hrt_abstime time_stamp_now = local_pos.timestamp_sample;
const float dt = math::constrain(((time_stamp_now - _time_stamp_last_loop) * 1e-6f), 0.002f, 0.04f);
_time_stamp_last_loop = time_stamp_now;