Simulates a simple robot using Bayes Filter to localize itself on a map
Updated 13 Feb 2015

View License

Demonstrates using Bayes Filter to localize a robot using a motion model and a noisy wall sensor. The environment is simple: a unit-size robot in a grid world composed of obstacles or free spaces. The robot has five actions: {left,up,right,down,scan} for moving in the cardinal directions or scanning the environment.
The robot is low quality and so moves probabilistically, as described in the function moveRobot()

Similarly, the scanner is low quality. The 'scanner' approximates 4 capacitive sensors that detect (with some probability of error) if a wall adjacent to the current cell. This is described in the function applyScan().

The robot is moved by using the arrow keys. The screen displays the probability mass function, the obstacles, and you can hide/unhide the robot by pressing the 'h' key.

Based on algorithm "Algorithm Bayes_filter" on page 27 of book "Probabilistic Robotics",

Cite As

Aaron T. Becker's Robot Swarm Lab (2024). SimpleRobotWithBayesRule() (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes