Main MRPT website > C++ reference
MRPT logo
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
mrpt::reactivenav::CParameterizedTrajectoryGenerator::CColisionGrid Class Reference

Detailed Description

An internal class for storing the collision grid.

Definition at line 188 of file CParameterizedTrajectoryGenerator.h.

#include <mrpt/reactivenav/CParameterizedTrajectoryGenerator.h>

Inheritance diagram for mrpt::reactivenav::CParameterizedTrajectoryGenerator::CColisionGrid:
Inheritance graph
[legend]

Public Member Functions

 CColisionGrid (float x_min, float x_max, float y_min, float y_max, float resolution, CParameterizedTrajectoryGenerator *parent)
 
virtual ~CColisionGrid ()
 
bool saveToFile (mrpt::utils::CStream *fil)
 Save to file, true = OK.
 
bool loadFromFile (mrpt::utils::CStream *fil)
 Load from file, true = OK.
 
const TCollisionCellgetTPObstacle (const float obsX, const float obsY) const
 For an obstacle (x,y), returns a vector with all the pairs (a,d) such as the robot collides.
 
void updateCellInfo (const unsigned int icx, const unsigned int icy, const uint16_t k, const float dist)
 Updates the info into a cell: It updates the cell only if the distance d for the path k is lower than the previous value:
 
void setSize (float x_min, float x_max, float y_min, float y_max, float resolution)
 Changes the size of the grid, ERASING all previous contents.
 
void clear ()
 Erase the contents of all the cells.
 
void fill (const TCollisionCell &value)
 Fills all the cells with the same value.
 
virtual void resize (float new_x_min, float new_x_max, float new_y_min, float new_y_max, const TCollisionCell &defaultValueNewCells, float additionalMarginMeters=2.0f)
 Changes the size of the grid, maintaining previous contents.
 
TCollisionCellcellByPos (float x, float y)
 Returns a pointer to the contents of a cell given by its coordinates, or NULL if it is out of the map extensions.
 
const TCollisionCellcellByPos (float x, float y) const
 Returns a pointer to the contents of a cell given by its coordinates, or NULL if it is out of the map extensions.
 
TCollisionCellcellByIndex (unsigned int cx, unsigned int cy)
 Returns a pointer to the contents of a cell given by its cell indexes, or NULL if it is out of the map extensions.
 
const TCollisionCellcellByIndex (unsigned int cx, unsigned int cy) const
 Returns a pointer to the contents of a cell given by its cell indexes, or NULL if it is out of the map extensions.
 
size_t getSizeX () const
 Returns the horizontal size of grid map in cells count.
 
size_t getSizeY () const
 Returns the vertical size of grid map in cells count.
 
float getXMin () const
 Returns the "x" coordinate of left side of grid map.
 
float getXMax () const
 Returns the "x" coordinate of right side of grid map.
 
float getYMin () const
 Returns the "y" coordinate of top side of grid map.
 
float getYMax () const
 Returns the "y" coordinate of bottom side of grid map.
 
float getResolution () const
 Returns the resolution of the grid map.
 
virtual float cell2float (const TCollisionCell &c) const
 The user must implement this in order to provide "saveToTextFile" a way to convert each cell into a numeric value.
 
void saveToTextFile (const std::string &fileName) const
 
int x2idx (float x) const
 Transform a coordinate values into cell indexes.
 
int x2idx (float x, float x_min) const
 Transform a coordinate value into a cell index, using a diferent "x_min" value.
 
int y2idx (float y) const
 
int y2idx (float y, float y_min) const
 
int xy2idx (float x, float y) const
 
void idx2cxcy (const int &idx, int &cx, int &cy) const
 Transform a global (linear) cell index value into its corresponding (x,y) cell indexes.
 
float idx2x (int cx) const
 Transform a cell index into a coordinate value.
 
float idx2y (int cy) const
 
void getAsMatrix (MAT &m) const
 Get the entire grid as a matrix.
 

Protected Member Functions

std::vector< TCollisionCell > & m_map_castaway_const () const
 Used only from logically const method that really need to modify the object.
 

Protected Attributes

std::vector< TCollisionCellm_map
 The cells.
 
float m_x_min
 
float m_x_max
 
float m_y_min
 
float m_y_max
 
float m_resolution
 
size_t m_size_x
 
size_t m_size_y
 

Private Attributes

CParameterizedTrajectoryGenerator
const * 
m_parent
 

Constructor & Destructor Documentation

mrpt::reactivenav::CParameterizedTrajectoryGenerator::CColisionGrid::CColisionGrid ( float  x_min,
float  x_max,
float  y_min,
float  y_max,
float  resolution,
CParameterizedTrajectoryGenerator parent 
)
inline

Definition at line 194 of file CParameterizedTrajectoryGenerator.h.

virtual mrpt::reactivenav::CParameterizedTrajectoryGenerator::CColisionGrid::~CColisionGrid ( )
inlinevirtual

