![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Version12.04.18
Dependencies: mbed
Fork of Micromouse_alpha_copy_copy by
Diff: CheckWalls.cpp
- 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 + } +}