AP_InertialSensor: Add parameters defining accelerometer position offset

This commit is contained in:
priseborough 2016-10-08 09:11:10 +11:00 committed by Andrew Tridgell
parent b51c9dea6c
commit 6db93d8a21
2 changed files with 69 additions and 0 deletions

View File

@ -318,6 +318,64 @@ const AP_Param::GroupInfo AP_InertialSensor::var_info[] = {
// @User: Advanced
// @Values: 1:IMU 1,2:IMU 2,3:IMU 3
AP_GROUPINFO("ACC_BODYFIX", 26, AP_InertialSensor, _acc_body_aligned, 2),
// @Param: POS1_X
// @DisplayName: IMU accelerometer X position
// @Description: X position of the first IMU Accelerometer in body frame.
// @Units: m
// @User: Advanced
// @Param: POS1_Y
// @DisplayName: IMU accelerometer Y position
// @Description: Y position of the first IMU accelerometer in body frame.
// @Units: m
// @User: Advanced
// @Param: POS1_Z
// @DisplayName: IMU accelerometer Z position
// @Description: Z position of the first IMU accelerometer in body frame.
// @Units: m
// @User: Advanced
AP_GROUPINFO("POS1", 27, AP_InertialSensor, _accel_pos[0], 0.0f),
// @Param: POS2_X
// @DisplayName: IMU accelerometer X position
// @Description: X position of the second IMU accelerometer in body frame.
// @Units: m
// @User: Advanced
// @Param: POS2_Y
// @DisplayName: IMU accelerometer Y position
// @Description: Y position of the second IMU accelerometer in body frame.
// @Units: m
// @User: Advanced
// @Param: POS2_Z
// @DisplayName: IMU accelerometer Z position
// @Description: Z position of the second IMU accelerometer in body frame.
// @Units: m
// @User: Advanced
AP_GROUPINFO("POS2", 28, AP_InertialSensor, _accel_pos[1], 0.0f),
// @Param: POS3_X
// @DisplayName: IMU accelerometer X position
// @Description: X position of the third IMU accelerometer in body frame.
// @Units: m
// @User: Advanced
// @Param: POS3_Y
// @DisplayName: IMU accelerometer Y position
// @Description: Y position of the third IMU accelerometer in body frame.
// @Units: m
// @User: Advanced
// @Param: POS3_Z
// @DisplayName: IMU accelerometer Z position
// @Description: Z position of the third IMU accelerometer in body frame.
// @Units: m
// @User: Advanced
AP_GROUPINFO("POS3", 29, AP_InertialSensor, _accel_pos[2], 0.0f),
/*
NOTE: parameter indexes have gaps above. When adding new
parameters check for conflicts carefully

View File

@ -141,6 +141,14 @@ public:
const Vector3f &get_accel_scale(uint8_t i) const { return _accel_scale[i]; }
const Vector3f &get_accel_scale(void) const { return get_accel_scale(_primary_accel); }
// return a 3D vector defining the position offset of the IMU accelerometer in metres relative to the body frame origin
const Vector3f get_imu_pos_offset(uint8_t instance) const {
return _accel_pos[instance];
}
const Vector3f get_imu_pos_offset(void) const {
return _accel_pos[_primary_accel];
}
// return the temperature if supported. Zero is returned if no
// temperature is available
float get_temperature(uint8_t instance) const { return _temperature[instance]; }
@ -318,6 +326,9 @@ private:
AP_Vector3f _accel_offset[INS_MAX_INSTANCES];
AP_Vector3f _gyro_offset[INS_MAX_INSTANCES];
// accelerometer position offset in body frame
AP_Vector3f _accel_pos[INS_MAX_INSTANCES];
// accelerometer max absolute offsets to be used for calibration
float _accel_max_abs_offsets[INS_MAX_INSTANCES];