mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-16 14:47:35 +08:00
sensor_simulator: update EKF at IMU rate
This is how it is also done in ekf2_main. Otherwise, this leads to multiple integration of the same IMU data due to asynchronous sensor updates triggering a prediction step between IMU updates. Fix unit tests that broke because of this fix
This commit is contained in:
committed by
Mathieu Bresciani
parent
59183f70ba
commit
6126c190b2
@@ -15,11 +15,12 @@ Imu::~Imu()
|
||||
|
||||
void Imu::send(uint64_t time)
|
||||
{
|
||||
const float dt = float((time - _time_last_data_sent) * 1.e-6f);
|
||||
imuSample imu_sample{};
|
||||
imu_sample.time_us = time;
|
||||
imu_sample.delta_ang_dt = (time - _time_last_data_sent) * 1.e-6f;
|
||||
imu_sample.delta_ang_dt = dt;
|
||||
imu_sample.delta_ang = _gyro_data * imu_sample.delta_ang_dt;
|
||||
imu_sample.delta_vel_dt = (time - _time_last_data_sent) * 1.e-6f;
|
||||
imu_sample.delta_vel_dt = dt;
|
||||
imu_sample.delta_vel = _accel_data * imu_sample.delta_vel_dt;
|
||||
|
||||
_ekf->setIMUData(imu_sample);
|
||||
|
||||
Reference in New Issue
Block a user