mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 10:23:35 +08:00
multicopter: minimize dt jitter by using estimate timestamp_sample
This commit is contained in:
@@ -99,7 +99,7 @@ void FlightModeManager::Run()
|
||||
vehicle_local_position_s vehicle_local_position;
|
||||
|
||||
if (_vehicle_local_position_sub.update(&vehicle_local_position)) {
|
||||
const hrt_abstime time_stamp_now = hrt_absolute_time();
|
||||
const hrt_abstime time_stamp_now = vehicle_local_position.timestamp_sample;
|
||||
// Guard against too small (< 0.2ms) and too large (> 100ms) dt's.
|
||||
const float dt = math::constrain(((time_stamp_now - _time_stamp_last_loop) / 1e6f), 0.0002f, 0.1f);
|
||||
_time_stamp_last_loop = time_stamp_now;
|
||||
|
||||
Reference in New Issue
Block a user