summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2013-10-25 04:34:16 -0700
committerKeith Packard <keithp@keithp.com>2013-10-25 04:34:16 -0700
commit351d53836e201834a2d89773a08ab7c2dab2b2f4 (patch)
tree599b180bc18e690496091dd335d8fa7731400b86 /src/test
parent08143a922fe27bc50a19924f46538f9476ab5fd1 (diff)
altos: Calibrate IMU accelerometers too
Average the IMU accelerometer values pointing up and down so that we have a zero-g offset for all three axes. This can then be used to compute which direction the rocket is pointing while sitting on the pad. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ao_flight_test.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/ao_flight_test.c b/src/test/ao_flight_test.c
index e2f63e34..7f18c80e 100644
--- a/src/test/ao_flight_test.c
+++ b/src/test/ao_flight_test.c
@@ -234,6 +234,9 @@ struct ao_config {
uint16_t apogee_lockout;
#if TELEMEGA
struct ao_pyro pyro[AO_PYRO_NUM]; /* minor version 12 */
+ int16_t accel_zero_along;
+ int16_t accel_zero_across;
+ int16_t accel_zero_through;
#endif
};
@@ -719,6 +722,13 @@ ao_sleep(void *wchan)
} else if (nword >= 6 && strcmp(words[0], "Accel") == 0) {
ao_config.accel_plus_g = atoi(words[3]);
ao_config.accel_minus_g = atoi(words[5]);
+#ifdef TELEMEGA
+ } else if (nword >= 8 && strcmp(words[0], "IMU") == 0) {
+ ao_config.accel_zero_along = atoi(words[3]);
+ ao_config.accel_zero_across = atoi(words[5]);
+ ao_config.accel_zero_through = atoi(words[7]);
+ printf ("%d %d %d\n", ao_config.accel_zero_along, ao_config.accel_zero_across, ao_config.accel_zero_through);
+#endif
} else if (nword >= 4 && strcmp(words[0], "Main") == 0) {
ao_config.main_deploy = atoi(words[2]);
} else if (nword >= 3 && strcmp(words[0], "Apogee") == 0 &&