altos: Reset TMega v6.0 BMI axes to not adjust any signs bmi088
authorKeith Packard <keithp@keithp.com>
Thu, 16 Feb 2023 21:53:38 +0000 (13:53 -0800)
committerKeith Packard <keithp@keithp.com>
Thu, 16 Feb 2023 21:53:38 +0000 (13:53 -0800)
Try to figure out why the data doesn't match the docs.

Signed-off-by: Keith Packard <keithp@keithp.com>
src/drivers/ao_bmi088.c
src/easymega-v3.0/ao_pins.h
src/telemega-v5.0/ao_pins.h
src/telemega-v6.0/ao_pins.h

index d03fceab65845ea6aad79fec4ba83c1889b9b4b5..d25f17e0d855fe645a3e090986d76bc33e237a09 100644 (file)
@@ -297,6 +297,7 @@ ao_bmi088_show(void)
                ao_bmi088_pitch(&ao_bmi088_current),
                ao_bmi088_yaw(&ao_bmi088_current));
 #else
+#error BMI088 should only be used with normalized values
        printf ("Accel: %7d %7d %7d Gyro: %7d %7d %7d\n",
                ao_bmi088_current.acc.x,
                ao_bmi088_current.acc.y,
index 863909d553342c140f56f823835893cbbb8ccdb8..2fa4fd011c64c8114446b21bcd6a059f7c6588e6 100644 (file)
@@ -177,7 +177,7 @@ struct ao_adc {
 };
 
 #define AO_ADC_DUMP(p) \
-       printf("tick: %5u A: %5d B: %5d C: %5d D: %5d drogue: %5d main: %5d batt: %5d pbatt: %5d temp: %5d\n", \
+       printf("tick: %5lu A: %5d B: %5d C: %5d D: %5d drogue: %5d main: %5d batt: %5d pbatt: %5d temp: %5d\n", \
               (p)->tick, \
               (p)->adc.sense[0], (p)->adc.sense[1], (p)->adc.sense[2], \
               (p)->adc.sense[3], (p)->adc.sense[4], (p)->adc.sense[5], \
index 3f2c9ea44e5365a8c7862499c874b21a8c6a7d50..03b9c142c52930160a0bdde49511d6dd8e59503a 100644 (file)
@@ -344,7 +344,7 @@ struct ao_adc {
  *     pin 1 NW corner of chip
  *
  *     +along          +Y      +roll   +Y
- *     +across         -X      +pitch  -X
+ *     +across         +X      +pitch  +X
  *     +through        +Z      +yaw    +Z
  *
  */
@@ -358,11 +358,11 @@ struct ao_adc {
 #define HAS_IMU                        1
 
 #define ao_mpu6000_along(m)    ((m)->accel_y)
-#define ao_mpu6000_across(m)   (-(m)->accel_x)
+#define ao_mpu6000_across(m)   ((m)->accel_x)
 #define ao_mpu6000_through(m)  ((m)->accel_z)
 
 #define ao_mpu6000_roll(m)     ((m)->gyro_y)
-#define ao_mpu6000_pitch(m)    (-(m)->gyro_x)
+#define ao_mpu6000_pitch(m)    ((m)->gyro_x)
 #define ao_mpu6000_yaw(m)      ((m)->gyro_z)
 
 #define ao_data_along(packet)  ao_mpu6000_along(&(packet)->mpu6000)
index 89af7ed2135107c95af3fc5459a43f00b500bd24..2d27314a86630ddfdd292777a0d963807a67a8ca 100644 (file)
@@ -333,6 +333,20 @@ struct ao_adc {
  * +along      north   +roll   left up
  * +across     west    +pitch  nose down
  * +through    up      +yaw    left turn
+ *
+ * 2023-2-16 -- keithp -- I think this is incorrect. Bdale
+ * measured all of the boards with the following results.
+ *
+ * +along      nose up
+ * +across     USB down
+ * +through    TH down
+ *
+ * And, with the board aligned to have positive accel for the relevant axis,
+ * looking down from above we have:
+ *
+ * +roll       counter clockwise (nose up)
+ * +pitch      counter clockwise (USB down)
+ * +yaw                counter clockwise (TH down)
  */
 
 /*