GithubHelp home page GithubHelp logo

ferrix / particle_filter_demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jtosey/particle_filter_demo

3.0 2.0 0.0 83 KB

Example of a simple particle filter for robot location, Stanford's Intro to AI

particle_filter_demo's Introduction

I forked the original python demo in an attempt to make the filter
as close to the algorithm presented in class as possible.  I can now
compare the algorithm, line-for-line, with the lecture notes presented
in 11-20.

In this demo, the robot location is a green turtle, and the estimated
location of the robot (once the particles converge) is shown as a red
turtle.

I hope this helps you!  I found by playing around with this code gave me
a much better understand exactly how this algorithm works.  I encourage
you to do the same.

The code works substantially the same way, but probably performs a
little worse and is a little less efficient than Martin's original
implementation, but is more faithful to the 11-20.

With only a single sensor, and a fairly symmetric world, the robot
sometimes converges to the wrong location even with thousands of particles
because it can get the same correlation of readings in multiple parts of the
maze.  I've extended the filter with an algorithm that continuously checks
whether the estimate has converged, and whether it continues to produce
measurements that are strongly correlated with the robot.  If it has a
converged solution (low geographcial dispersion) but the weighted
measurements show poor correlation, we have to assume that it converged
to the wrong locale.  In this case we reset the filter to new random
initial conditions and start again.

 - jrt

----
Original comments:

  This is a very simple particle filter example prompted by
Stanford's Intro to AI lectures.

  A robot is placed in a maze. It has no idea where it is, and
its only sensor can measure the approximate distance to the nearest
beacon (yes, I know it's totally weird, but it's easy to implement).
Also, it shows that even very simple sensors can be used, no need
for a high resolution laser scanner.

  In the arena display the robot is represented by a small green
turtle and its beliefs are red/blue dots. The more a belief matches
the current sensor reading, the more the belief's colour changes to
red. Beacons are little cyan dots.

  The robot then starts to randomly move around the maze. As it
moves, its beliefs are updated using the particle filter algorithm.
After a couple of moves, the beliefs converge around the robot. It
finally knows where it is!

  Particle filters really are totally cool...


  Start the simulation with:

    python particle_filter.py

  Feel free to experiment with different mazes, particles counts, etc.



  Enjoy!

        mjl

particle_filter_demo's People

Stargazers

Ferrix Hovi avatar

Watchers

Ferrix Hovi avatar James Cloos 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.