
Tobis Programm forked to not destroy your golden files
Fork of Robocode by
Diff: source/Safety.cpp
- Revision:
- 131:0d6c072b23ca
- Parent:
- 126:d0b2057272d0
diff -r 670a954495bf -r 0d6c072b23ca source/Safety.cpp --- a/source/Safety.cpp Mon May 15 13:03:16 2017 +0000 +++ b/source/Safety.cpp Mon May 15 13:52:59 2017 +0000 @@ -3,9 +3,15 @@ #include "mbed.h" #include "Safety.h" -void safety(){ - +int safety(int state){ + if(getDistanceIR(2) < 0.05f && state != 50) { //state 50: grabbing state + stop_move(); + stop_turn(); + printf("Stopped moving to prevent colission!\r\n"); + return 11; } + return state; +} int emergency_shutdown(){ stop_move();