- Shubham Sonawane (UID: 116808996 )
- Revati Naik (UID: 116723015)
Find the optimal path from initial node to goal node using Dijkstra's Algorithm.
This project is divided into three sub-questions:
-
Checking the feasibility of the given start node and goal node (if they lie in the obstacle space)
-
Implementing Dijkstra's Algorithm to find path between start node and goal node on a given map for point robot and rigid robot
-
Output an animation of optimal path from start node to goal node on the graph.
The input points (start node and goal node) are first checked if they lie in the obstacle space.
If not, then the program proceeds to find the optimal path from start node to goal node using Dijkstra's algorithm.
This is implemented for both the point robot (no dimension) and the rigid robot (dimension and clearance to be considered).
The program then backtracks the optimal path and outputs it in the form of animnation using pygame
package.
-
shapely : Install shapely pacakge from python3 using the following command on the terminal
pip install shapely
-
pygame : Install pygame pacakge from python3 using the following command on the terminal
pip install pygame
-
numpy : Install numpy pacakge from python3 using the following command on the terminal
pip install numpy
-
math: Install math package from python3 using the following command on the terminal
pip install math
-
sys
-
time
The code contains two .py files
-
Dijkstra_point.py
-
Dijkstra_rigid.py
For Point Robot:
Run the code on the command line using the following command python3 Dijkstra_point.py
The user will be prompted for:
- Coordinates of the start node and the goal node
Enter x coordinate of start position: x_start
Enter y coordinate of start position: y_start
Enter x coordinate of goal position: x_goal
Enter y coordinate of goal position: y_goal
For Rigid Robot
Run the code on the command line using the following command python3 Dijkstra_rigid.py
The user will be prompted for:
-
Coordinates of the start node and the goal node
-
Radius of the robot
-
Clearance of the robot
Enter x coordinate of start position: x_start
Enter y coordinate of start position: y_start
Enter x coordinate of goal position: x_goal
Enter y coordinate of goal position: y_goal
Enter radius of the robot:
Enter clearance of the robot:
Enter x coordinate of start position: 5
Enter y coordinate of start position: 5
Enter x coordinate of goal position: 295
Enter y coordinate of goal position: 195
The time taken by the point robot to go from (5,5) to (295,195) is approximately 7 minutes 40 seconds Tested on IDE: Spyder Python version 3.7.4