Fawkes API  Fawkes Development Version
fawkes::NavGraphGenerator Class Referenceabstract

#include <>>

Inheritance diagram for fawkes::NavGraphGenerator:

Public Member Functions

 NavGraphGenerator ()
 Default constructor. More...
 
 NavGraphGenerator (std::map< std::string, std::string > params)
 Parametrized constructor. More...
 
virtual ~NavGraphGenerator ()
 Destructor. More...
 
virtual void compute (fawkes::LockPtr< fawkes::NavGraph > graph)=0
 
virtual void set_bounding_box (float bbox_p1_x, float bbox_p1_y, float bbox_p2_x, float bbox_p2_y)
 Set bounding box. More...
 
virtual void set_near_threshold (float near_threshold)
 Set distance threshold for considering nodes to be the same. More...
 
virtual void add_obstacle (float x, float y)
 Add an obstacle point. More...
 

Static Public Member Functions

static std::string genname (unsigned int &i)
 Generate a new name. More...
 

Protected Attributes

bool bbox_enabled_
 True if bounding box requested, false otherwise. More...
 
float bbox_p1_x_
 X part of P1 for bounding box. More...
 
float bbox_p1_y_
 Y part of P1 for bounding box. More...
 
float bbox_p2_x_
 X part of P2 for bounding box. More...
 
float bbox_p2_y_
 Y part of P2 for bounding box. More...
 
float near_threshold_
 distance threshold when to consider two nodes to be the same More...
 
std::list< std::pair< float, float > > obstacles_
 Obstacles to consider during navgraph generation. More...
 
std::map< std::string, std::string > params_
 Parameters specific to the actual generator in a generic format. More...
 

Detailed Description

Base class for navgraph generators. This class cannot be instantiated and used directly, rather it defines the general interface of specific generators.

To implementers of generators this provides some basic interface to define a bounding box, a near threshold, and to add obstacles. Note that these features may not be used by some generators. See the respective documentation.

If a bounding box is provided, it shall be defined befined on the ground plane in a right-handed coordinate system (the same in which all obstacles are defined) by two points P1 and P2. The point P1 shall be the "lower left" corner and P2 the "upper right" corner, i.e., P1 < P2, as in P1.x < P2.x and P1.y < P2.y.

Definition at line 35 of file generator.h.

Constructor & Destructor Documentation

◆ NavGraphGenerator() [1/2]

fawkes::NavGraphGenerator::NavGraphGenerator ( )

Default constructor.

Disabled bounding box, set near threshold to 1cm.

Definition at line 61 of file generator.cpp.

◆ NavGraphGenerator() [2/2]

fawkes::NavGraphGenerator::NavGraphGenerator ( std::map< std::string, std::string >  params)

Parametrized constructor.

Parameters
paramsparameters

Definition at line 74 of file generator.cpp.

◆ ~NavGraphGenerator()

fawkes::NavGraphGenerator::~NavGraphGenerator ( )
virtual

Destructor.

Definition at line 86 of file generator.cpp.

Member Function Documentation

◆ add_obstacle()

void fawkes::NavGraphGenerator::add_obstacle ( float  x,
float  y 
)
virtual

Add an obstacle point.

An obstacle point will be the representative for a Voronoi face in the newly generated graph.

Parameters
xX coordinate of point
yY coordinate of point

Definition at line 146 of file generator.cpp.

Referenced by NavGraphGeneratorThread::loop().

◆ compute()

void fawkes::NavGraphGenerator::compute ( fawkes::LockPtr< fawkes::NavGraph graph)
pure virtual

Compute graph.

Parameters
graphthe resulting nodes and edges will be added to this graph. The graph shall not be cleared automatically. The generator shall lock the graph as necessary.
Author
Tim Niemueller

Implemented in fawkes::NavGraphGeneratorGrid, and fawkes::NavGraphGeneratorVoronoi.

Referenced by NavGraphGeneratorThread::loop().

◆ genname()

std::string fawkes::NavGraphGenerator::genname ( unsigned int &  i)
static

Generate a new name.

Parameters
inumber parameter for point name, will be incremented by one
Returns
string with a new point name

Definition at line 95 of file generator.cpp.

Referenced by fawkes::NavGraphGeneratorVoronoi::compute().

◆ set_bounding_box()

void fawkes::NavGraphGenerator::set_bounding_box ( float  bbox_p1_x,
float  bbox_p1_y,
float  bbox_p2_x,
float  bbox_p2_y 
)
virtual

Set bounding box.

Setting a bounding box will cause compute() to ignore any edge with a vertex out of the given bounding box area.

Parameters
bbox_p1_xX coordinate of first (lower) bounding box point
bbox_p1_yy coordinate of first (lower) bounding box point
bbox_p2_xX coordinate of second (upper) bounding box point
bbox_p2_yy coordinate of second (upper) bounding box point

Definition at line 116 of file generator.cpp.

Referenced by NavGraphGeneratorThread::loop().

◆ set_near_threshold()

void fawkes::NavGraphGenerator::set_near_threshold ( float  near_threshold)
virtual

Set distance threshold for considering nodes to be the same.

Parameters
near_thresholddistance threshold for which to consider nodes to be the same if the distance is smaller than this threshold.

Definition at line 134 of file generator.cpp.

References obstacles_.

Member Data Documentation

◆ bbox_enabled_

bool fawkes::NavGraphGenerator::bbox_enabled_
protected

True if bounding box requested, false otherwise.

Definition at line 56 of file generator.h.

Referenced by fawkes::NavGraphGeneratorGrid::compute(), and fawkes::NavGraphGeneratorVoronoi::compute().

◆ bbox_p1_x_

float fawkes::NavGraphGenerator::bbox_p1_x_
protected

X part of P1 for bounding box.

Definition at line 57 of file generator.h.

Referenced by fawkes::NavGraphGeneratorGrid::compute(), and fawkes::NavGraphGeneratorVoronoi::compute().

◆ bbox_p1_y_

float fawkes::NavGraphGenerator::bbox_p1_y_
protected

Y part of P1 for bounding box.

Definition at line 58 of file generator.h.

Referenced by fawkes::NavGraphGeneratorGrid::compute(), and fawkes::NavGraphGeneratorVoronoi::compute().

◆ bbox_p2_x_

float fawkes::NavGraphGenerator::bbox_p2_x_
protected

X part of P2 for bounding box.

Definition at line 59 of file generator.h.

Referenced by fawkes::NavGraphGeneratorGrid::compute(), and fawkes::NavGraphGeneratorVoronoi::compute().

◆ bbox_p2_y_

float fawkes::NavGraphGenerator::bbox_p2_y_
protected

Y part of P2 for bounding box.

Definition at line 60 of file generator.h.

Referenced by fawkes::NavGraphGeneratorGrid::compute(), and fawkes::NavGraphGeneratorVoronoi::compute().

◆ near_threshold_

float fawkes::NavGraphGenerator::near_threshold_
protected

distance threshold when to consider two nodes to be the same

Definition at line 61 of file generator.h.

Referenced by fawkes::NavGraphGeneratorVoronoi::compute().

◆ obstacles_

std::list<std::pair<float, float> > fawkes::NavGraphGenerator::obstacles_
protected

Obstacles to consider during navgraph generation.

Definition at line 64 of file generator.h.

Referenced by fawkes::NavGraphGeneratorGrid::compute(), fawkes::NavGraphGeneratorVoronoi::compute(), and set_near_threshold().

◆ params_

std::map<std::string, std::string> fawkes::NavGraphGenerator::params_
protected

Parameters specific to the actual generator in a generic format.

Definition at line 66 of file generator.h.


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