accel/gyro/mag calibration set default priority uninitialized

- this allows the default priority to be set differently for internal/external sensors
 - accel and gyro initialize default priority like mag in preparation for fully supporting external sensors
 - fixes #15652
This commit is contained in:
Daniel Agar
2020-09-13 21:02:53 -04:00
committed by GitHub
parent d70e183f5b
commit 13db2ebb2b
18 changed files with 86 additions and 36 deletions
+1 -2
View File
@@ -451,8 +451,7 @@ calibrate_return mag_calibrate_all(orb_advert_t *mavlink_log_pub, int32_t cal_ma
uORB::SubscriptionData<sensor_mag_s> mag_sub{ORB_ID(sensor_mag), cur_mag};
if (mag_sub.advertised() && (mag_sub.get().device_id != 0) && (mag_sub.get().timestamp > 0)) {
worker_data.calibration[cur_mag].set_device_id(mag_sub.get().device_id);
worker_data.calibration[cur_mag].set_external(mag_sub.get().is_external);
worker_data.calibration[cur_mag].set_device_id(mag_sub.get().device_id, mag_sub.get().is_external);
}
// reset calibration index to match uORB numbering
+2 -1
View File
@@ -42,6 +42,7 @@ PARAM_DEFINE_INT32(CAL_ACC0_ID, 0);
/**
* Accelerometer 0 priority.
*
* @value -1 Uninitialized
* @value 0 Disabled
* @value 1 Min
* @value 25 Low
@@ -52,7 +53,7 @@ PARAM_DEFINE_INT32(CAL_ACC0_ID, 0);
* @category system
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_ACC0_PRIO, 50);
PARAM_DEFINE_INT32(CAL_ACC0_PRIO, -1);
/**
* Accelerometer X-axis offset
+2 -1
View File
@@ -42,6 +42,7 @@ PARAM_DEFINE_INT32(CAL_ACC1_ID, 0);
/**
* Accelerometer 1 priority.
*
* @value -1 Uninitialized
* @value 0 Disabled
* @value 1 Min
* @value 25 Low
@@ -52,7 +53,7 @@ PARAM_DEFINE_INT32(CAL_ACC1_ID, 0);
* @category system
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_ACC1_PRIO, 50);
PARAM_DEFINE_INT32(CAL_ACC1_PRIO, -1);
/**
* Accelerometer X-axis offset
+2 -1
View File
@@ -42,6 +42,7 @@ PARAM_DEFINE_INT32(CAL_ACC2_ID, 0);
/**
* Accelerometer 2 priority.
*
* @value -1 Uninitialized
* @value 0 Disabled
* @value 1 Min
* @value 25 Low
@@ -52,7 +53,7 @@ PARAM_DEFINE_INT32(CAL_ACC2_ID, 0);
* @category system
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_ACC2_PRIO, 50);
PARAM_DEFINE_INT32(CAL_ACC2_PRIO, -1);
/**
* Accelerometer X-axis offset
+2 -1
View File
@@ -42,6 +42,7 @@ PARAM_DEFINE_INT32(CAL_GYRO0_ID, 0);
/**
* Gyro 0 priority.
*
* @value -1 Uninitialized
* @value 0 Disabled
* @value 1 Min
* @value 25 Low
@@ -52,7 +53,7 @@ PARAM_DEFINE_INT32(CAL_GYRO0_ID, 0);
* @category system
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_GYRO0_PRIO, 50);
PARAM_DEFINE_INT32(CAL_GYRO0_PRIO, -1);
/**
* Gyro X-axis offset
+2 -1
View File
@@ -42,6 +42,7 @@ PARAM_DEFINE_INT32(CAL_GYRO1_ID, 0);
/**
* Gyro 1 priority.
*
* @value -1 Uninitialized
* @value 0 Disabled
* @value 1 Min
* @value 25 Low
@@ -52,7 +53,7 @@ PARAM_DEFINE_INT32(CAL_GYRO1_ID, 0);
* @category system
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_GYRO1_PRIO, 50);
PARAM_DEFINE_INT32(CAL_GYRO1_PRIO, -1);
/**
* Gyro X-axis offset
+2 -1
View File
@@ -42,6 +42,7 @@ PARAM_DEFINE_INT32(CAL_GYRO2_ID, 0);
/**
* Gyro 2 priority.
*
* @value -1 Uninitialized
* @value 0 Disabled
* @value 1 Min
* @value 25 Low
@@ -52,7 +53,7 @@ PARAM_DEFINE_INT32(CAL_GYRO2_ID, 0);
* @category system
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_GYRO2_PRIO, 50);
PARAM_DEFINE_INT32(CAL_GYRO2_PRIO, -1);
/**
* Gyro X-axis offset
+2 -1
View File
@@ -42,6 +42,7 @@ PARAM_DEFINE_INT32(CAL_MAG0_ID, 0);
/**
* Mag 0 priority.
*
* @value -1 Uninitialized
* @value 0 Disabled
* @value 1 Min
* @value 25 Low
@@ -52,7 +53,7 @@ PARAM_DEFINE_INT32(CAL_MAG0_ID, 0);
* @category system
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_MAG0_PRIO, 50);
PARAM_DEFINE_INT32(CAL_MAG0_PRIO, -1);
/**
* Rotation of magnetometer 0 relative to airframe.
+2 -1
View File
@@ -42,6 +42,7 @@ PARAM_DEFINE_INT32(CAL_MAG1_ID, 0);
/**
* Mag 1 priority.
*
* @value -1 Uninitialized
* @value 0 Disabled
* @value 1 Min
* @value 25 Low
@@ -52,7 +53,7 @@ PARAM_DEFINE_INT32(CAL_MAG1_ID, 0);
* @category system
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_MAG1_PRIO, 50);
PARAM_DEFINE_INT32(CAL_MAG1_PRIO, -1);
/**
* Rotation of magnetometer 1 relative to airframe.
+2 -1
View File
@@ -42,6 +42,7 @@ PARAM_DEFINE_INT32(CAL_MAG2_ID, 0);
/**
* Mag 2 priority.
*
* @value -1 Uninitialized
* @value 0 Disabled
* @value 1 Min
* @value 25 Low
@@ -52,7 +53,7 @@ PARAM_DEFINE_INT32(CAL_MAG2_ID, 0);
* @category system
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_MAG2_PRIO, 50);
PARAM_DEFINE_INT32(CAL_MAG2_PRIO, -1);
/**
* Rotation of magnetometer 2 relative to airframe.
+2 -1
View File
@@ -42,6 +42,7 @@ PARAM_DEFINE_INT32(CAL_MAG3_ID, 0);
/**
* Mag 3 priority.
*
* @value -1 Uninitialized
* @value 0 Disabled
* @value 1 Min
* @value 25 Low
@@ -52,7 +53,7 @@ PARAM_DEFINE_INT32(CAL_MAG3_ID, 0);
* @category system
* @group Sensor Calibration
*/
PARAM_DEFINE_INT32(CAL_MAG3_PRIO, 50);
PARAM_DEFINE_INT32(CAL_MAG3_PRIO, -1);
/**
* Rotation of magnetometer 3 relative to airframe.
@@ -224,8 +224,7 @@ void VehicleMagnetometer::Run()
updated[uorb_index] = true;
if (_calibration[uorb_index].device_id() != report.device_id) {
_calibration[uorb_index].set_external(report.is_external);
_calibration[uorb_index].set_device_id(report.device_id);
_calibration[uorb_index].set_device_id(report.device_id, report.is_external);
_priority[uorb_index] = _calibration[uorb_index].priority();
}