In the CostmapQueue::getNextCell method, the head of the queue is referenced, adjacent cells are enqueued and then the head of the queue is popped. However, enqueuing the adjacent cells can change the head of the queue, resulting in a newly added cell getting popped instead of the cell that was just processed.
When this happens, the newly added cell will never get pulled from the queue and it's adjacent cells may never get expanded.
This will happen whenever a newly added cell has a lower cost than the head of the queue. Normally, this would never happen with a CostmapQueue, but can happen in MapGridQueue as cells are expanded behind obstacles as seen in ros-planning/navigation2/issues/451
In the
CostmapQueue::getNextCell
method, the head of the queue is referenced, adjacent cells are enqueued and then the head of the queue is popped. However, enqueuing the adjacent cells can change the head of the queue, resulting in a newly added cell getting popped instead of the cell that was just processed.When this happens, the newly added cell will never get pulled from the queue and it's adjacent cells may never get expanded.
This will happen whenever a newly added cell has a lower cost than the head of the queue. Normally, this would never happen with a CostmapQueue, but can happen in MapGridQueue as cells are expanded behind obstacles as seen in ros-planning/navigation2/issues/451