Dijkstra算法求解机器人路径规划问题Python程序
立即下载
资源介绍:
Dijkstra算法是一种解决单源最短路径问题的算法,适用于带权的有向图或无向图。它采用贪心策略,逐步找到从源点到其他所有顶点的最短路径。
Dijkstra算法的基本思路是以起始点为中心,向外层层扩展,直到覆盖所有顶点。算法维护一个距离数组(通常记为dis),用来记录源点到每个顶点的最短距离估计,以及一个集合(通常记为S),用来存放已经确定最短路径的顶点。初始时,源点的路径权重赋为0,如果存在直接到达的边,则将邻接顶点的路径长度设为边的权重;对于不存在直接到达的边,则将路径长度设为无穷大。算法不断选取距离最短且未处理过的顶点,更新其邻接顶点的距离,直到所有顶点的最短路径都已确定。
# DIJKSTRA - Path Planning Algorithm for a Point Robot
The task was to designing a point robot that would traverse a map where the obstacels are already known to us.
We have a point robot that can move in eight directions and each action would have its respective costs.
![Action Set](./images/Action_Set.jpg)
## Defining the map
We use the concepts of Algebraic Half planes to define the free space and the obstacles.
![Obstacle Map](./images/Obstacle_Map.png)
## Exploring the Map
Use the defined actions set and as per the cost for each step, we traverse the graph
```
Action Sets = {(1,0), (-1,0), (0,1), (0,-1), (1,1), (-1,1),(1,-1),(-1,-1)}
```
In each action set generated we check if the new position is going to end up in the obstacle space.
![Exploration Map](./images/Exploration_Map.png)
## Optimal path
After we explore the entire map, we use backtracking to find the path with the least cost.
The operation of the algorithm is shown below.
![Shortest Path Map](./images/Shortest_Path_Map.png)
## Usage
* Clone the repo to your local machine
```
git clone https://github.com/HemanthJoseph/Dijkstra-Path-Planning-Point-Robot.git
```
* Change Directory
```
cd Dijkstra_Algorithm
```
* Run the python file
```
python Dijkstra.py
```
* In the command line enter the inputs values for start and goal coordinates and ensure that the points don't fall in the obstacles as the program will keep prompting you to enter points that aren't in the obstacle space.
## Dependencies and libraries
1. Python 3
2. Matplotlib
3. Queue
## Video Link
https://drive.google.com/file/d/1XJp1R0PteTrX_R4la_C7ffUnGrDoOqul/view?usp=share_link