mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-03 10:51:35 +08:00
DF wrappers: use abs time instead of DF timestamp
The timestamp in the DriverFramework is not the same as the one provided by hrt_absolute_time() in PX4. Because we are publishing on the PX4 side, let's also use the timestamp from there.
This commit is contained in:
@@ -161,7 +161,7 @@ int DfBmp280Wrapper::_publish(struct baro_sensor_data &data)
|
|||||||
perf_begin(_baro_sample_perf);
|
perf_begin(_baro_sample_perf);
|
||||||
|
|
||||||
baro_report baro_report = {};
|
baro_report baro_report = {};
|
||||||
baro_report.timestamp = data.last_read_time_usec;
|
baro_report.timestamp = hrt_absolute_time();
|
||||||
|
|
||||||
baro_report.pressure = data.pressure_pa;
|
baro_report.pressure = data.pressure_pa;
|
||||||
baro_report.temperature = data.temperature_c;
|
baro_report.temperature = data.temperature_c;
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ int DfHmc9250Wrapper::_publish(struct mag_sensor_data &data)
|
|||||||
perf_begin(_mag_sample_perf);
|
perf_begin(_mag_sample_perf);
|
||||||
|
|
||||||
mag_report mag_report = {};
|
mag_report mag_report = {};
|
||||||
mag_report.timestamp = data.last_read_time_usec;
|
mag_report.timestamp = hrt_absolute_time();
|
||||||
|
|
||||||
/* The standard external mag by 3DR has x pointing to the
|
/* The standard external mag by 3DR has x pointing to the
|
||||||
* right, y pointing backwards, and z down, therefore switch x
|
* right, y pointing backwards, and z down, therefore switch x
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ int DfMpu9250Wrapper::_publish(struct imu_sensor_data &data)
|
|||||||
perf_begin(_accel_sample_perf);
|
perf_begin(_accel_sample_perf);
|
||||||
|
|
||||||
accel_report accel_report = {};
|
accel_report accel_report = {};
|
||||||
accel_report.timestamp = data.last_read_time_usec;
|
accel_report.timestamp = hrt_absolute_time();
|
||||||
|
|
||||||
// TODO: remove these (or get the values)
|
// TODO: remove these (or get the values)
|
||||||
accel_report.x_raw = NAN;
|
accel_report.x_raw = NAN;
|
||||||
@@ -456,7 +456,7 @@ int DfMpu9250Wrapper::_publish(struct imu_sensor_data &data)
|
|||||||
perf_begin(_gyro_sample_perf);
|
perf_begin(_gyro_sample_perf);
|
||||||
|
|
||||||
gyro_report gyro_report = {};
|
gyro_report gyro_report = {};
|
||||||
gyro_report.timestamp = data.last_read_time_usec;
|
gyro_report.timestamp = hrt_absolute_time();
|
||||||
|
|
||||||
// TODO: remove these (or get the values)
|
// TODO: remove these (or get the values)
|
||||||
gyro_report.x_raw = NAN;
|
gyro_report.x_raw = NAN;
|
||||||
|
|||||||
Reference in New Issue
Block a user