Sign convention fix: stationary accelerometer measures [0 0 -9.81]

This commit is contained in:
Christophe De Wagter
2011-05-06 14:00:37 +02:00
parent 663196b10e
commit a1eac67a74
3 changed files with 17 additions and 10 deletions
+3 -3
View File
@@ -81,9 +81,9 @@
<define name="ACCEL_Y_SENS" value="0.9346" integer="16"/>
<define name="ACCEL_Z_SENS" value="0.9178" integer="16"/>
<define name="ACCEL_X_SIGN" value="-1"/>
<define name="ACCEL_Y_SIGN" value="1"/>
<define name="ACCEL_Z_SIGN" value="1"/>
<define name="ACCEL_X_SIGN" value="1"/>
<define name="ACCEL_Y_SIGN" value="-1"/>
<define name="ACCEL_Z_SIGN" value="-1"/>
<define name="MAG_X_NEUTRAL" value="0"/>
<define name="MAG_Y_NEUTRAL" value="0"/>
+2 -2
View File
@@ -195,9 +195,9 @@ void ppzuavimu_module_event( void )
z = (int16_t) ((ppzuavimu_adxl345.buf[5] << 8) | ppzuavimu_adxl345.buf[4]);
#ifdef ASPIRIN_IMU
VECT3_ASSIGN(imu.accel_unscaled, -x, y, z);
VECT3_ASSIGN(imu.accel_unscaled, x, -y, -z);
#else // PPZIMU
VECT3_ASSIGN(imu.accel_unscaled, x, -y, z);
VECT3_ASSIGN(imu.accel_unscaled, -x, y, -z);
#endif
acc_valid = TRUE;
@@ -213,6 +213,13 @@ void ahrs_update_accel(void)
ACCELS_FLOAT_OF_BFP(accel_float, imu.accel);
// DCM filter uses g-force as positive
// accelerometer measures [0 0 -g] in a static case
accel_float.x = -accel_float.x;
accel_float.y = -accel_float.y;
accel_float.z = -accel_float.z;
#ifdef USE_GPS
if (gps.fix == GPS_FIX_3D) { //Remove centrifugal acceleration.
accel_float.y += gps.speed_3d/100. * Omega[2]; // Centrifugal force on Acc_y = GPS_speed*GyroZ