Class CostmapQueue

Inheritance Relationships

Base Type

Derived Type

Class Documentation

class CostmapQueue : public costmap_queue::MapBasedQueue<CellData>

Subclassed by costmap_queue::LimitedCostmapQueue

Public Types

typedef std::shared_ptr<CostmapQueue> Ptr

convenience typedef for a pointer

Public Functions

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

constructor

Parameters:
  • costmap – Costmap which defines the size/number of cells

  • manhattan – If true, sort cells by Manhattan distance, otherwise use Euclidean distance

virtual void reset() override

Clear the queue.

void enqueueCell(unsigned int x, unsigned int y)

Add a cell the queue.

Parameters:
  • x – X coordinate of the cell

  • y – Y coordinate of the cell

CellData getNextCell()

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

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

Returns:

The next cell

inline virtual bool validCellToQueue(const CellData&)

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

Parameters:

cell – The cell to check

Returns:

True, unless overriden

Protected 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.

inline 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.

Parameters:
  • cur_x – The x coordinate of the current cell

  • cur_y – The y coordinate of the current cell

  • src_x – The x coordinate of the source cell

  • src_y – The y coordinate of the source cell

Returns:

Protected Attributes

nav2_costmap_2d::Costmap2D &costmap_
std::vector<bool> seen_
int max_distance_
bool manhattan_
std::vector<std::vector<double>> cached_distances_
int cached_max_distance_