From 5b5604250cc4f59fde2799281853d2c2503bc35c Mon Sep 17 00:00:00 2001 From: Gautier Hattenberger Date: Thu, 6 Oct 2022 14:29:14 +0200 Subject: [PATCH] [imu] apply signs corrections on default configurations only needed for single imu config --- sw/airborne/modules/imu/imu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sw/airborne/modules/imu/imu.c b/sw/airborne/modules/imu/imu.c index b00ceb8c94..64f0904453 100644 --- a/sw/airborne/modules/imu/imu.c +++ b/sw/airborne/modules/imu/imu.c @@ -303,7 +303,7 @@ void imu_init(void) INT_RATES_ZERO(imu.gyros[i].neutral); } if(!imu.gyros[i].calibrated.scale) { - RATES_ASSIGN(imu.gyros[i].scale[0], 1, 1, 1); + RATES_ASSIGN(imu.gyros[i].scale[0], IMU_GYRO_P_SIGN, IMU_GYRO_Q_SIGN, IMU_GYRO_R_SIGN); RATES_ASSIGN(imu.gyros[i].scale[1], 1, 1, 1); } if(!imu.gyros[i].calibrated.rotation) { @@ -329,7 +329,7 @@ void imu_init(void) INT_VECT3_ZERO(imu.accels[i].neutral); } if(!imu.accels[i].calibrated.scale) { - VECT3_ASSIGN(imu.accels[i].scale[0], 1, 1, 1); + VECT3_ASSIGN(imu.accels[i].scale[0], IMU_ACCEL_X_SIGN, IMU_ACCEL_Y_SIGN, IMU_ACCEL_Z_SIGN); VECT3_ASSIGN(imu.accels[i].scale[1], 1, 1, 1); } if(!imu.accels[i].calibrated.rotation) { @@ -356,7 +356,7 @@ void imu_init(void) INT_VECT3_ZERO(imu.mags[i].neutral); } if(!imu.mags[i].calibrated.scale) { - VECT3_ASSIGN(imu.mags[i].scale[0], 1, 1, 1); + VECT3_ASSIGN(imu.mags[i].scale[0], IMU_MAG_X_SIGN, IMU_MAG_Y_SIGN, IMU_MAG_Z_SIGN); VECT3_ASSIGN(imu.mags[i].scale[1], 1, 1, 1); } if(!imu.mags[i].calibrated.rotation) { @@ -415,7 +415,7 @@ void imu_set_defaults_gyro(uint8_t abi_id, const struct Int32RMat *imu_to_sensor if(neutral != NULL && !gyro->calibrated.neutral) RATES_COPY(gyro->neutral, *neutral); if(scale != NULL && !gyro->calibrated.scale) { - RATES_COPY(gyro->scale[0], scale[0]); + RATES_ASSIGN(gyro->scale[0], IMU_GYRO_P_SIGN*scale[0].p, IMU_GYRO_Q_SIGN*scale[0].q, IMU_GYRO_R_SIGN*scale[0].r); RATES_COPY(gyro->scale[1], scale[1]); } } @@ -445,7 +445,7 @@ void imu_set_defaults_accel(uint8_t abi_id, const struct Int32RMat *imu_to_senso if(neutral != NULL && !accel->calibrated.neutral) VECT3_COPY(accel->neutral, *neutral); if(scale != NULL && !accel->calibrated.scale) { - VECT3_COPY(accel->scale[0], scale[0]); + VECT3_ASSIGN(accel->scale[0], IMU_ACCEL_X_SIGN*scale[0].x, IMU_ACCEL_Y_SIGN*scale[0].y, IMU_ACCEL_Z_SIGN*scale[0].z); VECT3_COPY(accel->scale[1], scale[1]); } } @@ -475,7 +475,7 @@ void imu_set_defaults_mag(uint8_t abi_id, const struct Int32RMat *imu_to_sensor, if(neutral != NULL && !mag->calibrated.neutral) VECT3_COPY(mag->neutral, *neutral); if(scale != NULL && !mag->calibrated.scale) { - VECT3_COPY(mag->scale[0], scale[0]); + VECT3_ASSIGN(mag->scale[0], IMU_MAG_X_SIGN*scale[0].x, IMU_MAG_Y_SIGN*scale[0].y, IMU_MAG_Z_SIGN*scale[0].z); VECT3_COPY(mag->scale[1], scale[1]); } }