most functionality to splashdwon, find neutral and start mission. short timeouts still in code for testing, will adjust to go directly to sit_idle after splashdown
Dependencies: mbed MODSERIAL FATFileSystem
Diff: main.cpp
- Revision:
- 12:a0519d11d2b6
- Parent:
- 11:3b241ecb75ed
- Child:
- 13:84fcbe1dcd62
diff -r 3b241ecb75ed -r a0519d11d2b6 main.cpp --- a/main.cpp Fri Oct 27 00:37:32 2017 +0000 +++ b/main.cpp Mon Oct 30 19:46:38 2017 +0000 @@ -101,11 +101,11 @@ // set up the linear actuators. adc has to be running first. bce().init(); bce().start(); - bce().setPosition_mm(bce().getPosition_mm()); // start by not moving + bce().pause(); // start by not moving batt().init(); batt().start(); - batt().setPosition_mm(batt().getPosition_mm()); // start by not moving + batt().pause(); // start by not moving // set up the depth and pitch outer loop controllers depthLoop().init(); @@ -401,7 +401,7 @@ pc().printf(" L to float level\r\n"); pc().printf(" B to float at broadcast pitch\r\n"); pc().printf(" E to initiate emergency climb\r\n"); - //pc().printf(" H to run homing sequence on both BCE and Batt\r\n"); + pc().printf(" H to run homing sequence on both BCE and Batt\r\n"); pc().printf("Q/W to decrease/increase pitch setpoint: %3.1f\r\n",pitchLoop().getCommand()); pc().printf("A/S to decrease/increase depth setpoint: %3.1f\r\n",depthLoop().getCommand()); pc().printf("+/- to decrease/increase timeout: %d s\r\n",timeout); @@ -444,12 +444,12 @@ else if (userInput == 'E' or userInput == 'e') { return EMERGENCY_CLIMB; } -// else if (userInput == 'H' or userInput == 'h') { -// pc().printf("running homing procedure\r\n"); -// bce().start(); bce().homePiston(); bce().stop(); -// batt().start(); batt().homePiston(); batt().stop(); -// return SIT_IDLE; -// } + else if (userInput == 'H' or userInput == 'h') { + pc().printf("running homing procedure\r\n"); + bce().unpause(); bce().homePiston(); bce().pause(); + batt().unpause(); batt().homePiston(); batt().pause(); + return SIT_IDLE; + } else if (userInput == '?') { pc().printf("\n\n\n>>> Resetting MBED <<<\n\n\n"); wait(0.5); @@ -533,10 +533,10 @@ isTimeoutRunning = true; // what is active? - bce().stop(); - batt().stop(); - depthLoop().stop(); - pitchLoop().stop(); + bce().pause(); + batt().pause(); +// depthLoop().stop(); +// pitchLoop().stop(); } // how exit? if (pc().readable()) { @@ -565,8 +565,8 @@ isTimeoutRunning = true; // what needs to be started? - bce().start(); - batt().start(); + bce().unpause(); + batt().unpause(); // what is active? bce().setPosition_mm(bce().getTravelLimit()); @@ -596,10 +596,10 @@ isTimeoutRunning = true; // what needs to be started? - bce().start(); - batt().start(); - depthLoop().start(); - pitchLoop().start(); + bce().unpause(); + batt().unpause(); + // depthLoop().start(); + // pitchLoop().start(); // what is active? depthLoop().setCommand(depthCommand); @@ -633,10 +633,10 @@ isTimeoutRunning = true; // what needs to be started? - bce().start(); - batt().start(); - depthLoop().start(); - pitchLoop().start(); + bce().unpause(); + batt().unpause(); +// depthLoop().start(); +// pitchLoop().start(); // what are the commands? depthLoop().setCommand(depthCommand); @@ -672,10 +672,10 @@ isTimeoutRunning = true; // what needs to be started? - bce().start(); - batt().start(); - depthLoop().start(); - pitchLoop().start(); + bce().unpause(); + batt().unpause(); + // depthLoop().start(); + // pitchLoop().start(); // what are the commands? depthLoop().setCommand(0.0); @@ -711,9 +711,9 @@ isTimeoutRunning = true; // what needs to be started? - bce().start(); - batt().start(); - pitchLoop().start(); + bce().unpause(); + batt().unpause(); + // pitchLoop().start(); // what are the commands bce().setPosition_mm(bceFloatPosition); @@ -746,8 +746,8 @@ isTimeoutRunning = true; // what needs to be started? - bce().start(); - batt().start(); + bce().unpause(); + batt().unpause(); // what are the commands? bce().setPosition_mm(bceFloatPosition);