Definition at line 199 of file CParameterizedTrajectoryGenerator.h.

Member Function Documentation

virtual float mrpt::utils::CDynamicGrid< TCollisionCell >::cell2float ( const TCollisionCell &  c) const
inlinevirtualinherited

The user must implement this in order to provide "saveToTextFile" a way to convert each cell into a numeric value.

Definition at line 281 of file CDynamicGrid.h.

TCollisionCell * mrpt::utils::CDynamicGrid< TCollisionCell >::cellByIndex ( unsigned int  cx,
unsigned int  cy 
)
inlineinherited

Returns a pointer to the contents of a cell given by its cell indexes, or NULL if it is out of the map extensions.

Definition at line 236 of file CDynamicGrid.h.

const TCollisionCell * mrpt::utils::CDynamicGrid< TCollisionCell >::cellByIndex ( unsigned int  cx,
unsigned int  cy 
) const
inlineinherited

Returns a pointer to the contents of a cell given by its cell indexes, or NULL if it is out of the map extensions.

Definition at line 245 of file CDynamicGrid.h.

TCollisionCell * mrpt::utils::CDynamicGrid< TCollisionCell >::cellByPos ( float  x,
float  y 
)
inlineinherited

Returns a pointer to the contents of a cell given by its coordinates, or NULL if it is out of the map extensions.

Definition at line 210 of file CDynamicGrid.h.

const TCollisionCell * mrpt::utils::CDynamicGrid< TCollisionCell >::cellByPos ( float  x,
float  y 
) const
inlineinherited

Returns a pointer to the contents of a cell given by its coordinates, or NULL if it is out of the map extensions.

Definition at line 223 of file CDynamicGrid.h.

void mrpt::utils::CDynamicGrid< TCollisionCell >::clear ( void  )
inlineinherited

Erase the contents of all the cells.

Definition at line 108 of file CDynamicGrid.h.

void mrpt::utils::CDynamicGrid< TCollisionCell >::fill ( const TCollisionCell &  value)
inlineinherited

Fills all the cells with the same value.

Definition at line 116 of file CDynamicGrid.h.

void mrpt::utils::CDynamicGrid< TCollisionCell >::getAsMatrix ( MAT &  m) const
inlineinherited

Get the entire grid as a matrix.

Template Parameters
MATThe type of the matrix, typically a CMatrixDouble.
Parameters
[out]mThe output matrix; will be set automatically to the correct size. Entry (cy,cx) in the matrix contains the grid cell with indices (cx,cy).
Note
This method will compile only for cell types that can be converted to the type of the matrix elements (e.g. double).

Definition at line 329 of file CDynamicGrid.h.

float mrpt::utils::CDynamicGrid< TCollisionCell >::getResolution ( ) const
inlineinherited

Returns the resolution of the grid map.

Definition at line 278 of file CDynamicGrid.h.

size_t mrpt::utils::CDynamicGrid< TCollisionCell >::getSizeX ( ) const
inlineinherited

Returns the horizontal size of grid map in cells count.

Definition at line 254 of file CDynamicGrid.h.

size_t mrpt::utils::CDynamicGrid< TCollisionCell >::getSizeY ( ) const
inlineinherited

Returns the vertical size of grid map in cells count.

Definition at line 258 of file CDynamicGrid.h.

const TCollisionCell& mrpt::reactivenav::CParameterizedTrajectoryGenerator::CColisionGrid::getTPObstacle ( const float  obsX,
const float  obsY 
) const

For an obstacle (x,y), returns a vector with all the pairs (a,d) such as the robot collides.

float mrpt::utils::CDynamicGrid< TCollisionCell >::getXMax ( ) const
inlineinherited

Returns the "x" coordinate of right side of grid map.

Definition at line 266 of file CDynamicGrid.h.

float mrpt::utils::CDynamicGrid< TCollisionCell >::getXMin ( ) const
inlineinherited

Returns the "x" coordinate of left side of grid map.

Definition at line 262 of file CDynamicGrid.h.

float mrpt::utils::CDynamicGrid< TCollisionCell >::getYMax ( ) const
inlineinherited

Returns the "y" coordinate of bottom side of grid map.

Definition at line 274 of file CDynamicGrid.h.

float mrpt::utils::CDynamicGrid< TCollisionCell >::getYMin ( ) const
inlineinherited

Returns the "y" coordinate of top side of grid map.

Definition at line 270 of file CDynamicGrid.h.

void mrpt::utils::CDynamicGrid< TCollisionCell >::idx2cxcy ( const int &  idx,
int &  cx,
int &  cy 
) const
inlineinherited

Transform a global (linear) cell index value into its corresponding (x,y) cell indexes.

Definition at line 306 of file CDynamicGrid.h.

float mrpt::utils::CDynamicGrid< TCollisionCell >::idx2x ( int  cx) const
inlineinherited

