MipBaselib::PerceptionGrid Class Reference

Grid representation for robot's sorrounding. More...

#include <PerceptionGrid.h>

Inheritance diagram for MipBaselib::PerceptionGrid:

MIPObject

List of all members.

Public Member Functions

void _setAllNotLocal ()
 Sets all cells of the grid to non local.
PerceptionGridParperceptionGridPar ()
void _clear ()
void _scanLineFill (int xx, int yy)
void _computeLSR (Pose pose)
bool _isUnknown (DubInt indexes)
void _setUnknown (DubInt indexes, Decimal useless=0)
void _eraseLocalRegion (Pose pose)
string getObjectName () const
 returns the name of the class.
 PerceptionGrid (PerceptionGridPar perceptionGridPar, Scan currScan)
 The main constructor.
 PerceptionGrid (const PerceptionGrid &g)
 Copy constructor.
PerceptionGrid operator= (const PerceptionGrid &g)
 Operator =.
 ~PerceptionGrid ()
 Destructor.
vector< PerceptionCell * > findFrameCells (int frame)
 Returns the vector of pointer to the cells belonging to the specified frame.
vector< PerceptionCell * > bresenham (PerceptionCell *startCell, PerceptionCell *stopCell)
 Implements the Bresenham algorithm for line rasterization.
void defineLSR ()
 Finds LSR cells and sets properly boards' cells' flags.Cell's indexes are stored in _lsr.
void defineLSRBoundary (int iMinArcSize=3, int iMinRadialSize=1, bool bIncludeObstacleEndPoints=false)
 Computes the celles belonging to LSR boundary (PerceptionFrontier and obstacles), and sets properly their flags.Cell's indexes are stored in _lsrBound.
vector< DubIntcomputeLSRContour (Scan &scan, int iMinArcSize=3, int iMinRadialSize=1, bool bIncludeObstacleEndPoints=false)
 Computes the LSRContour corresponding to the last added scan.
void _eraseLSRContour ()
vector< DubIntcomputeLSRContour (Scan &scan, Pose pose, Decimal maxDistance)
 Computes the LSRContour corresponding to the last added scan.
void _addRobotShape (vector< DubInt > *lsrContour, PerceptionFrontierArc *currentArc, Pose pose)
 Adds the shape of the robot to the LSRContour.
void definePerceptionFrontier ()
 Finds local PerceptionFrontier and sets properly boards' cells' flags. Frintier is organized in froniter arcs.
void defineLRR ()
 Finds the LRR and LRR boundary and sets properly boards' cells' flags. Cell's indexes are stored in _lrr _lrrBound respectively.
void defineBoard (int iMinArcSize=3, int iMinRadialSize=1, bool bIncludeObstacleEndPoints=false)
 Constructs the matricial rapresentation of the PerceptionGrid.
void updateLSR ()
 Updates LSR cells and sets properly boards' cells' flags. Used after PerceptionGrid comparison for ExplorationGraph update.
void updatePerceptionFrontier ()
 Finds Updates PerceptionFrontier and sets properly boards' cells' flags. Used after PerceptionGrid comparison for ExplorationGraph update.
bool initializeScan (ScanPar params, Scan &currScan)
PerceptionFrontier Frontier ()
 Returns a vector of PerceptionFrontierArc rapresenting the PerceptionFrontier of the PerceptionGrid.
LSRBound lsrBound ()
 Returns boundary of LSR as a LSRBound (vector of DubInt).
LSR lsr ()
 Returns LSR as a LSR (vector of DubInt).
LRR lrr ()
 Returns LRR as a LRR (vector of DubInt).
void getExpectedScan (Scan &expScan, Pose pose, Decimal range, unsigned int samples, Angle angWidth)
 Computes the expected scan from pose based on contents of PerceptionGrid.
Decimal cellSize ()
 Returns board's resolution (equal to cell side size).
Decimal width ()
 Returns board's width.
Decimal height ()
 Returns board's height.
int columns ()
 Returns board's columns.
int rows ()
 Returns board's rows.
Pose center ()
 Returns center cell coordinates.
PerceptionCellcentralCell ()
 Returns a pointer to board's central cell.
Position LLC ()
 Returns LLC cell coordinates.
Position RLC ()
 Returns RLC cell coordinates.
Position LUC ()
 Returns LUC cell coordinates.
