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.
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 .
-
Let’s say you’re clever and you timed how long the robot has been driving (let’s say it was exactly ten seconds), and you commanded the robot to drive at 1 m/s with your joystick. So since you’ve driven for ten seconds at 1 m/s, you say “Aha!, is 10 m!”. However, how sure are you that you drove for ten seconds (and not 10.001 seconds)? How sure are you that your command of 1 m/s actually resulted in the robot moving at 1 m/s (and not 0.996 m/s)? How is the robot transforming your command of 1 m/s into how fast it turns the wheels?
-
Suppose your sensor says the robot is 4.5 m from the wall, and you know from using your measuring tape that is 10 m (i.e., the distance to the wall from the start). Therefore, the position of the robot is just (10 - 4.5) m = 5.5 m, right? Well how good is that sensor? Can it tell the difference between 4.5 m and 4.52 m? How accurately did you know the position of the wall to begin with (with your measuring tape)?
-
In this example, the wall is modelled as a straight, vertical surface. What if the actual wall has a door or window? What if it has wooden trim, or pictures hanging from it? What if someone got angry that they couldn’t calculate exactly and they punched the wall, leaving a deep dent?
-
How frequently is your joystick sending the signal to the robot to move? Five times per second? 100 times per second? How quickly does a change in command result in the robot actually changing speed? How often does your measurement of the wall update? What happens if you’re driving really fast and then slam the brakes? Does your robot slide?
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
For example, suppose the true position of the robot in the above example is
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
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
In other words, the position
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.
Suppose that in the above PDF,
Substituting in
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:
- “I estimate its mean position to be
11.6 m with a standard deviation of0.5 m .” - “I am about 95% certain it is between
10.6 m and12.6 m .” - “I believe it is at
11.6 m with a variance of 0.25 m.”
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:
- “It is approximately 11.6 m.” (Missing information about uncertainty.)
- “11.6 0.5 m.” (Is 0.5 m the standard deviation?)
- “I believe it is at
11.6 m with a variance of 0.25 m.” (The units of variance should be m, making this statement confusing.)
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
Always keep in mind, you don’t know where your robot is!