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

#include <ObstacleDetectorWithServo.h>

Classes

struct  Config
 

Public Types

enum  AvoidingObstacle { AvoidingObstacle::no, AvoidingObstacle::onRightSide, AvoidingObstacle::onLeftSide }
 
using ImageType = uint16_t
 
using ObstacleImage = Image< ImageType, Config::IMAGE_SIZE >
 
 ObstacleDetectorWithServo (Config config)
 
int servoAngle (int index)
 
int servoPositionDegree () const
 
int sensorValue () const
 
int error (float encoderDistance, int borderDetectorError, int leftBorder, int rightBorder)
 
AvoidingObstacle avoidingObstacle () const
 
int avoidingObstacleInteger () const
 
int distanceThatTriggered () const
 
Config config () const
 
void setConfig (Config &config)
 
void reset ()
 

Member Typedef Documentation

Member Enumeration Documentation

Enumerator
no 
onRightSide 
onLeftSide 

Constructor & Destructor Documentation

nxpcup::ObstacleDetectorWithServo::ObstacleDetectorWithServo ( Config  config)
inline

Constructor of class ObstacleDetectorWithServo.

Parameters
configstructConfig}

Member Function Documentation

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

Get actual state of obstacle avoiding.

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

Get actual state of obstacle in integer value.

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

Get the actual configuration of theObstacleDetectorWithServo}.

int nxpcup::ObstacleDetectorWithServo::distanceThatTriggered ( ) const
inline

Get the distance that trigger the detector.

Returns
value without unit
int nxpcup::ObstacleDetectorWithServo::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
void nxpcup::ObstacleDetectorWithServo::reset ( )
inline

Reset this detector to initial state.

int nxpcup::ObstacleDetectorWithServo::sensorValue ( ) const
inline

Get current value from sensor (withnout unit).

int nxpcup::ObstacleDetectorWithServo::servoAngle ( int  index)
inline

Get the angle of servo for given index.

Parameters
indexof the position (the range is define byConfig::IMAGE_SIZE})
Returns
angle for the index
int nxpcup::ObstacleDetectorWithServo::servoPositionDegree ( ) const
inline

Get current servo position in degree.

void nxpcup::ObstacleDetectorWithServo::setConfig ( Config config)
inline

Set new configuration forObstacleDetectorWithServo}.

Parameters
configstructConfig}

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