Pathfinding nach rechts funktioniert noch nicht...der rest schon
Dependencies: mbed
Fork of MicroMouse_MASTER_THREE by
Diff: CheckWalls.cpp
- Revision:
- 1:d9e840c48b1e
- Child:
- 2:592f01278db4
diff -r a9fe4ef404bf -r d9e840c48b1e CheckWalls.cpp --- /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 + } +}