Version12.04.18

Dependencies:   mbed

Fork of Micromouse_alpha_copy_copy by Patrick Ruesi

CheckWalls.cpp

Committer:
ruesipat
Date:
2018-04-12
Revision:
4:e3f388933954
Parent:
2:592f01278db4

File content as of revision 4:e3f388933954:

#include <cmath>
#include "CheckWalls.h"

using namespace std;

const float CheckWalls::WALL_DISTANCE = 100.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 
        }                    
}