Fawkes API  Fawkes Development Version
fawkes::OccupancyGrid Class Reference

Occupancy Grid class for general use. More...

#include <>>

Inheritance diagram for fawkes::OccupancyGrid:

Public Member Functions

 OccupancyGrid (int width, int height, int cell_width=5, int cell_height=5)
 Constructs an empty occupancy grid. More...
 
virtual ~OccupancyGrid ()
 Destructor. More...
 
int get_cell_width ()
 Get the cell width (in cm) More...
 
int get_cell_height ()
 Get the cell height (in cm) More...
 
int get_width ()
 Get the width of the grid. More...
 
int get_height ()
 Get the height of the grid. More...
 
void set_cell_width (int cell_width)
 Resets the cell width (in cm) More...
 
void set_cell_height (int cell_height)
 Resets the cell height (in cm) More...
 
void set_width (int width)
 Resets the width of the grid and constructs a new empty grid. More...
 
void set_height (int height)
 Resets the height of the grid and constructs a new empty grid. More...
 
virtual void set_prob (int x, int y, Probability prob)
 Reset the occupancy probability of a cell. More...
 
void fill (Probability prob)
 Resets all occupancy probabilities. More...
 
Probability get_prob (int x, int y)
 Get the occupancy probability of a cell. More...
 
Probabilityoperator() (const int x, const int y)
 Get the occupancy probability of a cell. More...
 
void init_grid ()
 Init a new empty grid with the predefined parameters */. More...
 

Public Attributes

std::vector< std::vector< Probability > > occupancy_probs_
 The occupancy probability of the cells in a 2D array. More...
 

Protected Attributes

int cell_width_
 Cell width in cm. More...
 
int cell_height_
 Cell height in cm. More...
 
int width_
 Width of the grid in # cells. More...
 
int height_
 Height of the grid in # cells. More...
 

Detailed Description

Occupancy Grid class for general use.

Many derivated classes exist, which are usually used instead of this general class. Note: the coord system is assumed to map x onto width an y onto height, with x being the first coordinate !

Definition at line 39 of file occupancygrid.h.

Constructor & Destructor Documentation

◆ OccupancyGrid()

fawkes::OccupancyGrid::OccupancyGrid ( int  width,
int  height,
int  cell_width = 5,
int  cell_height = 5 
)

Constructs an empty occupancy grid.

Parameters
widththe width of the grid in # of cells
heightthe height of the cells in # of cells
cell_widththe cell width in cm
cell_heightthe cell height in cm

Definition at line 45 of file occupancygrid.cpp.

References cell_height_, cell_width_, height_, init_grid(), and width_.

◆ ~OccupancyGrid()

fawkes::OccupancyGrid::~OccupancyGrid ( )
virtual

Destructor.

Definition at line 56 of file occupancygrid.cpp.

References occupancy_probs_.

Member Function Documentation

◆ fill()

void fawkes::OccupancyGrid::fill ( Probability  prob)

Resets all occupancy probabilities.

Parameters
probthe occupancy probability the grid will become filled with

Definition at line 152 of file occupancygrid.cpp.

References height_, fawkes::isProb(), occupancy_probs_, and width_.

Referenced by init_grid().

◆ get_cell_height()

int fawkes::OccupancyGrid::get_cell_height ( )

Get the cell height (in cm)

Get the cell height.

Returns
the height of the cells in cm

Definition at line 74 of file occupancygrid.cpp.

References cell_height_.

Referenced by ColliThread::loop(), fawkes::EscapePotentialFieldOmniDriveModule::update(), and fawkes::EscapePotentialFieldDriveModule::update().

◆ get_cell_width()

int fawkes::OccupancyGrid::get_cell_width ( )

Get the cell width (in cm)

Get the cell width.

Returns
the cell width in cm

Definition at line 65 of file occupancygrid.cpp.

References cell_width_.

Referenced by ColliThread::loop(), fawkes::EscapePotentialFieldOmniDriveModule::update(), and fawkes::EscapePotentialFieldDriveModule::update().

◆ get_height()

int fawkes::OccupancyGrid::get_height ( )

Get the height of the grid.

Returns
the height of the grid in # cells

Definition at line 92 of file occupancygrid.cpp.

References height_.

Referenced by fawkes::AStar::AStar(), fawkes::Search::get_robot_position(), ColliThread::loop(), fawkes::EscapePotentialFieldDriveModule::update(), and fawkes::EscapePotentialFieldOmniDriveModule::update().

