save learned mag bias per sensor (Multi-EKF support)

- handle saving the mag bias per sensor (across all estimator instances using that mag) in sensors/vehicle_magnetometer
 - this is now saving back to the actual mag calibration CAL_MAGn_OFF{X,Y,Z}
 - ekf2 reset mag mag bias on any magnetometer or calibration change
 - use Kalman filter scheme to update stored mag bias parameters using all available bias estimates for that sensor

Co-authored-by: Paul Riseborough <gncsolns@gmail.com>
This commit is contained in:
Daniel Agar
2021-01-07 09:54:13 -05:00
committed by GitHub
co-authored by Paul Riseborough
parent 537ee5b19b
commit 88f8da27ef
17 changed files with 328 additions and 308 deletions
-10
View File
@@ -903,16 +903,6 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t cal_ma
}
if (param_save) {
// reset the learned EKF mag in-flight bias offsets which have been learned for the previous
// sensor calibration and will be invalidated by a new sensor calibration
for (int axis = 0; axis < 3; axis++) {
char axis_char = 'X' + axis;
char str[20] {};
sprintf(str, "EKF2_MAGBIAS_%c", axis_char);
float offset = 0.f;
param_set_no_notification(param_find(str), &offset);
}
param_notify_changes();
}