A Demonstration with Visualisation/GUI for Robot Path Planning Algorithms like A*, RRT, & RRT*
Here, I implement and simulate/visualize the A*, RRT, and RRT* algorithms using Python and Pygame. To be able to run, execute and visualize the output of the code, you would need to have an installation of Python 3 (>= 3.8) and Pygame (>= 2.1) on your system.
- White: Empty/unoccupied grid cells (and) unexplored areas
- Black: Obstacles in the grid world
- Orange: Start node (or) target/goal node
- Green: Open Nodes which have been partially explored
- Red: Closed nodes which have completely been explored
- Blue: Nodes which are a part of the final and optimal trajectory
python3 a_star.py
Once the animation window opens, do the following:
- Click any grid cell (except obstacles) to mark the start node
- Click on another grid cell (except obstacles) to mark the target/goal node
- Click on the space key to start the A* Simulation.
- White: Empty/Non-obstacle areas which are unexplored
- Black: Rectangular and circular obstacles
- Orange: Start node (or) target/goal node
- Green: Trajectory indicating path found by RRT
- Red: Nodes added to the world
- Blue: Connection between parent and child nodes
python3 rrt.py
Once the animation window opens, do the following:
- Click any area (except obstacles) to mark the start node
- Click on another point (except obstacles) to mark the target/goal node
- Click on the space key to start the RRT Simulation.
- Choosing a proximal node with reduced distance based cost as the parent of a newly added node (over the nearest node as the parent).
- Rewiring nodes (parent-children connections) in a fixed vicinity of a newly added node to reduce the cost of each node in that neighbourhood.
- White: Empty/Non-obstacle areas which are unexplored
- Black: Rectangular and circular obstacles
- Orange: Start node (or) target/goal node
- Green: Trajectory indicating path found by RRT*
- Red: Nodes added to the world
- Blue: Connection between parent and child nodes
python3 rrt_star.py
Once the animation window opens, do the following:
- Click any area (except obstacles) to mark the start node
- Click on another point (except obstacles) to mark the target/goal node
- Click on the space key to start the RRT* Simulation.
- Even though A* produces optimal paths, it is computationally expensive to run, especially for higher dimenional spaces. For a 2D grid world though, it runs fast and well.
- RRT searches a majority of the entire world pretty fast, but struggles to quickly reach within the goal radius to complete running. A compbination of RRT with a heuristic/estimate of where the goal could be could attempt to solve this issue.
- RRT* produces much straighter paths (and thus eventually more optimal) than RRT. However, it takes longer to run because of steps like the rewiring of nodes.
A big shoutout to informative sources like this and this which give a valuable insight on how to use pygame for visualization and animation. # Robot-Path-Planning # Robot-Path-Planning