A log-odds occupancy grid. More...
#include <Robots/LoBot/slam/LoOccGrid.H>
Public Member Functions | |
OccGrid () | |
OccGrid (const std::string &map_file) | |
OccGrid (const OccGrid &) | |
Copy. | |
OccGrid & | operator= (const OccGrid &) |
Assignment. | |
OccGrid & | operator+= (const OccGrid &) |
OccGrid | operator+ (const OccGrid &) const |
OccGrid | operator* (float weight) const |
float | get (int x, int y) const |
bool | is_occupied (int x, int y) const |
bool | is_vacant (int x, int y) const |
Check if cell is vacant. | |
~OccGrid () | |
Clean-up. | |
Grid::const_iterator | begin () const |
Accessors. | |
Grid::const_iterator | end () const |
| |
void | occupied (int x, int y) |
void | vacant (int x, int y) |
A log-odds occupancy grid.
This class implements an occupancy grid that is used to keep track of where obstacles are in the robot's environment. The occupancy grid's cells hold probability values rather than simple 0/1 flags to indicate the absence or presence of an obstacle. Furthermore, the probabilities are stored in log-odds form rather than directly as numbers in the [0,1] range.
The extents of the occupancy grid are specified using [L, R, B, T] values, which are read from the Robolocust config file.
Definition at line 82 of file LoOccGrid.H.
lobot::OccGrid::OccGrid | ( | ) |
When an "empty" occupancy grid object is created, all its probabilities are set to 50%.
Definition at line 71 of file LoOccGrid.C.
References lobot::SlamParams::map_width().
lobot::OccGrid::OccGrid | ( | const std::string & | map_file | ) |
An occupancy grid may be initialized from a file containing coordinates of obstacles. In this case of a known map, the cells containing obstacles will be assigned high likelihoods (nearly 100%) and the other cells will get low likelihoods (nearly 0%).
Definition at line 84 of file LoOccGrid.C.
References lobot::SlamParams::map_width(), and occupied().
lobot::OccGrid::OccGrid | ( | const OccGrid & | g | ) |
Copy.
Definition at line 124 of file LoOccGrid.C.
lobot::OccGrid::~OccGrid | ( | ) |
Clean-up.
Definition at line 295 of file LoOccGrid.C.
Grid::const_iterator lobot::OccGrid::begin | ( | ) | const [inline] |
float lobot::OccGrid::get | ( | int | x, | |
int | y | |||
) | const |
Return the log-odds occupancy value stored at the specified cell.
NOTE: The occupancy value of a cell is determined as a weighted sum of the value stored in the target cell itself and the values in the immediate neighbourhood of the target cell. The target cell's occupancy value gets the maximum weight while the neigbouring cells get lower weights.
Definition at line 253 of file LoOccGrid.C.
References lobot::SlamParams::map_width(), max(), min(), and lobot::SlamParams::update_weight().
bool lobot::OccGrid::is_occupied | ( | int | x, | |
int | y | |||
) | const |
This method checks if the specified cell of the occupancy grid is occupied.
Definition at line 238 of file LoOccGrid.C.
References lobot::SlamParams::occ_threshold().
Referenced by is_vacant().
bool lobot::OccGrid::is_vacant | ( | int | x, | |
int | y | |||
) | const [inline] |
void lobot::OccGrid::occupied | ( | int | x, | |
int | y | |||
) |
These methods mark the specified cell in the occupancy grid as either occupied or vacant by incrementing or decrementing the log-odds value in that cell.
Definition at line 179 of file LoOccGrid.C.
References exp().
Referenced by OccGrid().
OccGrid lobot::OccGrid::operator* | ( | float | weight | ) | const |
This method multiplies the probabilities in this occupancy grid by the supplied weighting factor and returns the scaled result in a new occupancy grid object.
Definition at line 168 of file LoOccGrid.C.
References transform().
This method adds this map to the supplied map and returns the result in a new map object.
Definition at line 159 of file LoOccGrid.C.
This method adds this map to the supplied map, retaining the result in this map object itself.
Definition at line 151 of file LoOccGrid.C.
References transform().
Assignment.
Definition at line 135 of file LoOccGrid.C.