NXPCUP-libary
Library for car's control board on NXPCUP competition based on the Mbed framework.
Classes | Public Types | List of all members
nxpcup::ObstacleDetector Class Reference

#include <ObstacleDetector.h>

Classes

struct  Config
 

Public Types

enum  AvoidingObstacle { AvoidingObstacle::no, AvoidingObstacle::onRightSide, AvoidingObstacle::onLeftSide }
 
 ObstacleDetector (Config &config)
 
int error (float encoderDistance, int borderDetectorError, int leftBorder, int rightBorder)
 
int leftSensorValue () const
 
int rightSensorValue () const
 
AvoidingObstacle avoidingObstacle () const
 
int avoidingObstacleInteger () const
 
Config config () const
 
void setConfig (Config &config)
 
void reset ()
 

Member Enumeration Documentation

Enumerator
no 
onRightSide 
onLeftSide 

Constructor & Destructor Documentation

nxpcup::ObstacleDetector::ObstacleDetector ( Config config)
inline

Constructor of class ObstacleDetector.

Parameters
configstructConfig}

Member Function Documentation

AvoidingObstacle nxpcup::ObstacleDetector::avoidingObstacle ( ) const
inline

Get actual state of obstacle avoiding.

Returns
AvoidingObstacle}
int nxpcup::ObstacleDetector::avoidingObstacleInteger ( ) const
inline

Get actual state of obstacle in integer value.

Returns
transformedAvoidingObstacle}: -1 = left, 1 = right, 0 = nothing
Config nxpcup::ObstacleDetector::config ( ) const
inline

Get the actual configuration of theObstacleDetector}.

int nxpcup::ObstacleDetector::error ( float  encoderDistance,
int  borderDetectorError,
int  leftBorder,
int  rightBorder 
)
inline

Check the error on sensors and modify the trajectory if find obstacle.

Parameters
encoderDistancedistance from one encoder
borderDetectorErrorerror from border detector
leftBorderpositon of left border from border detector
rightBorderpositon of right border from border detector
int nxpcup::ObstacleDetector::leftSensorValue ( ) const
inline

Get the last measured value from left sensor.

Returns
measured distance without unit
void nxpcup::ObstacleDetector::reset ( )
inline

Reset this detector to initial state.

int nxpcup::ObstacleDetector::rightSensorValue ( ) const
inline

Get the last measured value from right sensor.

Returns
measured distance without unit
void nxpcup::ObstacleDetector::setConfig ( Config config)
inline

Set new configuration forObstacleDetector}.

Parameters
configstructConfig}

The documentation for this class was generated from the following file: