Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
RobotTracker Class Reference

A class to locate robots. More...

#include <robots.h>

Public Member Functions

 RobotTracker ()
 Constructor. More...
 
 ~RobotTracker ()
 Deconstructor. More...
 
bool load_robots_conf (string filename)
 Load a robot configuration file. More...
 
bool processNewFrame (Mat image)
 Search the image for robots and store robot positions. More...
 
void getListOfRobots ()
 Return a list of all robots. More...
 
void draw_robots (Mat &image)
 Draw robots into a image. More...
 
void setDebug (int level)
 Set the debug level. More...
 
string toString ()
 Returns a list of all robots as string. More...
 
bool fromString (string robots_str)
 Load robots from string. More...
 
void setLabyrinthPos (vector< Point > labyrinth_pos)
 Set the labyrinth position. More...
 
void setLabyrinthPos (vector< Point > labyrinth_pos, Mat image)
 Set the labyrinth position. More...
 
bool setRobotNames (vector< String > names, vector< float > ratios, float max_diff)
 
String ratio2name (float ratio, int debuglevel)
 Find the corresponding robot name from a list of robots and ratios. More...
 
void setFastMode (bool state)
 Set the fast mode. More...
 

Public Attributes

list< robot_trobots
 A list of all robots. More...
 

Private Member Functions

void update_center_points ()
 Calculate center points for each field and store pixel positions. More...
 

Private Attributes

Scalar redmin1
 Color thresholds. More...
 
Scalar redmax1
 
Scalar redmin2
 
Scalar redmax2
 
Scalar greenmin
 
Scalar greenmax
 
Scalar yellowmin
 
Scalar yellowmax
 
Scalar bluemin
 
Scalar bluemax
 
Scalar whitemin
 
Scalar whitemax
 
int debuglevel
 Show corresponding debug information. More...
 
long long frameNum
 Frame counter. More...
 
int field_width_px
 Field width in pixels. More...
 
vector< Point > rob_labyrinth_pos
 Labyrinth position (used to calculate robot positions) More...
 
Mat labyrinth_image
 Clean image of the labyrinth at normal exposure time. More...
 
bool have_labyrinth_image
 We have a clean image of the labyrinth at normal exposure time. More...
 
Point center_points [8][8]
 Stores the center points of each field. More...
 
bool labyrinth_pos_ready
 Is the labyrinth position already known. More...
 
vector< String > robot_names
 
vector< float > robot_ratios
 
float max_ratio_diff
 
bool fastmode
 Skip not really necessary operations to get a higher FPS. More...
 

Detailed Description

A class to locate robots.

Definition at line 125 of file robots.h.

Constructor & Destructor Documentation

RobotTracker::RobotTracker ( )

Constructor.

Initialization.

RobotTracker::~RobotTracker ( )

Deconstructor.

Free memory.

Member Function Documentation

void RobotTracker::draw_robots ( Mat &  image)

Draw robots into a image.

Parameters
imageImage to draw the robots into.
bool RobotTracker::fromString ( string  robots_str)

Load robots from string.

Parameters
robots_strString that contains robots
void RobotTracker::getListOfRobots ( )

Return a list of all robots.

bool RobotTracker::load_robots_conf ( string  filename)

Load a robot configuration file.

Parameters
filenameRelative path
bool RobotTracker::processNewFrame ( Mat  image)

Search the image for robots and store robot positions.

Returns
true, if nothing went wrong
String RobotTracker::ratio2name ( float  ratio,
int  debuglevel 
)

Find the corresponding robot name from a list of robots and ratios.

Parameters
ratioRatio of the distance from the blue LED to the white LED and the distance from the red LED to the white LED
debuglevelShow corresponding debug information
Returns
Name of the robot
void RobotTracker::setDebug ( int  level)

Set the debug level.

Parameters
levelNew value for the debug level
void RobotTracker::setFastMode ( bool  state)

Set the fast mode.

Parameters
stateIf true: skip not really necessary operations to get higher FPS
void RobotTracker::setLabyrinthPos ( vector< Point >  labyrinth_pos)

Set the labyrinth position.

Parameters
labyrinth_posLabyrinth position
void RobotTracker::setLabyrinthPos ( vector< Point >  labyrinth_pos,
Mat  image 
)

Set the labyrinth position.

Parameters
labyrinth_posLabyrinth position
imageA image of the labyrinth at normal exposure time.
string RobotTracker::toString ( )

Returns a list of all robots as string.

Returns
String with robots
void RobotTracker::update_center_points ( )
private

Calculate center points for each field and store pixel positions.

Member Data Documentation

Point RobotTracker::center_points[8][8]
private

Stores the center points of each field.

Definition at line 152 of file robots.h.

int RobotTracker::debuglevel
private

Show corresponding debug information.

Definition at line 134 of file robots.h.

bool RobotTracker::fastmode
private

Skip not really necessary operations to get a higher FPS.

Definition at line 165 of file robots.h.

int RobotTracker::field_width_px
private

Field width in pixels.

Definition at line 140 of file robots.h.

long long RobotTracker::frameNum
private

Frame counter.

Definition at line 137 of file robots.h.

bool RobotTracker::have_labyrinth_image
private

We have a clean image of the labyrinth at normal exposure time.

Definition at line 149 of file robots.h.

Mat RobotTracker::labyrinth_image
private

Clean image of the labyrinth at normal exposure time.

Definition at line 146 of file robots.h.

bool RobotTracker::labyrinth_pos_ready
private

Is the labyrinth position already known.

Definition at line 155 of file robots.h.

Scalar RobotTracker::redmin1
private

Color thresholds.

Definition at line 130 of file robots.h.

vector<Point> RobotTracker::rob_labyrinth_pos
private

Labyrinth position (used to calculate robot positions)

Definition at line 143 of file robots.h.

list< robot_t> RobotTracker::robots

A list of all robots.

Definition at line 170 of file robots.h.


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