altos: Exit flight test at landing. Allow description in test flight list
authorKeith Packard <keithp@keithp.com>
Wed, 23 Mar 2011 01:37:39 +0000 (10:37 +0900)
committerKeith Packard <keithp@keithp.com>
Wed, 23 Mar 2011 01:37:39 +0000 (10:37 +0900)
Signed-off-by: Keith Packard <keithp@keithp.com>
src/ao_flight_test.c
src/test/run-one
src/test/run-tests

index 51a5965c9c3302d6d6d1b965868b149ed5df4023..91aa0f738064703eee090fd6f6b5398a6815ffff 100644 (file)
@@ -130,7 +130,7 @@ int ao_flight_debug;
 FILE *emulator_in;
 char *emulator_app;
 char *emulator_name;
 FILE *emulator_in;
 char *emulator_app;
 char *emulator_name;
-double emulator_error_max = 10;
+double emulator_error_max = 4;
 
 void
 ao_dump_state(void);
 
 void
 ao_dump_state(void);
@@ -189,6 +189,33 @@ static double      ao_test_max_height_time;
 static int     ao_test_main_height;
 static double  ao_test_main_height_time;
 
 static int     ao_test_main_height;
 static double  ao_test_main_height_time;
 
+void
+ao_test_exit(void)
+{
+       double  drogue_error;
+       double  main_error;
+
+       if (!ao_test_main_height_time) {
+               ao_test_main_height_time = ao_test_max_height_time;
+               ao_test_main_height = ao_test_max_height;
+       }
+       drogue_error = fabs(ao_test_max_height_time - drogue_time);
+       main_error = fabs(ao_test_main_height_time - main_time);
+       if (drogue_error > emulator_error_max || main_error > emulator_error_max) {
+               printf ("%s %s\n",
+                       emulator_app, emulator_name);
+               printf ("\tApogee error %g\n", drogue_error);
+               printf ("\tMain error %g\n", main_error);
+               printf ("\tActual: apogee: %d at %7.2f main: %d at %7.2f\n",
+                       ao_test_max_height, ao_test_max_height_time,
+                       ao_test_main_height, ao_test_main_height_time);
+               printf ("\tComputed: apogee: %d at %7.2f main: %d at %7.2f\n",
+                       drogue_height, drogue_time, main_height, main_time);
+               exit (1);
+       }
+       exit(0);
+}
+
 void
 ao_insert(void)
 {
 void
 ao_insert(void)
 {
@@ -207,6 +234,16 @@ ao_insert(void)
                        tick_offset += 65536;
                prev_tick = ao_adc_static.tick;
                time = (double) (ao_adc_static.tick + tick_offset) / 100;
                        tick_offset += 65536;
                prev_tick = ao_adc_static.tick;
                time = (double) (ao_adc_static.tick + tick_offset) / 100;
+
+               if (ao_test_max_height < height) {
+                       ao_test_max_height = height;
+                       ao_test_max_height_time = time;
+               }
+               if (height > ao_config.main_deploy) {
+                       ao_test_main_height_time = time;
+                       ao_test_main_height = height;
+               }
+
                if (!ao_summary) {
                        printf("%7.2f height %g accel %g state %s k_height %g k_speed %g k_accel %g drogue %d main %d error %d\n",
                               time,
                if (!ao_summary) {
                        printf("%7.2f height %g accel %g state %s k_height %g k_speed %g k_accel %g drogue %d main %d error %d\n",
                               time,
@@ -219,44 +256,10 @@ ao_insert(void)
                               drogue_height,
                               main_height,
                               ao_error_h_sq_avg);
                               drogue_height,
                               main_height,
                               ao_error_h_sq_avg);
+                       if (ao_flight_state == ao_flight_landed)
+                               ao_test_exit();
                }
                }
-
-               if (ao_test_max_height < height) {
-                       ao_test_max_height = height;
-                       ao_test_max_height_time = time;
-               }
-               if (height > ao_config.main_deploy) {
-                       ao_test_main_height_time = time;
-                       ao_test_main_height = height;
-               }
-       }
-}
-
-void
-ao_test_exit(void)
-{
-       double  drogue_error;
-       double  main_error;
-
-       if (!ao_test_main_height_time) {
-               ao_test_main_height_time = ao_test_max_height_time;
-               ao_test_main_height = ao_test_max_height;
-       }
-       drogue_error = fabs(ao_test_max_height_time - drogue_time);
-       main_error = fabs(ao_test_main_height_time - main_time);
-       if (drogue_error > emulator_error_max || main_error > emulator_error_max) {
-               printf ("%s %s\n",
-                       emulator_app, emulator_name);
-               printf ("\tApogee error %g\n", drogue_error);
-               printf ("\tMain error %g\n", main_error);
-               printf ("\tActual: apogee: %d at %7.2f main: %d at %7.2f\n",
-                       ao_test_max_height, ao_test_max_height_time,
-                       ao_test_main_height, ao_test_main_height_time);
-               printf ("\tComputed: apogee: %d at %7.2f main: %d at %7.2f\n",
-                       drogue_height, drogue_time, main_height, main_time);
-               exit (1);
        }
        }
-       exit(0);
 }
 
 void
 }
 
 void
index d661abec40250ed5eb52d196a744e66aee9f50e3..7d0f95aeda7c032283ba0959849dcb8c0446f2c4 100755 (executable)
@@ -3,13 +3,14 @@
 for i in "$@"; do
 ./ao_flight_test "$i" > run-out.full
 ./ao_flight_test_baro "$i" > run-out.baro
 for i in "$@"; do
 ./ao_flight_test "$i" > run-out.full
 ./ao_flight_test_baro "$i" > run-out.baro
-#./ao_flight_test_accel "$i" > run-out.accel
 
 
+#./ao_flight_test_accel "$i" > run-out.accel
 #"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",\
 #"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",\
+#
 
 gnuplot << EOF
 set ylabel "altitude (m)"
 
 gnuplot << EOF
 set ylabel "altitude (m)"
index 11b4c95cd821ee6d9904ded30839a43539adf1bd..3e0cad3cfe6489d34bcba61247725feae13ba9c9 100755 (executable)
@@ -4,7 +4,7 @@ DIR=~/src/cc1111/flights
 
 bad_baro=0
 bad_full=0
 
 bad_baro=0
 bad_full=0
-while read flight; do
+while read flight description; do
     if ./ao_flight_test_baro -s $DIR/$flight; then
        :
     else
     if ./ao_flight_test_baro -s $DIR/$flight; then
        :
     else