You don't know where your robot is

If you are learning about probabilistic robotics, it is always important to remember that you are working with random variables. In other words, you need to realize that—no matter how well you measured it—you are uncertain about the state of your robot. No matter what you do, you cannot know precisely where your robot is, how fast it is moving, or how it is oriented. What you can do, however, is quantify your ignorance. In other words, you can estimate just how well (or how badly) you know things.

Motivating example

To better explain why random variables are used in robotics, let’s look at an example. Suppose we are driving a robot down a road towards a wall, like in the image below.

Driving a robot towards a wall

In this example, you are standing somewhere with a joystick. When you push the joystick forward, it commands the robot to move forward at some speed . The robot has a sensor (e.g., laser rangefinder, camera, sonar) that can measure the distance to the wall . You know the distance to the wall from the start because you measured it earlier with a measuring tape. So here is the big question: what is , the position of the robot?

Listed below are a few reasons why you cannot solve for an exact answer for .

Now that we’ve accepted that we’re never going to know what is, we can do the next best thing: represent as a continuous random variable.

Continuous random variables

A continuous random variable is something that can take on any of an infinite number of possible values (e.g., the height of a pine tree, the time it takes you to read this sentence). In our above example, the position of the robot can be modelled as a continuous random variable. In other words, an infinite number values for are possible, such as 10.02 m, 11.93321 m, 9.0001 m, 9.0000000000001 m, and so on. What we are interested in is representing the likelihood of a value of occurring.

For example, suppose the true position of the robot in the above example is 5.113 m (remember, we can’t know this). If we have a good representation of the likelihood of , then it should tell us that is much more likely to be 5 m then 10 m. By far the most common representation of the likelihood of a variable in probabilistic robotics is the normal (or Gaussian) distribution, which looks something like this:

The probability density function of a normal distribution.

Don’t worry about what is just yet. A normal distribution can be specified by two numbers: and . The mean of the distribution is (it is also the median and mode, but don’t worry about this for now), which is the most likely estimate of the random variable (in other words, it is the peak of the curve). The standard deviation of the distribution is , which specifies how spread out (“wide”) the curve is.

Returning to our robot example, suppose we used our sensors to model the position of the robot as a random variable with a normal distribution. If our sensors are pretty good, we might get something like 5.2 m and 0.1 m (remember, the true position is 5.113 m). If are sensors are a little worse, maybe we’ll get something closer to 5.1 m and 0.3 m. Note that our sensors getting worse makes bigger (and the curve in the above plot “wider”).

Probability density functions

The probability density function (PDF) of the distribution of a random variable calculates the likelihood of . In other words, it is the function on the y-axis in the above plot for normal distributions. Mathematically,

Don’t worry too much about why the takes this form. Just know that given the mean and standard deviation of a random variable, results in the above plot when you plug values of .

We can use the PDF to compare the relative likelihood of the robot being at different positions. For example, given 5.1 m and 0.2 m, how much more likely is the position of the robot 5.2 m compared to 5.5 m? The answer is simply the ratio of their likelihoods; i.e.,

In other words, the position 5.2 m is approximately 6.521 more likely than 5.5 m.

Probability

The probability of a particular range of values of is an absolute measure of how likely it is that the true is in that range. A probability is a number between 0 (no chance of occurring) and 1 (is absolutely known to occur). For example, one might say “the probability that is between 4.5 and 5.5 is 0.87654”.

PDFs have the very important property that the area under the curve between two values of is the probability of that range of . As you may guess, this means that the area under the full curve (i.e., between and ), the area under the PDF is 1. More interesting is the area between non-infinite values of , such as the example shown below.

The probability density function of a normal distribution.

Suppose that in the above PDF, 5.1 m and 0.2 m. Then the highlighted area is the probability that is between 4.7 m (i.e., ) and 4.9 m (i.e., ). Recall from first year calculus that the area under a curve is calculated using integration. For the above curve, the probability of being in the given range is written as and is the definite integral of the PDF; i.e.,

Substituting in 5.1 m and 0.2 m, we get

In other words, there is a 27% chance that .

You know where your robot may be

I started off this post by emphasizing the fact that you don’t know where your robot is. The best you can do is quantify your ignorance. Parameterizing the unknown quantity (e.g., the position of the robot) as a continuous random variable is one way to do this. In probabilistic robotics, normal distributions are the most common distribution used to represent random variables, which are commonly described by its mean and standard deviation . I should note that the variance of a normal distribution is often stated in place of its standard deviation (i.e., it is literally the squared standard deviation).

So assuming you are using a normal distribution to represent the position of a robot, if someone asks “what is the position of the robot?”, some appropriate equivalent answers are:

Note that for the second answer, the integral between and is approximately 0.95 for the PDF of a normal distribution. Some insufficient answers are:

Note that a common fallacy is people mistaking the estimated mean position being close to the true position as your estimate being “good”. For example, suppose your current estimate of the robot’s position is 10.1 m and 5.5 m. Now you take out a measuring tape and measure the robot’s position to be 10.02 m. Awesome estimate right? Not necessarily! A good estimate requires that both the mean and the standard deviation to be a good representation of your current knowledge of the robot’s position. If you had great sensors, perhaps 10.1 m and 0.15 m is actually a more appropriate estimate of the robot’s position.

Always keep in mind, you don’t know where your robot is!