Tobis Programm forked to not destroy your golden files

Dependencies:   mbed

Fork of Robocode by PES 2 - Gruppe 1

Revision:
131:0d6c072b23ca
Parent:
126:d0b2057272d0
--- 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();