Tobis Programm forked to not destroy your golden files

Dependencies:   mbed

Fork of Robocode by PES 2 - Gruppe 1

Revision:
77:ff87a10c4baf
Parent:
76:bdbdd64cdd80
Child:
79:50f8d58f79ab
Child:
81:956f65714207
diff -r bdbdd64cdd80 -r ff87a10c4baf source/Movement.cpp
--- a/source/Movement.cpp	Tue Apr 25 08:02:22 2017 +0000
+++ b/source/Movement.cpp	Tue Apr 25 08:12:31 2017 +0000
@@ -14,6 +14,8 @@
 bool first_search_cycle = true;                                                 // flag for state first time in function "move in search for brick" 
 bool brick_found = false;                                                       // flag for saving whether a brick was found or not
 bool movement_to_brick_finished = false;                                        // flag for saving whether movement to brick is finished or not
+float restdeg = 0;
+
 
 int moving()
 {
@@ -123,15 +125,15 @@
     // Init State turn for 60 degrees CW
     if(first_search_cycle==true){
         first_search_cycle=false;                                               // delet flag for initial condition
-        float restdeg=turn_for_deg(60);                                         // call function and start turning
+        restdeg=turn_for_deg(60);                                         // call function and start turning
     }
     
     // Search for Brick and evaluation
     float upper = getDistanceIR(4);                                             // get distance from upper Center Sensor            CHECK SENSORNUMBERS NOT SURE
     float lower = getDistanceIR(6);                                             // get distance from Lower Center Sensor
     
-    if((lower<800.0)&&(lower>100)){                                             // if something is in the range of 10 to 80cm at the lower Sensor
-        if((upper>800.0)&&(upper<100)){                                         // and nothing is detected with the upper Sensor
+    if((lower<800.0f)&&(lower>100.0f)){                                             // if something is in the range of 10 to 80cm at the lower Sensor
+        if((upper>800.0f)&&(upper<100.0f)){                                         // and nothing is detected with the upper Sensor
             brick_found = true;                                                   
         }
     }
@@ -139,7 +141,7 @@
     {
         brick_found = false;
         
-        if(restdeg>1)||(restdeg<-1){                                             // continue turning until restdegree nearly 0                                     
+        if((restdeg>1)||(restdeg<-1)){                                             // continue turning until restdegree nearly 0                                     
             turn_for_deg(restdeg);
         }
         else                                                                    // if restdegree nearly 0 and nothing found => turn in other direction
@@ -151,8 +153,8 @@
 
     if(brick_found==true){
         turn_for_deg(0);                                                        // stop turning
-        first_search_cyle=true;                                                 // set flag to start turning once again respectivly to get in Initialstate
-        lower=getDistaceIR(6);                                                  // Measure distance to Brick for Movement
+        first_search_cycle=true;                                                 // set flag to start turning once again respectivly to get in Initialstate
+        lower=getDistanceIR(6);                                                  // Measure distance to Brick for Movement
         distance_to_Brick = lower-OFFSET_GREIFER_TO_IRSENSOR;                   // calculate
         move_forward_for_distance(distance_to_Brick);                           // Move to Brick                                     ATTENTION FUNCTION NOT IMPLEMENTED YET
         arm_position_grabbing();                                                // Call Aeschlimans function                         MOVE A LITTLE AFTER GREIFER ON FLOOR IN AESCHLIMANS FUNCTION?