summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2011-03-22 05:42:51 +0900
committerKeith Packard <keithp@keithp.com>2011-03-22 05:42:51 +0900
commit7b009b2efe3af8722c358c304c2243652594e0d5 (patch)
tree94e196faeaa24504b534d7ab0363a28489216b21 /src/test
parent20427ae4965f756aac0cedc5179a1c45b9a781f2 (diff)
altos: Switch telemetrum over to kalman filter
This changes the full telemetry stream to include kalman data instead of the old ad-hoc flight data. It's compatible in that the packet sizes are the same so teledongle can receive either and figure out which it has received. A few plotting and testing tools are added to make validating the new code easier. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/.gitignore1
-rw-r--r--src/test/Makefile13
-rwxr-xr-xsrc/test/plottest16
-rwxr-xr-xsrc/test/run-one32
-rw-r--r--src/test/test-flights1
5 files changed, 59 insertions, 4 deletions
diff --git a/src/test/.gitignore b/src/test/.gitignore
index 0a43de8a..33c7ef35 100644
--- a/src/test/.gitignore
+++ b/src/test/.gitignore
@@ -1,5 +1,6 @@
ao_flight_test
ao_flight_test_baro
+ao_flight_test_accel
ao_gps_test
ao_gps_test_skytraq
ao_convert_test
diff --git a/src/test/Makefile b/src/test/Makefile
index 853713fa..433f749b 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -1,6 +1,7 @@
vpath % ..
+vpath % ../kalman
-PROGS=ao_flight_test ao_flight_test_baro ao_gps_test ao_gps_test_skytraq ao_convert_test
+PROGS=ao_flight_test ao_flight_test_baro ao_flight_test_accel ao_gps_test ao_gps_test_skytraq ao_convert_test
CFLAGS=-I.. -I.
@@ -11,12 +12,15 @@ clean:
install:
-ao_flight_test: ao_flight_test.c ao_host.h ao_flight.c altitude.h
+ao_flight_test: ao_flight_test.c ao_host.h ao_flight.c altitude.h ao_kalman.h
cc -g -o $@ $<
-ao_flight_test_baro: ao_flight_test.c ao_host.h ao_flight.c altitude.h
+ao_flight_test_baro: ao_flight_test.c ao_host.h ao_flight.c altitude.h ao_kalman.h
cc -g -o $@ -DHAS_ACCEL=0 ../ao_flight_test.c
+ao_flight_test_accel: ao_flight_test.c ao_host.h ao_flight.c altitude.h ao_kalman.h
+ cc -g -o $@ -DFORCE_ACCEL=1 ../ao_flight_test.c
+
ao_gps_test: ao_gps_test.c ao_gps_sirf.c ao_gps_print.c ao_host.h
cc -g -o $@ $<
@@ -25,3 +29,6 @@ ao_gps_test_skytraq: ao_gps_test_skytraq.c ao_gps_skytraq.c ao_gps_print.c ao_ho
ao_convert_test: ao_convert_test.c ao_convert.c altitude.h
cc -g -o $@ $<
+
+../ao_kalman.h: make-kalman kalman.5c kalman_filter.5c load_csv.5c matrix.5c
+ sh $< > $@
diff --git a/src/test/plottest b/src/test/plottest
new file mode 100755
index 00000000..76af5ee7
--- /dev/null
+++ b/src/test/plottest
@@ -0,0 +1,16 @@
+gnuplot -persist << EOF
+set ylabel "altitude (m)"
+set y2label "velocity (m/s), acceleration(m/s²)"
+set xlabel "time (s)"
+set xtics border out nomirror
+set ytics border out nomirror
+set y2tics border out nomirror
+plot "$1" using 1:3 with lines axes x1y1 title "raw height",\
+"$1" using 1:5 with lines axes x1y2 title "raw accel",\
+"$1" using 1:9 with lines axes x1y1 title "height",\
+"$1" using 1:11 with lines axes x1y2 title "speed",\
+"$1" using 1:13 with lines axes x1y2 title "accel",\
+"$1" using 1:15 with lines axes x1y1 title "drogue",\
+"$1" using 1:17 with lines axes x1y1 title "main",\
+"$1" using 1:19 with lines axes x1y1 title "error"
+EOF
diff --git a/src/test/run-one b/src/test/run-one
new file mode 100755
index 00000000..f9d21576
--- /dev/null
+++ b/src/test/run-one
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+./ao_flight_test "$1" > run-out.full
+./ao_flight_test_baro "$1" > run-out.baro
+./ao_flight_test_accel "$1" > run-out.accel
+
+gnuplot -persist << EOF
+set ylabel "altitude (m)"
+set y2label "velocity (m/s), acceleration(m/s²)"
+set xlabel "time (s)"
+set xtics border out nomirror
+set ytics border out nomirror
+set y2tics border out nomirror
+set title "$1"
+plot "run-out.full" using 1:3 with lines lw 2 lt 1 axes x1y1 title "raw height",\
+"run-out.full" using 1:5 with lines lw 2 lt 1 axes x1y2 title "raw accel",\
+"run-out.full" using 1:9 with lines lt 2 axes x1y1 title "full height",\
+"run-out.full" using 1:11 with lines lt 2 axes x1y2 title "full speed",\
+"run-out.full" using 1:13 with lines lt 2 axes x1y2 title "full accel",\
+"run-out.full" using 1:15 with lines lt 2 axes x1y1 title "full drogue",\
+"run-out.full" using 1:17 with lines lt 2 axes x1y1 title "full main", \
+"run-out.baro" using 1:9 with lines lt 3 axes x1y1 title "baro height",\
+"run-out.baro" using 1:11 with lines lt 3 axes x1y2 title "baro speed",\
+"run-out.baro" using 1:13 with lines lt 3 axes x1y2 title "baro accel",\
+"run-out.baro" using 1:15 with lines lt 3 axes x1y1 title "baro drogue",\
+"run-out.baro" using 1:17 with lines lt 3 axes x1y1 title "baro main",\
+"run-out.accel" using 1:9 with lines lt 4 axes x1y1 title "accel height",\
+"run-out.accel" using 1:11 with lines lt 4 axes x1y2 title "accel speed",\
+"run-out.accel" using 1:13 with lines lt 4 axes x1y2 title "accel accel",\
+"run-out.accel" using 1:15 with lines lt 4 axes x1y1 title "accel drogue",\
+"run-out.accel" using 1:17 with lines lt 4 axes x1y1 title "accel main"
+EOF
diff --git a/src/test/test-flights b/src/test/test-flights
index a9a2ecca..afdaba5a 100644
--- a/src/test/test-flights
+++ b/src/test/test-flights
@@ -7,7 +7,6 @@
2009-07-18-serial-001-flight-007.eeprom
2009-08-22-serial-001-flight-001.eeprom
2009-08-22-serial-010-flight-001.eeprom
-2009-09-05-serial-008-flight-002.eeprom
2009-09-05-serial-010-flight-002.eeprom
2009-09-05-serial-011-flight-001.eeprom
2009-09-11-serial-008-flight-003.eeprom