Mag: fix estimated bias save to calibration

Clear the calibration at the end only otherwise everything gets erased
at the end of the first iteration of the outer loop
This commit is contained in:
bresch 2022-09-27 16:14:38 +02:00 committed by Daniel Agar
parent 2e7df77bff
commit 1ea4fe9b7b
No known key found for this signature in database
GPG Key ID: FD3CBA98017A69DE

View File

@ -312,16 +312,12 @@ void VehicleMagnetometer::UpdateMagCalibration()
_calibration[mag_index].ParametersSave();
_calibration_estimator_bias[mag_index].zero();
calibration_param_save_needed = true;
}
}
// clear
_mag_cal[i] = {};
}
_calibration_estimator_bias[mag_index].zero();
}
if (calibration_param_save_needed) {
@ -329,6 +325,11 @@ void VehicleMagnetometer::UpdateMagCalibration()
_last_calibration_update = hrt_absolute_time();
}
// clear all
for (int i = 0; i < ORB_MULTI_MAX_INSTANCES; i++) {
_mag_cal[i] = {};
}
_in_flight_mag_cal_available = false;
}
}