Transform a cell index into a coordinate value.

Definition at line 314 of file CDynamicGrid.h.

float mrpt::utils::CDynamicGrid< TCollisionCell >::idx2y ( int  cy) const
inlineinherited

Definition at line 315 of file CDynamicGrid.h.

bool mrpt::reactivenav::CParameterizedTrajectoryGenerator::CColisionGrid::loadFromFile ( mrpt::utils::CStream fil)

Load from file, true = OK.

std::vector<TCollisionCell >& mrpt::utils::CDynamicGrid< TCollisionCell >::m_map_castaway_const ( ) const
inlineprotectedinherited

Used only from logically const method that really need to modify the object.

Definition at line 52 of file CDynamicGrid.h.

virtual void mrpt::utils::CDynamicGrid< TCollisionCell >::resize ( float  new_x_min,
float  new_x_max,
float  new_y_min,
float  new_y_max,
const TCollisionCell &  defaultValueNewCells,
float  additionalMarginMeters = 2.0f 
)
inlinevirtualinherited

Changes the size of the grid, maintaining previous contents.

See Also
setSize

Definition at line 121 of file CDynamicGrid.h.

bool mrpt::reactivenav::CParameterizedTrajectoryGenerator::CColisionGrid::saveToFile ( mrpt::utils::CStream fil)

Save to file, true = OK.

void mrpt::utils::CDynamicGrid< TCollisionCell >::saveToTextFile ( const std::string &  fileName) const
inlineinherited

Definition at line 286 of file CDynamicGrid.h.

void mrpt::utils::CDynamicGrid< TCollisionCell >::setSize ( float  x_min,
float  x_max,
float  y_min,
float  y_max,
float  resolution 
)
inlineinherited

Changes the size of the grid, ERASING all previous contents.

See Also
resize

Definition at line 83 of file CDynamicGrid.h.

void mrpt::reactivenav::CParameterizedTrajectoryGenerator::CColisionGrid::updateCellInfo ( const unsigned int  icx,
const unsigned int  icy,
const uint16_t  k,
const float  dist 
)

Updates the info into a cell: It updates the cell only if the distance d for the path k is lower than the previous value:

Parameters
cellInfoThe index of the cell
kThe path index (alfa discreet value)
dThe distance (in TP-Space, range 0..1) to collision.
int mrpt::utils::CDynamicGrid< TCollisionCell >::x2idx ( float  x) const
inlineinherited

Transform a coordinate values into cell indexes.

Definition at line 301 of file CDynamicGrid.h.

int mrpt::utils::CDynamicGrid< TCollisionCell >::x2idx ( float  x,
float  x_min 
) const
inlineinherited

Transform a coordinate value into a cell index, using a diferent "x_min" value.

Definition at line 319 of file CDynamicGrid.h.

int mrpt::utils::CDynamicGrid< TCollisionCell >::xy2idx ( float  x,
float  y 
) const
inlineinherited

Definition at line 303 of file CDynamicGrid.h.

int mrpt::utils::CDynamicGrid< TCollisionCell >::y2idx ( float  y) const
inlineinherited

Definition at line 302 of file CDynamicGrid.h.

int mrpt::utils::CDynamicGrid< TCollisionCell >::y2idx ( float  y,
float  y_min 
) const
inlineinherited

Definition at line 320 of file CDynamicGrid.h.

Member Data Documentation

std::vector<TCollisionCell > mrpt::utils::CDynamicGrid< TCollisionCell >::m_map
protectedinherited

The cells.

Definition at line 49 of file CDynamicGrid.h.

CParameterizedTrajectoryGenerator const* mrpt::reactivenav::CParameterizedTrajectoryGenerator::CColisionGrid::m_parent
private

Definition at line 191 of file CParameterizedTrajectoryGenerator.h.

float mrpt::utils::CDynamicGrid< TCollisionCell >::m_resolution
protectedinherited

Definition at line 55 of file CDynamicGrid.h.

size_t mrpt::utils::CDynamicGrid< TCollisionCell >::m_size_x
protectedinherited

Definition at line 56 of file CDynamicGrid.h.

size_t mrpt::utils::CDynamicGrid< TCollisionCell >::m_size_y
protectedinherited

Definition at line 56 of file CDynamicGrid.h.

float mrpt::utils::CDynamicGrid< TCollisionCell >::m_x_max
protectedinherited

Definition at line 54 of file CDynamicGrid.h.

float mrpt::utils::CDynamicGrid< TCollisionCell >::m_x_min
protectedinherited

Definition at line 54 of file CDynamicGrid.h.

float mrpt::utils::CDynamicGrid< TCollisionCell >::m_y_max
protectedinherited

Definition at line 54 of file CDynamicGrid.h.

float mrpt::utils::CDynamicGrid< TCollisionCell >::m_y_min
protectedinherited

Definition at line 54 of file CDynamicGrid.h.




Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013