Pathfinding nach rechts funktioniert noch nicht...der rest schon

Dependencies:   mbed

Fork of MicroMouse_MASTER_THREE by PES2_R2D2.0

CheckWalls.cpp

Committer:
ruesipat
Date:
2018-05-16
Revision:
9:ab19796bf14a
Parent:
5:b8b1a979b0d5

File content as of revision 9:ab19796bf14a:

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

using namespace std;

const float CheckWalls::WALL_DISTANCE = 100.0f;

CheckWalls::CheckWalls(IRSensor& irSensor0, IRSensor& irSensor1, IRSensor& irSensor2, int& wallRight, int& wallFront, int& wallLeft):
    irSensor0(irSensor0),
    irSensor1(irSensor1),
    irSensor2(irSensor2),
    wallRight(wallRight),
    wallFront(wallFront),
    wallLeft(wallLeft)
 
{

}

CheckWalls::~CheckWalls() {}

void CheckWalls::check(){
        
        if (irSensor0.read() < WALL_DISTANCE){ //Abstand zur RECHTEN WAND                        
            wallRight = 1; //Wand
        }else{                   
            wallRight = 0; //keine Wand 
        }     
                
        if (irSensor1.read() < WALL_DISTANCE){ //Abstand zur WAND VORNE
            wallFront = 1;  //Wand
        }else{
            wallFront = 0;  //Keine Wand
        }
                
        if (irSensor2.read() < WALL_DISTANCE){ //Anbstand zur LINKEN WAND                        
            wallLeft = 1;   //Wand
        }else{               
            wallLeft = 0;   //keine Wand 
        }                    
}