Fawkes API  Fawkes Development Version
fawkes::LaserOccupancyGrid Class Reference

This OccGrid is derived by the Occupancy Grid originally from Andreas Strack, but modified for speed purposes. More...

#include <>>

Inheritance diagram for fawkes::LaserOccupancyGrid:

Public Member Functions

 LaserOccupancyGrid (Laser360Interface *laser, Logger *logger, Configuration *config, tf::Transformer *listener, int width=150, int height=150, int cell_width=5, int cell_height=5)
 Constructor. More...
 
 ~LaserOccupancyGrid ()
 Descturctor. More...
 
float update_occ_grid (int mid_x, int mid_y, float inc, float vx, float vy)
 Put the laser readings in the occupancy grid. More...
 
void reset_old ()
 Reset all old readings and forget about the world state! More...
 
point_t get_laser_position ()
 Get the laser's position in the grid. More...
 
void set_base_offset (float x, float y)
 Set the offset of base_link from laser. More...
 
colli_cell_cost_t get_cell_costs () const
 Get cell costs. More...
 
- Public Member Functions inherited from fawkes::OccupancyGrid
 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...
 

Additional Inherited Members

- Public Attributes inherited from fawkes::OccupancyGrid
std::vector< std::vector< Probability > > occupancy_probs_
 The occupancy probability of the cells in a 2D array. More...
 
- Protected Attributes inherited from fawkes::OccupancyGrid
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

This OccGrid is derived by the Occupancy Grid originally from Andreas Strack, but modified for speed purposes.

Definition at line 49 of file og_laser.h.

Constructor & Destructor Documentation

◆ LaserOccupancyGrid()

fawkes::LaserOccupancyGrid::LaserOccupancyGrid ( Laser360Interface laser,
Logger logger,
Configuration config,
tf::Transformer listener,
int  width = 150,
int  height = 150,
int  cell_width = 5,
int  cell_height = 5 
)

◆ ~LaserOccupancyGrid()

fawkes::LaserOccupancyGrid::~LaserOccupancyGrid ( )

Descturctor.

Definition at line 145 of file og_laser.cpp.

Member Function Documentation

◆ get_cell_costs()

◆ get_laser_position()

point_t fawkes::LaserOccupancyGrid::get_laser_position ( )

Get the laser's position in the grid.

Returns
point_t structure containing the laser's position in the grid

Definition at line 421 of file og_laser.cpp.

◆ reset_old()

◆ set_base_offset()

void fawkes::LaserOccupancyGrid::set_base_offset ( float  x,
float  y 
)

Set the offset of base_link from laser.

Parameters
xoffset in x-direction (in meters)
yoffset in y-direction (in meters)

Definition at line 431 of file og_laser.cpp.

References fawkes::OccupancyGrid::cell_height_, fawkes::OccupancyGrid::cell_width_, fawkes::point_struct::x, fawkes::cart_coord_2d_struct::x, fawkes::point_struct::y, and fawkes::cart_coord_2d_struct::y.

Referenced by ColliThread::init(), and ColliThread::loop().

◆ update_occ_grid()

float fawkes::LaserOccupancyGrid::update_occ_grid ( int  midX,
int  midY,
float  inc,
float  vx,
float  vy 
)

Put the laser readings in the occupancy grid.

Put the laser readings in the occupancy grid Also, every reading gets a radius according to the relative direction of this reading to the robot.

Parameters
midXis the current x position of the robot in the grid.
midYis the current y position of the robot in the grid.
incis the current constant to increase the obstacles.
vxTranslation x velocity of the motor
vyTranslation y velocity of the motor
Returns
distance to next obstacle in pathdirection

Definition at line 357 of file og_laser.cpp.

References fawkes::colli_cell_cost_t::free, fawkes::OccupancyGrid::height_, fawkes::Logger::log_error(), fawkes::tf::Transformer::lookup_transform(), fawkes::OccupancyGrid::occupancy_probs_, fawkes::OccupancyGrid::width_, fawkes::point_struct::x, and fawkes::point_struct::y.

Referenced by ColliThread::loop().


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