![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Version12.04.18
Fork of Micromouse_beta by
CheckWalls.cpp@1:d9e840c48b1e, 2018-03-31 (annotated)
- Committer:
- ruesipat
- Date:
- Sat Mar 31 16:45:57 2018 +0000
- Revision:
- 1:d9e840c48b1e
- Child:
- 2:592f01278db4
j
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ruesipat | 1:d9e840c48b1e | 1 | #include <cmath> |
ruesipat | 1:d9e840c48b1e | 2 | #include "CheckWalls.h" |
ruesipat | 1:d9e840c48b1e | 3 | |
ruesipat | 1:d9e840c48b1e | 4 | using namespace std; |
ruesipat | 1:d9e840c48b1e | 5 | |
ruesipat | 1:d9e840c48b1e | 6 | const float CheckWalls::WALL_DISTANCE = 20.0f; |
ruesipat | 1:d9e840c48b1e | 7 | |
ruesipat | 1:d9e840c48b1e | 8 | CheckWalls::CheckWalls(float distanceRight, float distanceFront, float distanceLeftFront, int& wallRight, int& wallFront, int& wallLeft): |
ruesipat | 1:d9e840c48b1e | 9 | wallRight(wallRight), |
ruesipat | 1:d9e840c48b1e | 10 | wallFront(wallFront), |
ruesipat | 1:d9e840c48b1e | 11 | wallLeft(wallLeft) |
ruesipat | 1:d9e840c48b1e | 12 | { |
ruesipat | 1:d9e840c48b1e | 13 | this->distanceRight = distanceRight; |
ruesipat | 1:d9e840c48b1e | 14 | this->distanceFront = distanceFront; |
ruesipat | 1:d9e840c48b1e | 15 | this->distanceLeftFront = distanceLeftFront; |
ruesipat | 1:d9e840c48b1e | 16 | } |
ruesipat | 1:d9e840c48b1e | 17 | |
ruesipat | 1:d9e840c48b1e | 18 | |
ruesipat | 1:d9e840c48b1e | 19 | CheckWalls::~CheckWalls() {} |
ruesipat | 1:d9e840c48b1e | 20 | |
ruesipat | 1:d9e840c48b1e | 21 | |
ruesipat | 1:d9e840c48b1e | 22 | void CheckWalls::check(){ |
ruesipat | 1:d9e840c48b1e | 23 | |
ruesipat | 1:d9e840c48b1e | 24 | if (distanceRight < WALL_DISTANCE){ //Abstand zur RECHTEN WAND |
ruesipat | 1:d9e840c48b1e | 25 | wallRight = 1; //Wand |
ruesipat | 1:d9e840c48b1e | 26 | }else{ |
ruesipat | 1:d9e840c48b1e | 27 | wallRight = 0; //keine Wand |
ruesipat | 1:d9e840c48b1e | 28 | } |
ruesipat | 1:d9e840c48b1e | 29 | |
ruesipat | 1:d9e840c48b1e | 30 | if (distanceFront < WALL_DISTANCE){ //Abstand zur WAND VORNE |
ruesipat | 1:d9e840c48b1e | 31 | wallFront = 1; //Wand |
ruesipat | 1:d9e840c48b1e | 32 | }else{ |
ruesipat | 1:d9e840c48b1e | 33 | wallFront = 0; //Keine Wand |
ruesipat | 1:d9e840c48b1e | 34 | } |
ruesipat | 1:d9e840c48b1e | 35 | |
ruesipat | 1:d9e840c48b1e | 36 | if (distanceLeftFront < WALL_DISTANCE){ //Anbstand zur LINKEN WAND |
ruesipat | 1:d9e840c48b1e | 37 | wallLeft = 1; //Wand |
ruesipat | 1:d9e840c48b1e | 38 | }else{ |
ruesipat | 1:d9e840c48b1e | 39 | wallLeft = 0; //keine Wand |
ruesipat | 1:d9e840c48b1e | 40 | } |
ruesipat | 1:d9e840c48b1e | 41 | } |