Nav2 Navigation Stack - kilted  kilted
ROS 2 Navigation Stack
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
costmap_queue::CostmapQueue Class Reference
Inheritance diagram for costmap_queue::CostmapQueue:
Inheritance graph
[legend]
Collaboration diagram for costmap_queue::CostmapQueue:
Collaboration graph
[legend]

Public Types

typedef std::shared_ptr< CostmapQueuePtr
 convenience typedef for a pointer
 

Public Member Functions

 CostmapQueue (nav2_costmap_2d::Costmap2D &costmap, bool manhattan=false)
 constructor More...
 
void reset () override
 Clear the queue.
 
void enqueueCell (unsigned int x, unsigned int y)
 Add a cell the queue. More...
 
CellData getNextCell ()
 Get the next cell to examine, and enqueue its neighbors as needed. More...
 
virtual bool validCellToQueue (const CellData &)
 Check to see if we should add this cell to the queue. Always true unless overridden. More...
 
- Public Member Functions inherited from costmap_queue::MapBasedQueue< CellData >
 MapBasedQueue (bool reset_bins=true)
 Default Constructor.
 
virtual ~MapBasedQueue ()=default
 Default virtual Destructor.
 
void enqueue (const double priority, CellData item)
 Add a new item to the queue with a set priority. More...
 
bool isEmpty ()
 Check to see if there is anything in the queue. More...
 
CellDatafront ()
 Return the item at the front of the queue. More...
 
void pop ()
 Remove (and destroy) the item at the front of the queue.
 

Protected Member Functions

void enqueueCell (unsigned int index, unsigned int cur_x, unsigned int cur_y, unsigned int src_x, unsigned int src_y)
 Enqueue a cell with the given coordinates and the given source cell.
 
void computeCache ()
 Compute the cached distances.
 
double distanceLookup (const unsigned int cur_x, const unsigned int cur_y, const unsigned int src_x, const unsigned int src_y)
 Lookup pre-computed distances. More...
 

Protected Attributes

nav2_costmap_2d::Costmap2Dcostmap_
 
std::vector< bool > seen_
 
int max_distance_
 
bool manhattan_
 
std::vector< std::vector< double > > cached_distances_
 
int cached_max_distance_
 
- Protected Attributes inherited from costmap_queue::MapBasedQueue< CellData >
bool reset_bins_
 
ItemMap item_bins_
 
unsigned int item_count_
 
ItemMapIterator iter_
 
ItemMapIterator last_insert_iter_
 

Additional Inherited Members

- Protected Types inherited from costmap_queue::MapBasedQueue< CellData >
using ItemMap = std::map< double, std::vector< CellData > >
 
using ItemMapIterator = typename ItemMap::iterator
 

Detailed Description

Definition at line 108 of file costmap_queue.hpp.

Constructor & Destructor Documentation

◆ CostmapQueue()

costmap_queue::CostmapQueue::CostmapQueue ( nav2_costmap_2d::Costmap2D costmap,
bool  manhattan = false 
)
explicit

constructor

Parameters
costmapCostmap which defines the size/number of cells
manhattanIf true, sort cells by Manhattan distance, otherwise use Euclidean distance

Definition at line 44 of file costmap_queue.cpp.

References reset().

Here is the call graph for this function:

Member Function Documentation

◆ distanceLookup()

double costmap_queue::CostmapQueue::distanceLookup ( const unsigned int  cur_x,
const unsigned int  cur_y,
const unsigned int  src_x,
const unsigned int  src_y 
)
inlineprotected

Lookup pre-computed distances.

Parameters
cur_xThe x coordinate of the current cell
cur_yThe y coordinate of the current cell
src_xThe x coordinate of the source cell
src_yThe y coordinate of the source cell
Returns

Definition at line 176 of file costmap_queue.hpp.

Referenced by enqueueCell().

Here is the caller graph for this function:

◆ enqueueCell()

void costmap_queue::CostmapQueue::enqueueCell ( unsigned int  x,
unsigned int  y 
)

Add a cell the queue.

Parameters
xX coordinate of the cell
yY coordinate of the cell

Definition at line 62 of file costmap_queue.cpp.

References nav2_costmap_2d::Costmap2D::getIndex().

Referenced by getNextCell().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNextCell()

CellData costmap_queue::CostmapQueue::getNextCell ( )

Get the next cell to examine, and enqueue its neighbors as needed.

Returns
The next cell

NB: Assumes that isEmpty has been called before this call and returned false

Definition at line 84 of file costmap_queue.cpp.

References enqueueCell(), costmap_queue::MapBasedQueue< CellData >::front(), nav2_costmap_2d::Costmap2D::getSizeInCellsX(), nav2_costmap_2d::Costmap2D::getSizeInCellsY(), and costmap_queue::MapBasedQueue< CellData >::pop().

Here is the call graph for this function:

◆ validCellToQueue()

virtual bool costmap_queue::CostmapQueue::validCellToQueue ( const CellData )
inlinevirtual

Check to see if we should add this cell to the queue. Always true unless overridden.

Parameters
cellThe cell to check
Returns
True, unless overridden

Reimplemented in dwb_critics::MapGridCritic::MapGridQueue, and costmap_queue::LimitedCostmapQueue.

Definition at line 143 of file costmap_queue.hpp.

Referenced by enqueueCell().

Here is the caller graph for this function:

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