diff options
author | Keith Packard <keithp@keithp.com> | 2011-03-23 10:37:39 +0900 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2011-03-23 10:37:39 +0900 |
commit | 43a94380032300a2e33e1faa1efe93e858e0a2cf (patch) | |
tree | 090f4fe976de9807fd973f079d079eba38ee1b3e /src/ao_flight_test.c | |
parent | 32364c9e0d346e0e5d517e18d4e90b8ff2fa944f (diff) |
altos: Exit flight test at landing. Allow description in test flight list
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/ao_flight_test.c')
-rw-r--r-- | src/ao_flight_test.c | 77 |
1 files changed, 40 insertions, 37 deletions
diff --git a/src/ao_flight_test.c b/src/ao_flight_test.c index 51a5965c..91aa0f73 100644 --- a/src/ao_flight_test.c +++ b/src/ao_flight_test.c @@ -130,7 +130,7 @@ int ao_flight_debug; FILE *emulator_in; char *emulator_app; char *emulator_name; -double emulator_error_max = 10; +double emulator_error_max = 4; void ao_dump_state(void); @@ -190,6 +190,33 @@ 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) { double time; @@ -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; + + 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, @@ -219,44 +256,10 @@ ao_insert(void) 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 |