mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 19:32:36 +08:00
mc_att_control: use attitude timestamp for dt
This commit is contained in:
@@ -287,10 +287,10 @@ MulticopterAttitudeControl::Run()
|
|||||||
_attitude_control.adaptAttitudeSetpoint(delta_q_reset);
|
_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.
|
// 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;
|
_last_run = now;
|
||||||
|
|
||||||
/* check for updates in other topics */
|
/* check for updates in other topics */
|
||||||
|
|||||||
Reference in New Issue
Block a user