GithubHelp home page GithubHelp logo

anthrax3 / path_planning_demo_live Goto Github PK

View Code? Open in Web Editor NEW

This project forked from llsourcell/path_planning_demo_live

0.0 0.0 0.0 131 KB

This is the code for the "How to Make a Path Planning Algorithm Easily " live session by @Sirajology on Youtube

License: MIT License

Python 100.00%

path_planning_demo_live's Introduction

Obstacle-Detection-and-Path-Planning

#Overview

This is the code for this video on youtube by @sirajology .Path planning is a technique used for find the shortest path between a source and destination. Path planning ensures that navigation is done in least time and in most optimized way, saving energy and providing a optimized way of the doing task.

We have a set of test images, each containing

  1. 10x10 grid, making 100 squares
  2. Obstacles marked as black square
  3. Objects defined by three features, viz. Shape, Size and Color

The squares are identified by the coordinate (x,y) where x is the column and y is the row to which the square belongs. Each square can be empty or have an Obstacle or have an Object.

The program returns 2 major findings:

  1. The coordinates of occupied grid:

    The code returns a python list having ‘n’ python tuples, where ‘n’ denotes number of occupied grid in test image. Grid is to be considered occupied if either grid has an Obstacle or an Object. Each tuple has two elements, first element is the x-coordinate of an Obstacle/Object and second element is the y-coordinate of the Obstacle.

  2. The minimum path:

    For each object in the test images, a matching object which is nearest to it is found using compare_ssim function from scikit-image. Object is said to be nearest to another Object, if length of path traversed between two objects is smallest. Traversal is done by moving either horizontally or vertically. The length of the path is determined by the number of moves made during traversal. A* search is used to find this shortest path.

The code return a python dictionary. Format for creating dictionary is as follows:

  • Key for dictionary is a tuple - (x,y) coordinate of an Object
  • first element of dictionary is a tuple - (x,y) coordinate of an object nearest to it
  • second element is a list of tuples having (x,y) coordinate of all grids traversed i.e all route path
  • third element of dictionary should be number of moves taken for traversal

##Dependencies

Use pip to install.

  1. Install OpenCV for Python

    For Windows

    For Ubuntu

Install skimage (or scikit-image) Open command prompt and type in: pip install scikit-image

Install numpy Open command prompt and type in: pip install numpy

#Usage

Run main.py to check the results. You can edit the test image from main.py to see different results.

The process_image.py contains the major code. Check that script to see the main functionality. Follow the comments to undertand the code better.

astarsearch.py contains the implemenatation of A* search algo. traversal.py contains the script to traverse through the image to find objects/min path.

#Credits

The credits for this code go to Annirudha i've merely created a wrapper to get people started.

path_planning_demo_live's People

Contributors

llsourcell 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.