◆ get_prob()

Probability fawkes::OccupancyGrid::get_prob ( int  x,
int  y 
)

Get the occupancy probability of a cell.

Parameters
xthe x-position of the cell
ythe y-position of the cell
Returns
the occupancy probability of cell (x,y)

Definition at line 169 of file occupancygrid.cpp.

References height_, occupancy_probs_, and width_.

Referenced by fawkes::Search::get_robot_position(), ColliThread::loop(), fawkes::AStar::remove_target_from_obstacle(), fawkes::AStar::solve(), fawkes::EscapePotentialFieldDriveModule::update(), fawkes::EscapePotentialFieldOmniDriveModule::update(), and fawkes::Search::update().

◆ get_width()

int fawkes::OccupancyGrid::get_width ( )

Get the width of the grid.

Returns
the width of the grid in # of cells

Definition at line 83 of file occupancygrid.cpp.

References width_.

Referenced by fawkes::AStar::AStar(), fawkes::Search::get_robot_position(), ColliThread::loop(), fawkes::EscapePotentialFieldDriveModule::update(), and fawkes::EscapePotentialFieldOmniDriveModule::update().

◆ init_grid()

void fawkes::OccupancyGrid::init_grid ( )

Init a new empty grid with the predefined parameters */.

Init a new empty grid with the predefined parameters.

Definition at line 191 of file occupancygrid.cpp.

References fill(), height_, occupancy_probs_, and width_.

Referenced by fawkes::LaserOccupancyGrid::LaserOccupancyGrid(), OccupancyGrid(), set_height(), and set_width().

◆ operator()()

Probability & fawkes::OccupancyGrid::operator() ( const int  x,
const int  y 
)

Get the occupancy probability of a cell.

Operator (), get occupancy probability of a cell.

Parameters
xthe x-position of the cell
ythe y-position of the cell
Returns
the occupancy probability of cell (x,y)

Definition at line 184 of file occupancygrid.cpp.

References occupancy_probs_.

◆ set_cell_height()

void fawkes::OccupancyGrid::set_cell_height ( int  height)

Resets the cell height (in cm)

Resets the cell height.

Parameters
heightthe height of the cells in cm

Definition at line 110 of file occupancygrid.cpp.

References cell_height_.

Referenced by ColliThread::loop().

◆ set_cell_width()

void fawkes::OccupancyGrid::set_cell_width ( int  width)

Resets the cell width (in cm)

Resets the cell width.

Parameters
widththe width of the cells in cm

Definition at line 101 of file occupancygrid.cpp.

References cell_width_.

Referenced by ColliThread::loop().

◆ set_height()

void fawkes::OccupancyGrid::set_height ( int  height)

Resets the height of the grid and constructs a new empty grid.

Parameters
heightthe height of the grid in # of cells

Definition at line 129 of file occupancygrid.cpp.

References height_, and init_grid().

Referenced by ColliThread::loop().

◆ set_prob()

void fawkes::OccupancyGrid::set_prob ( int  x,
int  y,
Probability  prob 
)
virtual

Reset the occupancy probability of a cell.

Parameters
xthe x-position of the cell
ythe y-position of the cell
probthe occupancy probability of cell (x,y)

Definition at line 142 of file occupancygrid.cpp.

References height_, fawkes::isProb(), occupancy_probs_, and width_.

◆ set_width()

void fawkes::OccupancyGrid::set_width ( int  width)

Resets the width of the grid and constructs a new empty grid.

Parameters
widththe cell width in cm

Definition at line 119 of file occupancygrid.cpp.

References init_grid(), and width_.

Referenced by ColliThread::loop().

Member Data Documentation

◆ cell_height_

int fawkes::OccupancyGrid::cell_height_
protected

◆ cell_width_

int fawkes::OccupancyGrid::cell_width_
protected

◆ height_

int fawkes::OccupancyGrid::height_
protected

◆ occupancy_probs_

std::vector<std::vector<Probability> > fawkes::OccupancyGrid::occupancy_probs_

The occupancy probability of the cells in a 2D array.

Definition at line 85 of file occupancygrid.h.

Referenced by fill(), fawkes::LaserOccupancyGrid::get_cell_costs(), get_prob(), init_grid(), operator()(), set_prob(), fawkes::LaserOccupancyGrid::update_occ_grid(), and ~OccupancyGrid().

◆ width_

int fawkes::OccupancyGrid::width_
protected

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