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 Mathieu Bresciani
parent 70d73c8690
commit 06f2004580
1 changed files with 7 additions and 6 deletions

View File

@ -331,16 +331,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) {
@ -348,6 +344,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;
}
}