get target
Dependencies: MBed_Adafruit-GPS-Library VNH5019 mbed
Diff: main.cpp
- Revision:
- 2:7f48771d8c52
- Parent:
- 1:eb812097900f
--- a/main.cpp Sat Jul 23 10:46:02 2016 +0000 +++ b/main.cpp Wed Jul 27 11:12:36 2016 +0000 @@ -146,7 +146,7 @@ } // back (5 seconds) -> forward (10 seconds) -void stack_action(int speed) +void stuck_action(int speed) { Timer back_Timer; @@ -194,14 +194,14 @@ const int GPS_Time = 1000; Timer action_Timer; const int action_time = 500; - Timer stack_Timer; - const int stack_time = 5000; + Timer stuck_Timer; + const int stuck_time = 5000; xbee.printf("start\n"); GPS_Timer.start(); action_Timer.start(); - stack_Timer.start(); + stuck_Timer.start(); while(true) { @@ -265,17 +265,17 @@ xbee.printf("***STOP***\n"); } - // stack check + // stuck check if(!(d-0.15 <= distance && distance <= d+0.15)) { if(compass != robot_compass()) { - stack_Timer.reset(); + stuck_Timer.reset(); } } - // stack - if(stack_Timer.read_ms() >= stack_time) { - if(state == 1)stack_action(speed); - stack_Timer.reset(); + // stuck + if(stuck_Timer.read_ms() >= stuck_time) { + if(state == 1)stuck_action(speed); + stuck_Timer.reset(); } } return 0;