READY TO RUMBLE

Dependencies:   mbed

Fork of Micromouse_alpha_copy_copy by PES2_R2D2.0

Revision:
1:d9e840c48b1e
Child:
2:592f01278db4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/CheckWalls.cpp	Sat Mar 31 16:45:57 2018 +0000
@@ -0,0 +1,41 @@
+#include <cmath>
+#include "CheckWalls.h"
+
+using namespace std;
+
+const float CheckWalls::WALL_DISTANCE = 20.0f;
+
+CheckWalls::CheckWalls(float distanceRight, float distanceFront, float distanceLeftFront, int& wallRight, int& wallFront, int& wallLeft):
+    wallRight(wallRight),
+    wallFront(wallFront),
+    wallLeft(wallLeft)    
+{
+    this->distanceRight = distanceRight;
+    this->distanceFront = distanceFront; 
+    this->distanceLeftFront = distanceLeftFront;
+}
+
+
+CheckWalls::~CheckWalls() {}
+
+
+void CheckWalls::check(){
+        
+        if (distanceRight < WALL_DISTANCE){ //Abstand zur RECHTEN WAND                        
+            wallRight = 1; //Wand
+        }else{                   
+            wallRight = 0; //keine Wand 
+        }     
+                
+        if (distanceFront < WALL_DISTANCE){ //Abstand zur WAND VORNE
+            wallFront = 1;  //Wand
+        }else{
+            wallFront = 0;  //Keine Wand
+        }
+                
+        if (distanceLeftFront < WALL_DISTANCE){ //Anbstand zur LINKEN WAND                        
+            wallLeft = 1;   //Wand
+        }else{               
+            wallLeft = 0;   //keine Wand 
+        }                    
+}