# Localization Demo

This applet shows how hidden Markov models can be used for robot localization (determining where a robot is based on sensor information).

There are 16 locations (numbered from 0 to 15) that go in a circle (location 0 is immediately right of location 15). There are doors at locations 2, 4, 7 and 11. There is a light at position 10.

The graphs above show the probability distribution for each of the 16 locations (numbered in red). The probabilities are given in black. The distribution is updated by the robot sensing and by it moving.

The **sensing model** is

*P(sense door | at door) = 0.8*and*P(sense door | not at door) = 0.1*. The button "observe door" tells the applet a door is observed. The button "No Door" tells the applet than no door was observed. You can see the distribution by pressing "Show Door Dist".- There is also a probability of sensing the light, such that
*P(observe light | position 10)=0.99*, etc. To display this press "Show Light Dist", this gives Probability the robot will observe light for each location.

The **dynamics** is specified by,

- for the action
*move right*(here labelled "Right"), the agent stays still with probability 0.1, moves one step right with probability 0.8, moves two steps right with probability 0.074 and moves to any other location with probability 0.002 (this accounts for someone picking up and moving the robot). - The action
*move left*(labelled "Left") has the same distribution but moves left, not right.

To use this applet, pretend you have the robot at a particular position and are moving it around and observing the world. Tell the applet the robots movements and when the robot can sense a door and sense no door. Do (at most) one sensing action between each movement. See if the applet can track the robot. What happens if you make some sensing errors? What if you don't get any sensing readings for a number of steps? Does adding observations of the light as well as the door at each step help track the robot?

The button "know location" picks a location at random and pretends the robot knows it is as that location.

This applet was written by David Poole based on an example of Sebastian Thrun. You can download the Java code (which is copyright David Poole. Please contact me if you want to modify it for anything but your own personal use).

Copyright © David Poole, 2008. This web page and applet are released under a Creative Commons Attribution-Noncommercial-Share Alike license.