sensors: minor IMU bias saving updates

- sensors/vehicle_imu: reset learned cal on any calibration change
during parameter update
 - sensors/vehicle_imu: cleanup logic estimated bias -> calibration offset
saving
   - don't invalidate saved calibration (the point is to keep the last valid)
   - remove old debug code, etc
 - sensors/vehicle_imu: notify parameter changes if accel or gyro
calibration has changed
 - lib/sensor_calibration: add calibrated() and calibration_index()
getters, keep Accelerometer/Gyroscope/Magnetometer in sync
This commit is contained in:
Daniel Agar
2022-01-06 14:19:26 -05:00
parent 5d7ddf5734
commit aec97e0020
8 changed files with 66 additions and 75 deletions
+5 -5
View File
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (c) 2020-2021 PX4 Development Team. All rights reserved.
* Copyright (c) 2020-2022 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -60,10 +60,6 @@ void Accelerometer::set_device_id(uint32_t device_id, bool external)
set_external(external);
_device_id = device_id;
if (_device_id != 0) {
_calibration_index = FindCalibrationIndex(SensorString(), _device_id);
}
ParametersUpdate();
SensorCorrectionsUpdate(true);
}
@@ -166,6 +162,10 @@ void Accelerometer::set_rotation(Rotation rotation)
void Accelerometer::ParametersUpdate()
{
if (_device_id != 0) {
_calibration_index = FindCalibrationIndex(SensorString(), _device_id);
}
if (_calibration_index >= 0) {
// CAL_ACCx_ROT