Ask Your Question

How can I visualize Dijkstra and A* steps in rviz?

asked 2018-03-01 11:10:48 -0500

Guillermo gravatar image


I am doing some tests comparing Dijkstra and A* algorithms performance with Gazebo+Rviz simulation, and I would like to obtain results through graphics similar to the ones in the move_base tutorials:

What I would like is to be able to see in each case which cells have been evaluated in order to find the final path.

I have done a few tests with rviz ( gridmap, pointcloud, and map plugins among others), but I don't know how to visualize this info in it (it only shows the final path, and results using Dijkstra and A* seem to be very similar).

Can someone help me on how can I do this?

Thank you in advance Regards

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2018-03-05 01:52:32 -0500

Alberth gravatar image

updated 2018-03-05 01:53:03 -0500

If you use the same notion of distance in both algorithms, then you should indeed expect to get the same shortest path results, except you may have multiple paths with the same smallest length, where you will get one of them (eg in a rectangular grid, going 1 diagonal, and one straight versus one straight and then one diagonal has equal length, but they are different paths as you visit different nodes).

To visualize the explored nodes, the last step in both algorithms is to trace the path from the end-point back to the starting-point, as the sequence of nodes to walk. In addition, display all nodes in the 'closed list' of A* (and the equivalent thing in the Dijkstra algorithm).

Note that an A* heuristic of "the constant 0" will degenerate A* to Dijkstra, in which case the set explored nodes will also be the same with both algorithms.

edit flag offensive delete link more

answered 2020-06-25 05:02:02 -0500

indraneel gravatar image

For anyone that could be interested in this in the future, attaching a project of mine I did earlier which visualises Depth First Search, Breadth First Search, Djikstras and A* in rviz :

The demos are uploaded here : and


edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-03-01 11:10:48 -0500

Seen: 351 times

Last updated: Jun 25 '20