From 8e38ef6567632a97dba7440dd73994165c47d418 Mon Sep 17 00:00:00 2001 From: James Bielman Date: Mon, 7 Jan 2013 09:29:29 -0800 Subject: [PATCH] MPU6000: Flip Y and Z axes for SMACCM_HAL. - The accelerometer is upside-down on the PX4FMU vs the APM2. --- .../AP_InertialSensor/AP_InertialSensor_MPU6000.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libraries/AP_InertialSensor/AP_InertialSensor_MPU6000.cpp b/libraries/AP_InertialSensor/AP_InertialSensor_MPU6000.cpp index b7016fad93..bdae7132bf 100644 --- a/libraries/AP_InertialSensor/AP_InertialSensor_MPU6000.cpp +++ b/libraries/AP_InertialSensor/AP_InertialSensor_MPU6000.cpp @@ -171,12 +171,19 @@ const float AP_InertialSensor_MPU6000::_gyro_scale = (0.0174532 / 16.4); /* pch: I believe the accel and gyro indicies are correct * but somone else should please confirm. + * + * jamesjb: Y and Z axes are flipped on the PX4FMU */ const uint8_t AP_InertialSensor_MPU6000::_gyro_data_index[3] = { 5, 4, 6 }; -const int8_t AP_InertialSensor_MPU6000::_gyro_data_sign[3] = { 1, 1, -1 }; - const uint8_t AP_InertialSensor_MPU6000::_accel_data_index[3] = { 1, 0, 2 }; + +#if CONFIG_HAL_BOARD == HAL_BOARD_SMACCM +const int8_t AP_InertialSensor_MPU6000::_gyro_data_sign[3] = { 1, -1, 1 }; +const int8_t AP_InertialSensor_MPU6000::_accel_data_sign[3] = { 1, -1, 1 }; +#else +const int8_t AP_InertialSensor_MPU6000::_gyro_data_sign[3] = { 1, 1, -1 }; const int8_t AP_InertialSensor_MPU6000::_accel_data_sign[3] = { 1, 1, -1 }; +#endif const uint8_t AP_InertialSensor_MPU6000::_temp_data_index = 3;