gyro_calibration: add additional validity check before finalizing calibrations

- this can slip through if sensors are running normally, but then stop publishing valid data
This commit is contained in:
Daniel Agar
2022-02-17 21:53:59 -05:00
parent dab7b007de
commit d5d50d5855
@@ -232,7 +232,7 @@ void GyroCalibration::Run()
bool calibration_updated = false;
for (int gyro = 0; gyro < _sensor_gyro_subs.size(); gyro++) {
if (_gyro_calibration[gyro].device_id() != 0) {
if (_gyro_calibration[gyro].device_id() != 0 && _gyro_mean[gyro].valid()) {
// check variance again before saving
if (_gyro_mean[gyro].variance().longerThan(0.001f)) {