Git Product home page Git Product logo

dijkstra-path-planner's Introduction

Dijkstra-Path-Planner

An implementation of Dijkstra's Algorithm to plan optimal paths between a known starting and goal position in an obstacle-ridden 1200*500 grid world.

Overview

On giving start and goal location coordinates, the path planner computes the shortest path using Dijkstra's Algorithm while avoiding obstacles (with a clearance of 5 mm).

On finding the final path, the planner makes a video with intermediate frames and displays it as a pop-up animation.

A video simulating the planner computing the optimal trajectory can be found as sample_video.mp4. Further, the final path visualization in the map looks as shown below. The black represents obstacles, gray represents obstacle and wall clearance, and the white areas are open space. The blue filled gridcells have already been explored by the planner and the final optimal path is shown in green.

This project majorly uses PyGame for generating the visualiziation and OpenCV and ImageIO for displaying the animation.

Dependencies

The dependencies for this Python 3 project include the following:

  • NumPy
  • PyGame
  • OpenCV
  • ImageIO (amd imageio-ffmpeg)
They can be installed using the following commands.
    pip3 install numpy
    pip3 install pygame
    pip3 install opencv-python
    pip3 install imageio
    pip3 install imageio-ffmpeg

Running the Code

To run the code, execute the following command

    python3 main.py

On doing so, the terminal should prompt for the coordinate positions of start and goal locations which the user has to enter. Note a couple points:

  • Enter integer values
  • Use the coordinate system considering the bottom-left of the window/map as the origin
  • If any of the coordinate locations you have enetered is not valid i.e. out of map bounds, or within an obstacle/its clearance, you will be prompted to enter all the coordinate locations again till they are valid. Note that even the walls/boundaries of the grid world have a clearance of 5 grid cells.

A sample set of start and goal positions to enter (that goes from one corner of the grid to the other) include the one below. This particular case can execute within 15-55 seconds depending upon system specifications.

  • Start Position: (6,494)
  • Goal Position: (1194,6)

After the program accepts your start and goal locations, it will start computing the path.It will keep on adding intermediate frames to a newly created animation_frames directory. Ater computing the final path, it will generate and display a video sample_video.mp4from the saved frames and delete all the individual frames themselvers along with the animation_frames directory. The total time taken to run Dijkstra's Algorithm will be displayed to the terminal as well

dijkstra-path-planner's People

Contributors

vikrams169 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.