update with altimeter, swimfile.txt endleg.txt, etc see changes_13sep.txt also reset_PI()
Dependencies: mbed MODSERIAL FATFileSystem
changes_13sep2019.txt@104:426224a55f5f, 2019-09-13 (annotated)
- Committer:
- joel_ssc
- Date:
- Fri Sep 13 19:15:40 2019 +0000
- Revision:
- 104:426224a55f5f
- Parent:
- 103:45b554df05bd
slight change includes reset_PI
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joel_ssc | 102:0f430de62447 | 1 | # new version 13sep2019 |
joel_ssc | 102:0f430de62447 | 2 | has changes to implement altimeter blank_m - turned off and ignored |
joel_ssc | 102:0f430de62447 | 3 | and altim_abort_m distance to bottom that aborts dive |
joel_ssc | 102:0f430de62447 | 4 | present code takes TWO near approaches to end a leg. only one and it forces a rise, and starts counting. |
joel_ssc | 102:0f430de62447 | 5 | |
joel_ssc | 102:0f430de62447 | 6 | IMplement swimfile.txt reading in swim parameters. |
joel_ssc | 102:0f430de62447 | 7 | swimfile parameters: |
joel_ssc | 102:0f430de62447 | 8 | |
joel_ssc | 102:0f430de62447 | 9 | #the swim file parameters |
joel_ssc | 102:0f430de62447 | 10 | bce_dive_mm=10.1 |
joel_ssc | 102:0f430de62447 | 11 | bce_rise_mm=11.2 |
joel_ssc | 102:0f430de62447 | 12 | bmm_dive_mm=12.3 |
joel_ssc | 102:0f430de62447 | 13 | bmm_rise_mm=13.0 |
joel_ssc | 102:0f430de62447 | 14 | altimeter_blank_m=4.40 |
joel_ssc | 102:0f430de62447 | 15 | altimeter_abort_m=7.70 |
joel_ssc | 102:0f430de62447 | 16 | fn_timeout=405.0 |
joel_ssc | 102:0f430de62447 | 17 | max_mbed_runtime_hr=2.50 |
joel_ssc | 102:0f430de62447 | 18 | |
joel_ssc | 103:45b554df05bd | 19 | add aline |
joel_ssc | 103:45b554df05bd | 20 | |
joel_ssc | 102:0f430de62447 | 21 | implement writing out endleg_reason into endleg.txt file |
joel_ssc | 102:0f430de62447 | 22 | # EndLeg reason set here |
joel_ssc | 102:0f430de62447 | 23 | [values] |
joel_ssc | 102:0f430de62447 | 24 | endleg_reason=4 |
joel_ssc | 102:0f430de62447 | 25 | |
joel_ssc | 102:0f430de62447 | 26 | reasons:1 = normal timeout 2=yo_timeout 3= altim_abort 4=no_find_neutral |
joel_ssc | 102:0f430de62447 | 27 | 5=still inverted 6=yo_timeout+too slow 7=no_find_neutral+altim_abort |
joel_ssc | 102:0f430de62447 | 28 | 8=mbed_max_runtime_hr limit |
joel_ssc | 102:0f430de62447 | 29 | |
joel_ssc | 102:0f430de62447 | 30 | |
joel_ssc | 102:0f430de62447 | 31 | implement altimeter reading of altim.txt for slope and offset. |
joel_ssc | 102:0f430de62447 | 32 | altim.txt NOT named alt.txt. hated that name. |
joel_ssc | 102:0f430de62447 | 33 | |
joel_ssc | 102:0f430de62447 | 34 | # Linear regression parameters for altimeter |
joel_ssc | 102:0f430de62447 | 35 | |
joel_ssc | 102:0f430de62447 | 36 | slope=0.0371 |
joel_ssc | 102:0f430de62447 | 37 | intercept=-9.7413 |
joel_ssc | 102:0f430de62447 | 38 | |
joel_ssc | 102:0f430de62447 | 39 | Present code has not yet switched to really use max_mbed_runtime_hr yet. |
joel_ssc | 102:0f430de62447 | 40 | here is the code at line 539 of main.cpp |
joel_ssc | 102:0f430de62447 | 41 | |
joel_ssc | 102:0f430de62447 | 42 | CODE |
joel_ssc | 102:0f430de62447 | 43 | if(tNow == 90000) { // don't wait forever -remove this for real operations!! |
joel_ssc | 102:0f430de62447 | 44 | // if(tNow == 1000 * configFileIO().swimConstants.max_mbed_runtime_hr * 3600) { //replace with this real runtime |
joel_ssc | 102:0f430de62447 | 45 | keeprunning=0; |
joel_ssc | 102:0f430de62447 | 46 | .... |
joel_ssc | 102:0f430de62447 | 47 | CODE |
joel_ssc | 102:0f430de62447 | 48 | |
joel_ssc | 102:0f430de62447 | 49 | Typical block using altimeter info is in Statemachine() |
joel_ssc | 102:0f430de62447 | 50 | line 810 inStatemachine().cpp |
joel_ssc | 102:0f430de62447 | 51 | CODE exit from LEG_POSITION_DIVE logic |
joel_ssc | 102:0f430de62447 | 52 | else if( (depthLoop().getPosition() > configFileIO().swimConstants.altim_blank_m) // ending on altimieter abort - bad, endleg, etc |
joel_ssc | 102:0f430de62447 | 53 | && (fabs(imu().getRoll()) < 45) && (altimLoop().getPosition() < configFileIO().swimConstants.altim_abort_m)) { |
joel_ssc | 102:0f430de62447 | 54 | //just go to leg_position_rise unless it is the second time |
joel_ssc | 102:0f430de62447 | 55 | if(configFileIO().swimConstants.altim_abort_count >= 2) { // more than one altimeter abort |
joel_ssc | 102:0f430de62447 | 56 | _state = EMERGENCY_CLIMB; |
joel_ssc | 102:0f430de62447 | 57 | finish_leg =1; |
joel_ssc | 102:0f430de62447 | 58 | sprintf(buf, "LEG POS DIVE: ALTIMETER ABORT - more than one!: depth=%f altimeter=%f - go to emergency climb\n\n\r", |
joel_ssc | 102:0f430de62447 | 59 | depthLoop().getPosition(), altimLoop().getPosition() ); |
joel_ssc | 102:0f430de62447 | 60 | mbedLogger().appendDiagFile(buf,3); |
joel_ssc | 102:0f430de62447 | 61 | configFileIO().swimConstants.endleg_reason = 3; // altimeter abort |
joel_ssc | 102:0f430de62447 | 62 | _fsm_timer.reset(); |
joel_ssc | 102:0f430de62447 | 63 | _isTimeoutRunning = false; |
joel_ssc | 102:0f430de62447 | 64 | |
joel_ssc | 102:0f430de62447 | 65 | } |
joel_ssc | 102:0f430de62447 | 66 | // just go to leg_position_rise unless it is the second time |
joel_ssc | 102:0f430de62447 | 67 | if(configFileIO().swimConstants.altim_abort_count < 2) { |
joel_ssc | 102:0f430de62447 | 68 | _state = LEG_POSITION_RISE; |
joel_ssc | 102:0f430de62447 | 69 | _fsm_timer.reset(); |
joel_ssc | 102:0f430de62447 | 70 | printf(buf, "LEG POS DIVE: ALTIMETER ABORT first one: ONLY go to leg_postiion_rise -depth=%f altimeter=%f - go to emergency climb\n\n\r", |
joel_ssc | 102:0f430de62447 | 71 | depthLoop().getPosition(), altimLoop().getPosition() ); |
joel_ssc | 102:0f430de62447 | 72 | mbedLogger().appendDiagFile(buf,3); |
joel_ssc | 102:0f430de62447 | 73 | _isTimeoutRunning = false; |
joel_ssc | 102:0f430de62447 | 74 | configFileIO().swimConstants.altim_abort_count += 1; |
joel_ssc | 102:0f430de62447 | 75 | } |
joel_ssc | 102:0f430de62447 | 76 | } |
joel_ssc | 102:0f430de62447 | 77 | END CODE |
joel_ssc | 102:0f430de62447 | 78 | The test is: deeper than atimeter blanking depth? also NOT inverted (roll test) also altimeter measure is smaller than swimConstants.altim_abort_m |
joel_ssc | 102:0f430de62447 | 79 | the second time ; Emergency climb and end the leg |
joel_ssc | 102:0f430de62447 | 80 | |
joel_ssc | 102:0f430de62447 | 81 | the first time - just end the yo and start conunting approaches |
joel_ssc | 102:0f430de62447 | 82 | |
joel_ssc | 102:0f430de62447 | 83 | |
joel_ssc | 102:0f430de62447 | 84 | |
joel_ssc | 102:0f430de62447 | 85 | implement inverted.txt |
joel_ssc | 102:0f430de62447 | 86 | # Still Inverted after START_SWIM yo timeout timeout |
joel_ssc | 102:0f430de62447 | 87 | yo_time=45 |
joel_ssc | 102:0f430de62447 | 88 | inverted_roll_value=173.936401 |