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

Hello

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:

http://wiki.ros.org/global_planner

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?

edit retag close merge delete

Sort by ยป oldest newest most voted

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.

more

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 : https://github.com/indraneelpatil/Gra...

Cheers!

more