mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-13 14:10:35 +08:00
INAV: Update to new sensors combined topic
This commit is contained in:
@@ -399,13 +399,13 @@ int position_estimator_inav_thread_main(int argc, char *argv[])
|
||||
if (fds_init[0].revents & POLLIN) {
|
||||
orb_copy(ORB_ID(sensor_combined), sensor_combined_sub, &sensor);
|
||||
|
||||
if (wait_baro && sensor.baro_timestamp != baro_timestamp) {
|
||||
baro_timestamp = sensor.baro_timestamp;
|
||||
if (wait_baro && sensor.baro_timestamp[0] != baro_timestamp) {
|
||||
baro_timestamp = sensor.baro_timestamp[0];
|
||||
|
||||
/* mean calculation over several measurements */
|
||||
if (baro_init_cnt < baro_init_num) {
|
||||
if (PX4_ISFINITE(sensor.baro_alt_meter)) {
|
||||
baro_offset += sensor.baro_alt_meter;
|
||||
if (PX4_ISFINITE(sensor.baro_alt_meter[0])) {
|
||||
baro_offset += sensor.baro_alt_meter[0];
|
||||
baro_init_cnt++;
|
||||
}
|
||||
|
||||
@@ -474,7 +474,7 @@ int position_estimator_inav_thread_main(int argc, char *argv[])
|
||||
if (updated) {
|
||||
orb_copy(ORB_ID(sensor_combined), sensor_combined_sub, &sensor);
|
||||
|
||||
if (sensor.accelerometer_timestamp != accel_timestamp) {
|
||||
if (sensor.accelerometer_timestamp[0] != accel_timestamp) {
|
||||
if (att.R_valid) {
|
||||
/* correct accel bias */
|
||||
sensor.accelerometer_m_s2[0] -= acc_bias[0];
|
||||
@@ -496,13 +496,13 @@ int position_estimator_inav_thread_main(int argc, char *argv[])
|
||||
memset(acc, 0, sizeof(acc));
|
||||
}
|
||||
|
||||
accel_timestamp = sensor.accelerometer_timestamp;
|
||||
accel_timestamp = sensor.accelerometer_timestamp[0];
|
||||
accel_updates++;
|
||||
}
|
||||
|
||||
if (sensor.baro_timestamp != baro_timestamp) {
|
||||
corr_baro = baro_offset - sensor.baro_alt_meter - z_est[0];
|
||||
baro_timestamp = sensor.baro_timestamp;
|
||||
if (sensor.baro_timestamp[0] != baro_timestamp) {
|
||||
corr_baro = baro_offset - sensor.baro_alt_meter[0] - z_est[0];
|
||||
baro_timestamp = sensor.baro_timestamp[0];
|
||||
baro_updates++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user