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
+8 -8
View File
@@ -5,7 +5,7 @@
<!-- commands section -->
<servos>
<servo name="THROTTLE" no="0" min="1050" neutral="1050" max="1900"/>
<servo name="AILEVON_RIGHT" no="1" min="1850" neutral="1480" max="1100"/> <!-- 400 - 380 -->
<servo name="AILEVON_RIGHT" no="1" min="1850" neutral="1480" max="1100"/> <!-- 400 - 380 -->
<servo name="AILEVON_LEFT" no="2" min="1250" neutral="1580" max="1980"/> <!-- 300 - 400 -->
</servos>
@@ -28,7 +28,7 @@
<command_laws>
<let var="aileron" value="@ROLL * AILEVON_AILERON_RATE"/>
<let var="elevator" value="@PITCH * AILEVON_ELEVATOR_RATE"/>
<let var="elevator" value="@PITCH * AILEVON_ELEVATOR_RATE"/>
<set servo="THROTTLE" value="@THROTTLE"/>
<set servo="AILEVON_LEFT" value="$elevator + $aileron"/>
@@ -42,7 +42,7 @@
<section name="IMU" prefix="IMU_">
<!-- MAX1168 ADC CHANNELS -->
<!-- MAX1168 ADC CHANNELS -->
<define name="GYRO_P_CHAN" value="0"/>
<define name="GYRO_Q_CHAN" value="1"/>
<define name="GYRO_R_CHAN" value="2"/>
@@ -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"/>
@@ -92,7 +92,7 @@
<define name="MAG_X_SENS" value="1" integer="16"/>
<define name="MAG_Y_SENS" value="1" integer="16"/>
<define name="MAG_Z_SENS" value="1" integer="16"/>
<!-- <define name="MAG_45_HACK" value="1"/> -->
<define name="BODY_TO_IMU_PHI" value="0"/>
@@ -161,7 +161,7 @@
<define name="ROLL_ATTITUDE_GAIN" value="-6000."/>
<define name="ROLL_RATE_GAIN" value="-600."/>
<define name="ROLL_SLEW" value="0.02"/> <!-- Maximal roll angle change per 1/60 of second: 0.02 rad/loop * 180/pi * 60 loop/sec = 60 deg/sec -->
<define name="ROLL_SLEW" value="0.02"/> <!-- Maximal roll angle change per 1/60 of second: 0.02 rad/loop * 180/pi * 60 loop/sec = 60 deg/sec -->
</section>
<section name="AGGRESSIVE" prefix="AGR_">
+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