mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-22 19:17:36 +08:00
gyro_calibration: reset on any sensor timeout
This commit is contained in:
@@ -155,6 +155,7 @@ void GyroCalibration::Run()
|
||||
if (_gyro_calibration[gyro].device_id() == sensor_gyro.device_id) {
|
||||
const Vector3f val{Vector3f{sensor_gyro.x, sensor_gyro.y, sensor_gyro.z} - _gyro_calibration[gyro].thermal_offset()};
|
||||
_gyro_mean[gyro].update(val);
|
||||
_gyro_last_update[gyro] = sensor_gyro.timestamp;
|
||||
|
||||
} else {
|
||||
// setting device id, reset all
|
||||
@@ -162,6 +163,13 @@ void GyroCalibration::Run()
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
|
||||
if ((_gyro_last_update[gyro] != 0) && (hrt_elapsed_time(&_gyro_last_update[gyro]) > 100_ms)) {
|
||||
// reset on any timeout
|
||||
Reset();
|
||||
_gyro_last_update[gyro] = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@ private:
|
||||
calibration::Gyroscope _gyro_calibration[MAX_SENSORS] {};
|
||||
math::WelfordMean<matrix::Vector3f> _gyro_mean[MAX_SENSORS] {};
|
||||
float _temperature[MAX_SENSORS] {};
|
||||
hrt_abstime _gyro_last_update[MAX_SENSORS] {};
|
||||
|
||||
matrix::Vector3f _acceleration[MAX_SENSORS] {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user