Simple Robot Localization

The algorithm behind how a robot finds its location in a simple environment

All robots, from the cute little toy dogs and Roombas to self-driving cars, have to be able to understand the environment they're in and move around in it. They might use infrared sensors, lasers, or cameras to perceive their surroundings, and might use legs, wheels, or propellers to move around, but regardless of their configuration, they follow a similar cycle — gather data by sensing their environment, perform some calculation, and move.

In the interactive explainer below, we're going to see how this works in a very simplified environment. There are several characteristics that make the situation simple:

  1. The robot's world is two-dimensional
  2. The robot's movement is discrete, rather than continuous. This means that the robot instantly jumps from one cell to another, rather than drives or walks there.

The interactive below has three sections: a general overview, a walkthrough explaining the algorithm, and a playground to experiment. Enjoy!

1 / 20

Here we have a 5x5 grid with our robot (white diamond) with tiles of two colours: orange and light blue.

The dark blue circles indicate the robot's belief of where it currently is. Initially, it has no idea, so all positions are equally likely.

Luckily, the robot's equipped with a sensor.


If you liked this and would like to hear when new content is published, please subscribe below.

If you have any feedback, found bugs, or just want to reach out, feel free to DM me on Twitter or send me an email.

Subscribe to Newt Interactive

You'll only get emails when I publish new content. No spam, unsubscribe any time.