Position RUC ()
 Returns RUC cell coordinates.
PerceptionCellgetCell (int index)
 Returns the cell selected by its vector index.
PerceptionCelloperator[] (int index)
 Returns the pointer to the cell selected by its vector index.
PerceptionCelloperator() (int i, int j)
 Returns the pointer to the cell selected by its indexes.
PerceptionCellgetCell (int i, int j)
 Returns the pointer to the cell selected by its indexes.
PerceptionCellgetCell (DubInt indexes)
 Returns the pointer to the cell selected by its indexes.
PerceptionCellgetCell (Position pos)
 Returns the pointer to the cell selected by its position.
PerceptionCellgetCellOnGlobal (DubInt indexes, int minI, int minJ)
 Returns the pointer to the cell selected by its indexes.
PerceptionCellgetCellOnGlobal (Position pos, int minI, int minJ, Position globalCenter)
 Returns the pointer to the cell selected by its indexes.
Position alligne (Position pos)
 Returns the Position of the cell corresponding to generic Position pos. Used to allign the centers of different PerceptionGrid (ExplorationGraph update).
void addScan2 (Scan &scan, Pose scanPose)
 Merges the PerceptionGrid with another PerceptionGrid.
void frontierToVectVectPosition (vector< vector< Position > > &vectPos, PerceptionFrontier &frontiere)
 Converts the current PerceptionFrontier Object to the corresponding vector of vector of positions.
vector< vector< Position > > frontierToVectVectPosition (PerceptionFrontier &frontiere)
 Converts the current PerceptionFrontier Object to the corresponding vector of vector of positions.
void addScan (Scan &scan, Pose &pose)
 The method to add a new scan to the Grid.


Detailed Description

Grid representation for robot's sorrounding.

Author:
Antonio Franchi and Marco Barbalinardo - email:barba82@yahoo.it
Date:
2008/11/14
Todo:
privatize camps.
Bug:
none

Constructor & Destructor Documentation

MipBaselib::PerceptionGrid::PerceptionGrid ( PerceptionGridPar  perceptionGridPar,
Scan  currScan 
)

The main constructor.

Todo:
correct the scan (is it necessary)????? --> NO
Todo:
build the board (instanciate cells)
Todo:
set central cell

MipBaselib::PerceptionGrid::PerceptionGrid ( const PerceptionGrid g  ) 

Copy constructor.

MipBaselib::PerceptionGrid::~PerceptionGrid (  ) 

Destructor.


Member Function Documentation

void MipBaselib::PerceptionGrid::_setAllNotLocal (  ) 

Sets all cells of the grid to non local.

PerceptionGridPar* MipBaselib::PerceptionGrid::perceptionGridPar (  )  [inline]

void MipBaselib::PerceptionGrid::_clear (  )  [inline]

void MipBaselib::PerceptionGrid::_scanLineFill ( int  xx,
int  yy 
)

void MipBaselib::PerceptionGrid::_computeLSR ( Pose  pose  ) 

Todo:
document me _computeLSR
Parameters:
pose 

bool MipBaselib::PerceptionGrid::_isUnknown ( DubInt  indexes  ) 

void MipBaselib::PerceptionGrid::_setUnknown ( DubInt  indexes,
Decimal  useless = 0 
)

void MipBaselib::PerceptionGrid::_eraseLocalRegion ( Pose  pose  ) 

string MipBaselib::PerceptionGrid::getObjectName (  )  const [inline, virtual]

returns the name of the class.

Note:
compulsory for debugging, pure virtual from MIPObject.
Returns:
The name of the class

Implements MIPObject.

PerceptionGrid MipBaselib::PerceptionGrid::operator= ( const PerceptionGrid g  ) 

Operator =.

vector< PerceptionCell * > MipBaselib::PerceptionGrid::findFrameCells ( int  frame  ) 

Returns the vector of pointer to the cells belonging to the specified frame.

Todo:
make private.

vector< PerceptionCell * > MipBaselib::PerceptionGrid::bresenham ( PerceptionCell startCell,
PerceptionCell stopCell 
)

Implements the Bresenham algorithm for line rasterization.

Todo:
make private.

void MipBaselib::PerceptionGrid::defineLSR (  ) 

Finds LSR cells and sets properly boards' cells' flags.Cell's indexes are stored in _lsr.

Todo:
make private.
Note:
deprecated.

void MipBaselib::PerceptionGrid::defineLSRBoundary ( int  iMinArcSize = 3,
int  iMinRadialSize = 1,
bool  bIncludeObstacleEndPoints = false 
)

Computes the celles belonging to LSR boundary (PerceptionFrontier and obstacles), and sets properly their flags.Cell's indexes are stored in _lsrBound.

Todo:
make private.
Note:
deprecated

valid

vector< DubInt > MipBaselib::PerceptionGrid::computeLSRContour ( Scan scan,
int  iMinArcSize = 3,
int  iMinRadialSize = 1,
bool  bIncludeObstacleEndPoints = false 
)

Computes the LSRContour corresponding to the last added scan.

Note:
deprecated

valid

void MipBaselib::PerceptionGrid::_eraseLSRContour (  ) 

vector< DubInt > MipBaselib::PerceptionGrid::computeLSRContour ( Scan scan,
Pose  pose,
Decimal  maxDistance 
)

Computes the LSRContour corresponding to the last added scan.

Parameters:
[in] scan a reference to the last scan.
[in] pose the pose in which the scan was taken.
[in] maxDistance the maximum distance between two points of the same "arc".
Returns:
the vector of indexes of the LSRBound.

Todo:
check if this condition could not be reduced to just an equal

Todo:
make function to do this.

Todo:
make function to do this.

Todo:
make function to do this.

Todo:
check why this does the contrary of what is written up here.

Todo:
make function to do this.

void MipBaselib::PerceptionGrid::_addRobotShape ( vector< DubInt > *  lsrContour,
PerceptionFrontierArc currentArc,
Pose  pose 
)

Adds the shape of the robot to the LSRContour.

void MipBaselib::PerceptionGrid::definePerceptionFrontier (  ) 

Finds local PerceptionFrontier and sets properly boards' cells' flags. Frintier is organized in froniter arcs.

Todo:
make private.

void MipBaselib::PerceptionGrid::defineLRR (  ) 

Finds the LRR and LRR boundary and sets properly boards' cells' flags. Cell's indexes are stored in _lrr _lrrBound respectively.

Todo:
make private.
Note:
deprecated.

void MipBaselib::PerceptionGrid::defineBoard ( int  iMinArcSize = 3,
int  iMinRadialSize = 1,
bool  bIncludeObstacleEndPoints = false 
)

Constructs the matricial rapresentation of the PerceptionGrid.

Sets the fields of the cells composing the board and calls the functions for definition of LSR, LSR boundary, LRR, LRR boundary, PerceptionFrontier.

Todo:
make private.

Note:
could be made less complex (n*p-1) (here 8*n*p-3*p-3*n+10) with a moving list of neighbours.

should be out of this method.

void MipBaselib::PerceptionGrid::updateLSR (  ) 

Updates LSR cells and sets properly boards' cells' flags. Used after PerceptionGrid comparison for ExplorationGraph update.

Todo:
make private.

void MipBaselib::PerceptionGrid::updatePerceptionFrontier (  ) 

Finds Updates PerceptionFrontier and sets properly boards' cells' flags. Used after PerceptionGrid comparison for ExplorationGraph update.

Todo:
make private.
Note:
deprecated.

bool MipBaselib::PerceptionGrid::initializeScan ( ScanPar  params,
Scan scan 
)

Note:
may be useless.
Todo:
Comment.
Todo:
make at least private.
Note:
deprecated.

Note:
what is stable_sort????

PerceptionFrontier MipBaselib::PerceptionGrid::Frontier (  ) 

Returns a vector of PerceptionFrontierArc rapresenting the PerceptionFrontier of the PerceptionGrid.

LSRBound MipBaselib::PerceptionGrid::lsrBound (  ) 

Returns boundary of LSR as a LSRBound (vector of DubInt).

LSR MipBaselib::PerceptionGrid::lsr (  ) 

Returns LSR as a LSR (vector of DubInt).

LRR MipBaselib::PerceptionGrid::lrr (  ) 

Returns LRR as a LRR (vector of DubInt).

void MipBaselib::PerceptionGrid::getExpectedScan ( Scan expScan,
Pose  expScanPose,
Decimal  range,
unsigned int  samples,
Angle  angWidth 
)

