lib/sensor_calibration: add simple offset and scale sanity checks

This commit is contained in:
Daniel Agar
2021-03-09 09:27:21 -05:00
committed by GitHub
parent c4ab2797eb
commit bd1c575ce8
3 changed files with 42 additions and 29 deletions
+5 -4
View File
@@ -126,10 +126,11 @@ void Gyroscope::SensorCorrectionsUpdate(bool force)
bool Gyroscope::set_offset(const Vector3f &offset)
{
if (Vector3f(_offset - offset).longerThan(0.01f)) {
_offset = offset;
_calibration_count++;
return true;
if (PX4_ISFINITE(offset(0)) && PX4_ISFINITE(offset(1)) && PX4_ISFINITE(offset(2))) {
_offset = offset;
_calibration_count++;
return true;
}
}
return false;