#include <Grid.h>
Public Member Functions | |
Grid () | |
Default constructor. | |
Grid (ExplorationParams params, Scan currScan, Pose center) | |
Parametric constructor. | |
Grid (ExplorationParams params, Scan currScan, Pose center, Decimal width, Decimal height, Decimal distForInvalid=0.3) | |
Second parametric constructor. | |
Grid (const Grid &g) | |
Copy constructor. | |
Grid | operator= (const Grid &g) |
Operator =. | |
~Grid () | |
Destructor. | |
vector< Cell * > | findFrameCells (int frame) |
Returns the vector of pointer to the cells belonging to the specified frame. | |
vector< Cell * > | bresenham (Cell *startCell, Cell *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 (frontier and obstacles), and sets properly their flags.Cell's indexes are stored in _lsrBound. | |
void | defineFrontier () |
Finds local frontier 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. | |
unsigned int | compCol (Decimal wid, Decimal res) |
Computes the number of columns in the grid. | |
unsigned int | compRow (Decimal hei, Decimal res) |
Computes the number of rows in the grid. | |
void | defineBoard (int iMinArcSize=3, int iMinRadialSize=1, bool bIncludeObstacleEndPoints=false) |
Constructs the matricial rapresentation of the grid. Sets the fields of the cells composing the board and calls the functions for definition of LSR, LSR boundary, LRR, LRR boundary, Frontier. | |
void | updateLSR () |
Updates LSR cells and sets properly boards' cells' flags. Used after grid comparison for ExplorationGraph update. | |
void | updateFrontier () |
Finds Updates frontier and sets properly boards' cells' flags. Used after grid comparison for ExplorationGraph update. | |
bool | initializeScan (ExplorationParams params, Scan &currScan) |
void | setParams (ExplorationParams value) |
Sets _params camp. | |
void | setResolution (Decimal value) |
Sets board's resolution (equal to cell side size). | |
void | setWidth (Decimal value) |
Sets board's width. | |
void | setHeight (Decimal value) |
Sets board's height. | |
void | setColumns (int value) |
Sets board's columns. | |
void | setRows (int value) |
Sets board's rows. | |
void | setCenter (Pose value) |
Sets board's center. | |
void | setCentralCell (Cell *value) |
Sets board's central cell cell address. | |
void | setLLC (Position value) |
Sets board's LLC. | |
void | setRLC (Position value) |
Sets board's RLC. | |
void | setLUC (Position value) |
Sets board's LUC. | |
void | setRUC (Position value) |
Sets board's RUC. | |
Frontier | frontier () |
Returns a vector of FrontierArc rapresenting the frontier of the grid. | |
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 grid. | |
ExplorationParams | params () |
Returns the Exploration parameters. | |
Decimal | resolution () |
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. | |
Cell * | 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. | |
Cell * | getCell (int index) |
Returns the cell selected by its vector index. | |
Cell * | getCell (int i, int j) |
Returns the cell selected by its indexes. | |
Cell * | getCell (DubInt indexes) |
Returns the cell selected by its indexes. | |
Cell * | getCell (Position pos) |
Returns the cell selected by its position. | |
Cell * | getCellOnGlobal (DubInt indexes, int minI, int minJ) |
Returns the cell selected by its indexes. | |
Cell * | getCellOnGlobal (Position pos, int minI, int minJ, Position globalCenter) |
Returns the cell selected by its indexes. | |
string | print (Cell cell) |
Prints the charateristics of the specified cell (maybe better with Cell*). | |
void | log (Cell cell) |
Logs the charateristics of the specified cell in the file specified in _params(maybe better with Cell*). | |
string | print () |
Prints the charateristics of the grid. | |
void | log () |
Logs the charateristics of the grid. | |
Position | alligne (Position pos) |
Returns the Position of the cell corresponding to generic Position pos. Used to alligne the centers of different grid (ExplorationGraph update). | |
void | addScan (Scan &scan, Pose scanPose) |
Returns the Position of the cell corresponding to generic Position pos. Used to alligne the centers of different grid (ExplorationGraph update). | |
Public Attributes | |
ExplorationParams | _params |
Parameters for board initialization. | |
Scan | _currScan |
Scan associated to the grid. | |
Decimal | _resolution |
Cells side size[m]. | |
Decimal | _width |
Grid width[m]. | |
Decimal | _height |
Grid height[m]. | |
Decimal | _distForInvalid |
Distance to assign to the invalid rays which fill a scan of less that 2 Pi [m]. | |
unsigned int | _columns |
Number of grid columns (odd). | |
unsigned int | _rows |
Number of grid rows (odd). | |
Pose | _center |
Center cell pose w.r.t. the absolute frame. | |
Cell * | _centralCell |
Pointer to the central cell of the board (current position). | |
Position | _LLC |
Left Lower Corner cell coordinates w.r.t. the absolute frame. | |
Position | _RLC |
Right Lower Corner cell coordinates w.r.t. the absolute frame. | |
Position | _LUC |
Left Upper Corner cell coordinates w.r.t. the absolute frame. | |
Position | _RUC |
Right Upper Corner cell coordinates w.r.t. the absolute frame. | |
vector< Cell > | _board |
Matricial rapresentation of the grid. | |
LSR | _lsr |
Vector containing the indexes of the cells belonging to LSR. | |
LSRBound | _lsrBound |
Vector containing the indexes of the cells belonging to LSR boundary. | |
LRR | _lrr |
Vector containing the indexes of the cells belonging to LRR. | |
LRRBound | _lrrBound |
Vector containing the indexes of the cells belonging to LRR boundary. | |
Frontier | _frontier |
Vector containing the indexes of the cells belonging to Frontier. | |
LSRBound | _originalFront |
Vector containing the indexes of the cells belonging to Frontier after updating. | |
LSRBound | _tempBound |
Vector containing the indexes of the cells belonging to LSR boundary before updating. |
MipBaselib::Grid::Grid | ( | ) |
Default constructor.
MipBaselib::Grid::Grid | ( | ExplorationParams | params, | |
Scan | currScan, | |||
Pose | center | |||
) |
Parametric constructor.
MipBaselib::Grid::Grid | ( | ExplorationParams | params, | |
Scan | currScan, | |||
Pose | center, | |||
Decimal | width, | |||
Decimal | height, | |||
Decimal | distForInvalid = 0.3 | |||
) |
Second parametric constructor.
MipBaselib::Grid::Grid | ( | const Grid & | g | ) |
Copy constructor.
MipBaselib::Grid::~Grid | ( | ) |
Destructor.
vector< Cell * > MipBaselib::Grid::findFrameCells | ( | int | frame | ) |
Returns the vector of pointer to the cells belonging to the specified frame.
Implements the Bresenham algorithm for line rasterization.
void MipBaselib::Grid::defineLSR | ( | ) |
Finds LSR cells and sets properly boards' cells' flags.Cell's indexes are stored in _lsr.
void MipBaselib::Grid::defineLSRBoundary | ( | int | iMinArcSize = 3 , |
|
int | iMinRadialSize = 1 , |
|||
bool | bIncludeObstacleEndPoints = false | |||
) |
Computes the celles belonging to LSR boundary (frontier and obstacles), and sets properly their flags.Cell's indexes are stored in _lsrBound.
valid ||
void MipBaselib::Grid::defineFrontier | ( | ) |
Finds local frontier and sets properly boards' cells' flags. Frintier is organized in froniter arcs.
void MipBaselib::Grid::defineLRR | ( | ) |
Computes the number of columns in the grid.
wid | Grid width in meters. | |
res | Cells side size in meters. |
Computes the number of rows in the grid.
hei | Grid height in meters. | |
res | Cells side size in meters. |
void MipBaselib::Grid::defineBoard | ( | int | iMinArcSize = 3 , |
|
int | iMinRadialSize = 1 , |
|||
bool | bIncludeObstacleEndPoints = false | |||
) |
void MipBaselib::Grid::updateLSR | ( | ) |
Updates LSR cells and sets properly boards' cells' flags. Used after grid comparison for ExplorationGraph update.
void MipBaselib::Grid::updateFrontier | ( | ) |
Finds Updates frontier and sets properly boards' cells' flags. Used after grid comparison for ExplorationGraph update.
bool MipBaselib::Grid::initializeScan | ( | ExplorationParams | params, | |
Scan & | currScan | |||
) |
void MipBaselib::Grid::setParams | ( | ExplorationParams | value | ) |
Sets _params camp.
void MipBaselib::Grid::setResolution | ( | Decimal | value | ) |
Sets board's resolution (equal to cell side size).
value | Board's resolution to set. |
void MipBaselib::Grid::setWidth | ( | Decimal | value | ) |
Sets board's width.
value | Board's width to set. |
void MipBaselib::Grid::setHeight | ( | Decimal | value | ) |
Sets board's height.
value | Board's height to set. |
void MipBaselib::Grid::setColumns | ( | int | value | ) |
Sets board's columns.
value | Board's columns to set. |
void MipBaselib::Grid::setRows | ( | int | value | ) |
Sets board's rows.
value | Board's rows to set. |
void MipBaselib::Grid::setCenter | ( | Pose | value | ) |
Sets board's center.
value | Board's center to set. |
void MipBaselib::Grid::setCentralCell | ( | Cell * | value | ) |
Sets board's central cell cell address.
value | Board's center to set. |
void MipBaselib::Grid::setLLC | ( | Position | value | ) |
Sets board's LLC.
value | Board's Left Lower Corner to set. |
void MipBaselib::Grid::setRLC | ( | Position | value | ) |
Sets board's RLC.
value | Board's Right Lower Corner to set. |
void MipBaselib::Grid::setLUC | ( | Position | value | ) |
Sets board's LUC.
value | Board's Left Upper Corner to set. |
void MipBaselib::Grid::setRUC | ( | Position | value | ) |
Sets board's RUC.
value | Board's Right Upper Corner to . |
Frontier MipBaselib::Grid::frontier | ( | ) |
Returns a vector of FrontierArc rapresenting the frontier of the grid.
void MipBaselib::Grid::getExpectedScan | ( | Scan & | expScan, | |
Pose | pose, | |||
Decimal | range, | |||
unsigned int | samples, | |||
Angle | angWidth | |||
) |
Computes the expected scan from pose based on contents of grid.
[out] | &expScan | The expected scan from pose based on contents of grid. |
[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. |
ExplorationParams MipBaselib::Grid::params | ( | ) |
Returns the Exploration parameters.
Decimal MipBaselib::Grid::resolution | ( | ) |
Returns board's resolution (equal to cell side size).
Decimal MipBaselib::Grid::width | ( | ) |
Returns board's width.
Decimal MipBaselib::Grid::height | ( | ) |
Returns board's height.
int MipBaselib::Grid::columns | ( | ) |
Returns board's columns.
int MipBaselib::Grid::rows | ( | ) |
Returns board's rows.
Pose MipBaselib::Grid::center | ( | ) |
Returns center cell coordinates.
Cell * MipBaselib::Grid::centralCell | ( | ) |
Returns a pointer to board's central cell.
Position MipBaselib::Grid::LLC | ( | ) |
Returns LLC cell coordinates.
Position MipBaselib::Grid::RLC | ( | ) |
Returns RLC cell coordinates.
Position MipBaselib::Grid::LUC | ( | ) |
Returns LUC cell coordinates.
Position MipBaselib::Grid::RUC | ( | ) |
Returns RUC cell coordinates.
Cell * MipBaselib::Grid::getCell | ( | int | index | ) |
Returns the cell selected by its vector index.
Cell * MipBaselib::Grid::getCell | ( | int | i, | |
int | j | |||
) |
Returns the cell selected by its indexes.
Returns the cell selected by its indexes.
Cell * MipBaselib::Grid::getCellOnGlobal | ( | Position | pos, | |
int | minI, | |||
int | minJ, | |||
Position | globalCenter | |||
) |
Returns the cell selected by its indexes.
string MipBaselib::Grid::print | ( | Cell | cell | ) |
Prints the charateristics of the specified cell (maybe better with Cell*).
void MipBaselib::Grid::log | ( | Cell | cell | ) |
Logs the charateristics of the specified cell in the file specified in _params(maybe better with Cell*).
string MipBaselib::Grid::print | ( | ) |
Prints the charateristics of the grid.
void MipBaselib::Grid::log | ( | ) |
Logs the charateristics of the grid.
Returns the Position of the cell corresponding to generic Position pos. Used to alligne the centers of different grid (ExplorationGraph update).
Returns the Position of the cell corresponding to generic Position pos. Used to alligne the centers of different grid (ExplorationGraph update).
Parameters for board initialization.
Scan associated to the grid.
Cells side size[m].
Grid width[m].
Grid height[m].
Distance to assign to the invalid rays which fill a scan of less that 2 Pi [m].
unsigned int MipBaselib::Grid::_columns |
Number of grid columns (odd).
unsigned int MipBaselib::Grid::_rows |
Number of grid rows (odd).
Center cell pose w.r.t. the absolute frame.
Pointer to the central cell of the board (current position).
Left Lower Corner cell coordinates w.r.t. the absolute frame.
Right Lower Corner cell coordinates w.r.t. the absolute frame.
Left Upper Corner cell coordinates w.r.t. the absolute frame.
Right Upper Corner cell coordinates w.r.t. the absolute frame.
vector<Cell> MipBaselib::Grid::_board |
Matricial rapresentation of the grid.
Vector containing the indexes of the cells belonging to LSR.
Vector containing the indexes of the cells belonging to LSR boundary.
Vector containing the indexes of the cells belonging to LRR.
Vector containing the indexes of the cells belonging to LRR boundary.
Vector containing the indexes of the cells belonging to Frontier.
Vector containing the indexes of the cells belonging to Frontier after updating.
Vector containing the indexes of the cells belonging to LSR boundary before updating.