sensor calibration delete temperature (CAL_ACCx_TEMP, CAL_GYROx_TEMP, CAL_MAGx_TEMP)

- this was an experiment to casually monitor sensor offsets relative to temperature, but now that all calibration offsets can be adjusted post-flight the stored temperature can be misleading
 - deleting to save a little bit of flash (and storing the temperature wasn't useful)
This commit is contained in:
Daniel Agar
2022-03-12 11:38:49 -05:00
committed by GitHub
parent aa64789792
commit 3d54d25867
15 changed files with 11 additions and 196 deletions
-15
View File
@@ -94,8 +94,6 @@ struct mag_worker_data_t {
float *y[MAX_MAGS];
float *z[MAX_MAGS];
float temperature[MAX_MAGS] {NAN, NAN, NAN, NAN};
calibration::Magnetometer calibration[MAX_MAGS] {};
};
@@ -342,7 +340,6 @@ static calibrate_return mag_calibration_worker(detect_orientation_return orienta
if (mag_sub[0].updatedBlocking(1000_ms)) {
bool rejected = false;
Vector3f new_samples[MAX_MAGS] {};
float new_temperature[MAX_MAGS] {NAN, NAN, NAN, NAN};
for (uint8_t cur_mag = 0; cur_mag < MAX_MAGS; cur_mag++) {
if (worker_data->calibration[cur_mag].device_id() != 0) {
@@ -371,7 +368,6 @@ static calibrate_return mag_calibration_worker(detect_orientation_return orienta
if (!reject) {
new_samples[cur_mag] = Vector3f{mag.x, mag.y, mag.z};
new_temperature[cur_mag] = mag.temperature;
updated = true;
break;
}
@@ -392,14 +388,6 @@ static calibrate_return mag_calibration_worker(detect_orientation_return orienta
worker_data->y[cur_mag][worker_data->calibration_counter_total[cur_mag]] = new_samples[cur_mag](1);
worker_data->z[cur_mag][worker_data->calibration_counter_total[cur_mag]] = new_samples[cur_mag](2);
if (!PX4_ISFINITE(worker_data->temperature[cur_mag])) {
// set first valid value
worker_data->temperature[cur_mag] = new_temperature[cur_mag];
} else {
worker_data->temperature[cur_mag] = 0.5f * (worker_data->temperature[cur_mag] + new_temperature[cur_mag]);
}
worker_data->calibration_counter_total[cur_mag]++;
}
}
@@ -912,8 +900,6 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t cal_ma
current_cal.set_offdiagonal(offdiag[cur_mag]);
}
current_cal.set_temperature(worker_data.temperature[cur_mag]);
current_cal.PrintStatus();
if (current_cal.ParametersSave(cur_mag, true)) {
@@ -1019,7 +1005,6 @@ int do_mag_calibration_quick(orb_advert_t *mavlink_log_pub, float heading_radian
// use any existing scale and store the offset to the expected earth field
const Vector3f offset = Vector3f{mag.x, mag.y, mag.z} - (cal.scale().I() * cal.rotation().transpose() * expected_field);
cal.set_offset(offset);
cal.set_temperature(mag.temperature);
// save new calibration
if (cal.ParametersSave(cur_mag)) {