forked from Archive/PX4-Autopilot
sensors: fix IMU init race condition
- IMU init requires valid published data (device ids, etc) - orb_group_count will include advertised instances before data is published, so this can't be used to throttle IMU init attempts
This commit is contained in:
parent
b2742658b7
commit
76a8617529
|
@ -665,7 +665,7 @@ void Sensors::Run()
|
|||
|
||||
// keep adding sensors as long as we are not armed,
|
||||
// when not adding sensors poll for param updates
|
||||
if (!_armed && hrt_elapsed_time(&_last_config_update) > 500_ms) {
|
||||
if (!_armed && hrt_elapsed_time(&_last_config_update) > 1000_ms) {
|
||||
|
||||
const int n_accel = orb_group_count(ORB_ID(sensor_accel));
|
||||
const int n_baro = orb_group_count(ORB_ID(sensor_baro));
|
||||
|
@ -679,15 +679,18 @@ void Sensors::Run()
|
|||
_n_gps = n_gps;
|
||||
_n_gyro = n_gyro;
|
||||
_n_mag = n_mag;
|
||||
|
||||
parameters_update();
|
||||
|
||||
_voted_sensors_update.initializeSensors();
|
||||
InitializeVehicleAirData();
|
||||
InitializeVehicleIMU();
|
||||
InitializeVehicleGPSPosition();
|
||||
InitializeVehicleMagnetometer();
|
||||
}
|
||||
|
||||
// sensor device id (not just orb_group_count) must be populated before IMU init can succeed
|
||||
_voted_sensors_update.initializeSensors();
|
||||
InitializeVehicleIMU();
|
||||
|
||||
_last_config_update = hrt_absolute_time();
|
||||
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue