#include <PerceptionGrid.h>
Public Member Functions | |
void | _setAllNotLocal () |
Sets all cells of the grid to non local. | |
PerceptionGridPar * | perceptionGridPar () |
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< DubInt > | computeLSRContour (Scan &scan, int iMinArcSize=3, int iMinRadialSize=1, bool bIncludeObstacleEndPoints=false) |
Computes the LSRContour corresponding to the last added scan. | |
void | _eraseLSRContour () |
vector< DubInt > | computeLSRContour (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. | |
PerceptionCell * | centralCell () |
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. | |
PerceptionCell * | getCell (int index) |
Returns the cell selected by its vector index. | |
PerceptionCell * | operator[] (int index) |
Returns the pointer to the cell selected by its vector index. | |
PerceptionCell * | operator() (int i, int j) |
Returns the pointer to the cell selected by its indexes. | |
PerceptionCell * | getCell (int i, int j) |
Returns the pointer to the cell selected by its indexes. | |
PerceptionCell * | getCell (DubInt indexes) |
Returns the pointer to the cell selected by its indexes. | |
PerceptionCell * | getCell (Position pos) |
Returns the pointer to the cell selected by its position. | |
PerceptionCell * | getCellOnGlobal (DubInt indexes, int minI, int minJ) |
Returns the pointer to the cell selected by its indexes. | |
PerceptionCell * | getCellOnGlobal (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. |
MipBaselib::PerceptionGrid::PerceptionGrid | ( | PerceptionGridPar | perceptionGridPar, | |
Scan | currScan | |||
) |
MipBaselib::PerceptionGrid::PerceptionGrid | ( | const PerceptionGrid & | g | ) |
Copy constructor.
MipBaselib::PerceptionGrid::~PerceptionGrid | ( | ) |
Destructor.
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 | ) |
bool MipBaselib::PerceptionGrid::_isUnknown | ( | DubInt | indexes | ) |
void MipBaselib::PerceptionGrid::_eraseLocalRegion | ( | Pose | pose | ) |
string MipBaselib::PerceptionGrid::getObjectName | ( | ) | const [inline, virtual] |
PerceptionGrid MipBaselib::PerceptionGrid::operator= | ( | const PerceptionGrid & | g | ) |
Operator =.
vector< PerceptionCell * > MipBaselib::PerceptionGrid::findFrameCells | ( | int | frame | ) |
vector< PerceptionCell * > MipBaselib::PerceptionGrid::bresenham | ( | PerceptionCell * | startCell, | |
PerceptionCell * | stopCell | |||
) |
void MipBaselib::PerceptionGrid::defineLSR | ( | ) |
Finds LSR cells and sets properly boards' cells' flags.Cell's indexes are stored in _lsr.
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.
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.
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.
[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". |
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.
void MipBaselib::PerceptionGrid::defineLRR | ( | ) |
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.
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.
void MipBaselib::PerceptionGrid::updatePerceptionFrontier | ( | ) |
Finds Updates PerceptionFrontier and sets properly boards' cells' flags. Used after PerceptionGrid comparison for ExplorationGraph update.
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).
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.
[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. |
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 | |||
) |
PerceptionCell * MipBaselib::PerceptionGrid::getCellOnGlobal | ( | Position | pos, | |
int | minI, | |||
int | minJ, | |||
Position | globalCenter | |||
) |
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).
Merges the PerceptionGrid with another PerceptionGrid.
[in] | &anotherPerceptionGrid | The other PerceptionGrid; |
void MipBaselib::PerceptionGrid::frontierToVectVectPosition | ( | vector< vector< Position > > & | vectPos, | |
PerceptionFrontier & | frontiere | |||
) |
Converts the current PerceptionFrontier Object to the corresponding vector of vector of positions.
[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.
The method to add a new scan to the Grid.