Computes the expected scan from pose based on contents of PerceptionGrid.

Parameters:
[out] &expScan The expected scan from pose based on contents of PerceptionGrid.
[in] pose Pose of scan to take.
[in] range Max LinRange of the scan to take.
[in] samples Number of rays of the scan to take.
[in] angWidth Angular witdh of the scan to take.
Todo:
check this one.

Decimal MipBaselib::PerceptionGrid::cellSize (  ) 

Returns board's resolution (equal to cell side size).

Decimal MipBaselib::PerceptionGrid::width (  ) 

Returns board's width.

Decimal MipBaselib::PerceptionGrid::height (  ) 

Returns board's height.

int MipBaselib::PerceptionGrid::columns (  ) 

Returns board's columns.

int MipBaselib::PerceptionGrid::rows (  ) 

Returns board's rows.

Pose MipBaselib::PerceptionGrid::center (  ) 

Returns center cell coordinates.

PerceptionCell * MipBaselib::PerceptionGrid::centralCell (  ) 

Returns a pointer to board's central cell.

Position MipBaselib::PerceptionGrid::LLC (  ) 

Returns LLC cell coordinates.

Position MipBaselib::PerceptionGrid::RLC (  ) 

Returns RLC cell coordinates.

Position MipBaselib::PerceptionGrid::LUC (  ) 

Returns LUC cell coordinates.

Position MipBaselib::PerceptionGrid::RUC (  ) 

Returns RUC cell coordinates.

PerceptionCell * MipBaselib::PerceptionGrid::getCell ( int  index  ) 

Returns the cell selected by its vector index.

PerceptionCell * MipBaselib::PerceptionGrid::operator[] ( int  index  ) 

Returns the pointer to the cell selected by its vector index.

PerceptionCell * MipBaselib::PerceptionGrid::operator() ( int  i,
int  j 
)

Returns the pointer to the cell selected by its indexes.

PerceptionCell * MipBaselib::PerceptionGrid::getCell ( int  i,
int  j 
)

Returns the pointer to the cell selected by its indexes.

PerceptionCell * MipBaselib::PerceptionGrid::getCell ( DubInt  indexes  ) 

Returns the pointer to the cell selected by its indexes.

PerceptionCell * MipBaselib::PerceptionGrid::getCell ( Position  pos  ) 

Returns the pointer to the cell selected by its position.

PerceptionCell * MipBaselib::PerceptionGrid::getCellOnGlobal ( DubInt  indexes,
int  minI,
int  minJ 
)

Returns the pointer to the cell selected by its indexes.

Returns the cell selected by its indexes.

Todo:
check.
Todo:
Remove

PerceptionCell * MipBaselib::PerceptionGrid::getCellOnGlobal ( Position  pos,
int  minI,
int  minJ,
Position  globalCenter 
)

Returns the pointer to the cell selected by its indexes.

Todo:
check.

Position MipBaselib::PerceptionGrid::alligne ( Position  pos  ) 

Returns the Position of the cell corresponding to generic Position pos. Used to allign the centers of different PerceptionGrid (ExplorationGraph update).

Returns the Position of the cell corresponding to generic Position pos. Used to alligne the centers of different PerceptionGrid (ExplorationGraph update).

void MipBaselib::PerceptionGrid::addScan2 ( Scan scan,
Pose  scanPose 
)

Merges the PerceptionGrid with another PerceptionGrid.

Parameters:
[in] &anotherPerceptionGrid The other PerceptionGrid;
Todo:
It works only for obstacle cells. Extend it.

void MipBaselib::PerceptionGrid::frontierToVectVectPosition ( vector< vector< Position > > &  vectPos,
PerceptionFrontier frontiere 
)

Converts the current PerceptionFrontier Object to the corresponding vector of vector of positions.

Parameters:
[out] vectPos the reference to the vector where the result of the conversion will be written.

vector< vector< Position > > MipBaselib::PerceptionGrid::frontierToVectVectPosition ( PerceptionFrontier frontiere  ) 

Converts the current PerceptionFrontier Object to the corresponding vector of vector of positions.

Returns:
the result of the conversion

void MipBaselib::PerceptionGrid::addScan ( Scan scan,
Pose pose 
)

The method to add a new scan to the Grid.


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

Generated on Mon Feb 20 07:01:11 2017 for MIP by  doxygen 1.5.6