Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Micromouse_beta by
CheckWalls.cpp@2:592f01278db4, 2018-04-04 (annotated)
- Committer:
- ruesipat
- Date:
- Wed Apr 04 15:24:28 2018 +0000
- Revision:
- 2:592f01278db4
- Parent:
- 1:d9e840c48b1e
p
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 | 2:592f01278db4 | 6 | const float CheckWalls::WALL_DISTANCE = 100.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 | } |