You are on page 1of 50

İTÜ-EEF Dept.

Of Control Engineering

Probabilistics Methods in Robotics


(KOM 613E)

Autum Somester

Hakan Temeltas , Prof.Dr.

KOM 613E : Probabilistics Methods in Robotics 1


İTÜ-EEF Dept. Of Control Engineering

Lecture Plan
Topic Reading
Introduction and useful concepts Chap. 1,2
Bayes filter Chap. 2
The Kalman filter Chap. 3
The Extended Kalman filter Chap. 3
The Unscented Kalman filter Chap. 3
Information Filters Chap. 3
Motion models Chap. 4
Measurement models Chap. 6
KOM 613E : Probabilistics Methods in Robotics 2
İTÜ-EEF Dept. Of Control Engineering

Lecture Plan
Topic Reading
EKF Localization Chap. 7
Occupancy maps Chap. 9
Particle filters Chap. 4
Particle filters: localization Chap. 8
SLAM and Scan matching Chap. 10
EKF-SLAM Chap. 10
Graph-SLAM Chap. 11
Fast-SLAM Chap. 13
KOM 613E : Probabilistics Methods in Robotics 3
İTÜ-EEF Dept. Of Control Engineering

Course Evaluation Criteria


Method Quantity Percentage(%)

Midterm Exams __ __
Homeworks __ __
Final Exam __ __
(or Final Project)

KOM 613E : Probabilistics Methods in Robotics 6


İTÜ-EEF Dept. Of Control Engineering

References
1. Thrun, S., Burgard, W., & Fox, D. (2005). Probabilistic
robotics. Intelligent robotics and autonomous agents.
Cambridge, Mass: MIT Press.
2. Montemerlo, M., & Thrun, S. (2007). FastSLAM: A
scalable method for the simultaneous localization and
mapping problem in robotics. Springer tracts in advanced
robotics, 27. Berlin: Springer.
3. Siegwart, R., & Nourbakhsh, I. R. (2004). Introduction to
autonomous mobile robots. Intelligent robotics and
autonomous agents. Cambridge, Mass: MIT Press.
4. Thrun, S., Fox, D., Burgard, W., & Dellaert, F. (2000).
Robust Monte Carlo Localization for Mobile Robots.
Artificial Intelligence , 99-141.

KOM 613E : Probabilistics Methods in Robotics 7


İTÜ-EEF Dept. Of Control Engineering

Lecture 1: Introduction

KOM 613E : Probabilistics Methods in Robotics 9


İTÜ-EEF Dept. Of Control Engineering

“When you understand something, then


you can find the math to express that
understanding. The math doesn’t provide
the understanding.”— Lamport

KOM 613E : Probabilistics Methods in Robotics 10


İTÜ-EEF Dept. Of Control Engineering

Introduction: Why Probabilistic Robotics?


• Examples of Robotics Systems :
– Mobile Platforms,
– Industrial Robotics manipulators,
– driverless cars
– …
• Applications :
– Planetary explorations
– Assembly lines
– Robot assistive surgery
– ……
 Robotics systems accumulates enormous level
of UNCERTAINTY

KOM 613E : Probabilistics Methods in Robotics 11


İTÜ-EEF Dept. Of Control Engineering

Introduction: Why Probabilistic Robotics?


• Examples of Robotics Systems :

Motion
Perception
Control

Cognition Localization

Operator Commands Prior Knowledge


Trying to navigate in unknown environment Usually a robot
would create an internal model of this environment calculate
control signals based on this model
KOM 613E : Probabilistics Methods in Robotics 12
İTÜ-EEF Dept. Of Control Engineering

Introduction: Why Probabilistic Robotics?


In navigation problem, each component has own
uncertainty !! Due to :

1) Unpredictable environments
a) they could be dynamic, unstructured, …
2) Errors in the sensors used to detect environments
a) sensitive to environment,
b) discretization errors, …
3) Computer models themselves have errors
a) low resolution,
b) limited set of features,
c) linear approximations, …

KOM 613E : Probabilistics Methods in Robotics 13


İTÜ-EEF Dept. Of Control Engineering

Introduction: Why Probabilistic Robotics?


4) Algorithmic approximations
a) For real-time systems,
b) approximate algorithms are used which reduce
accuracy
5) Robot Actuation is unpredictable
a) control noise,
b) mechanical failure,
c) low power…

KOM 613E : Probabilistics Methods in Robotics 14


İTÜ-EEF Dept. Of Control Engineering

Introduction: Revisit Probability Theory


• X : a random variable and x denote a specific
event that X might take.
• i.e. : a coin flip, where X can take on the values
head or tail.
 p(X = x) : the probability that the
random variable X has value x
 p(X = head) = p(X = tail) = 1/2


x
 p(X = x)  1: Discrete probabilities sum to
one
 probabilities are always non-negative ( p(X = x)  0 )

KOM 613E : Probabilistics Methods in Robotics 15


İTÜ-EEF Dept. Of Control Engineering

Introduction: Revisit Probability Theory


• To simplify the notation, Use p(x) instead of
writing p(X = x)
• Continuous random variables: Take on a
continuum of values.
• All continuous random variables have probability
density functions (PDFs)
• A common density function:

“ one-dimensional normal distribution


with mean  and variance 2 ”
KOM 613E : Probabilistics Methods in Robotics 16
İTÜ-EEF Dept. Of Control Engineering

Introduction: Revisit Probability Theory


• Normal distribution is given by a Gaussian
function :  2
 1 ( x ) 
1  
p(x)=  2 
  2
2 
 2 

2 e
• This will be mostly shown : N( x;  ,  2 )
• Normal distributions over vectors are called
multivariate.
1
 1 
p( x)  det  2   exp  ( x   )  ( x   ) 
 T 1
2
 2 
 : mean vector ;  : covariance matrix
KOM 613E : Probabilistics Methods in Robotics 17
İTÜ-EEF Dept. Of Control Engineering

Introduction: Revisit Probability Theory


• PDF always integrates to 1 :

 p ( x ) dx  1
• However , a PDF is not bounded above by 1
• The following terms are identical:

“ probabiltiy ≡ probablity density ≡ pdf ”

• joint distribution of two random variables X and Y is


given by

p( x, y)  p( X  x and Y  y )

KOM 613E : Probabilistics Methods in Robotics 18


İTÜ-EEF Dept. Of Control Engineering

Introduction: Revisit Probability Theory


Continuous Random Variables :
• X takes on values in the continuum.
• p(X=x), or p(x), is a probability density function(pdf).
a function which can be integrated to obtain the
probability that the random variable takes a value in a
given interval.
b 
Pr( x  (a, b))   p( x)dx Pr( x)   p( x)dx  1
a 

• E.g. p(x)

x
KOM 613E : Probabilistics Methods in Robotics 19
İTÜ-EEF Dept. Of Control Engineering

Introduction: Revisit Probability Theory


Some Probability Density Functions :
• Uniform:

• Triangular:

KOM 613E : Probabilistics Methods in Robotics 20


İTÜ-EEF Dept. Of Control Engineering

Introduction: Revisit Probability Theory


Exponential pdf :

KOM 613E : Probabilistics Methods in Robotics 21


İTÜ-EEF Dept. Of Control Engineering

Introduction: Revisit Probability Theory


Normal (Gaussian) pdf :

KOM 613E : Probabilistics Methods in Robotics 22


İTÜ-EEF Dept. Of Control Engineering

Introduction: Revisit Probability Theory


PDF in 2 dimensions:
• p(x, y) = probability density of random
variables (X, Y ) at location (x, y) :

KOM 613E : Probabilistics Methods in Robotics 23


İTÜ-EEF Dept. Of Control Engineering

Introduction: Revisit Probability Theory


• If X and Y are independent :
p( x, y)  p( x) p( y)
• If we know that Y ’s value is y ; Then the probability,
that X’s value is x, defined conditionaly

p ( x, y )
p( x y ) 
p( y )
• If X and Y are independent :
p ( x) p ( y )
p( x y )   p ( x)
p( y )
KOM 613E : Probabilistics Methods in Robotics 24
İTÜ-EEF Dept. Of Control Engineering

Introduction: Revisit Probability Theory


• theorem of total probability:
p ( x)   p( x y ) p ( y ) : disrete case
y

p( x)   p ( x y ) p ( y )dy : continious case

• Bayes rule : Reletes contidional probability


p( x y ) and it’s inverse p( y x)

KOM 613E : Probabilistics Methods in Robotics 25


İTÜ-EEF Dept. Of Control Engineering

Introduction: Revisit Probability Theory


• Bayes Rule:

p ( y x) p ( x) p ( y x) p ( x)
p( x y )   (disrete)
p( y)  x p( y x) p( x)

p ( y x) p ( x) p ( y x) p ( x)
p( x y )   (continious)
p( y)  p( y x) p( x)

KOM 613E : Probabilistics Methods in Robotics 26


İTÜ-EEF Dept. Of Control Engineering

Introduction: Revisit Probability Theory


• Bayes rule plays an important role in
probabilistic robotics.
• If x is a quantity that we would like to infer
from y:
– probability p(x) : “prior probability distribution”
– y : “data (e.g., a sensor easurement)”
– p( x y ) : “posterior probability distribution”
• Denominator of bayes rule (p(y)) does not
depend on x
 p(y)-1 is written as a normalizer : 
KOM 613E : Probabilistics Methods in Robotics 27
İTÜ-EEF Dept. Of Control Engineering

Introduction: Revisit Probability Theory


• Bayes rule with normalizer :
p ( x y )   p ( y x) p ( x)
• The expectation of a random variable X:
E  X    xp( x) (discrete)
x

E  X    p( x)dx (continious)
• Entropy of a random variable:
H ( P)  E   log 2 p( x)    p( x) log 2 p( x)
x
(The entropy is the expected information that the value
of x carries: -log2p(x) is the number of bits required)
KOM 613E : Probabilistics Methods in Robotics 28
İTÜ-EEF Dept. Of Control Engineering

Introduction: Revisit Probability Theory


• An additional random variable (i.e. z
variable). p ( y x, z ) p ( x z )
p( x y , z ) 
p( y z )
• x and y are independed on z:
p( x, y z )  p( x z ) p( y z ) :conditional independence

• This is equavalent:
p( x z )  p( x z , y )
p( y z )  p( y z , x)
KOM 613E : Probabilistics Methods in Robotics 29
İTÜ-EEF Dept. Of Control Engineering

Introduction: Statistical Tools


• Mean (Expectation) :
– Average value
– Is the expected value of some random variable
(also known 1st moment)
– μ  EX
– μ   xp(x)dx (continuous case)
– μ  i 0 x i p(xi )
n
(discrete case)

KOM 613E : Probabilistics Methods in Robotics 31


İTÜ-EEF Dept. Of Control Engineering

Introduction: Statistical Tools


• Function Expectation :
– E[f(X)] is the expected value of f(x) where x is
drawn from X’s distribution

– Note that in general E[f(X)]  f(E[X])


– If f(x) is a linear function:

E[aX + b] = aE[X] + b

KOM 613E : Probabilistics Methods in Robotics 32


İTÜ-EEF Dept. Of Control Engineering

Introduction: Statistical Tools


• Variance :
– Is a measure of the variability of a random variable

– 
Var X   E X  μ 
2

–  2   x -  2 p(x)dx (continuous case)

σ  i 0 x i - μ  p(xi )
n
– 2 2
(discrete case)

– Note the square root of variance is the standard deviation

KOM 613E : Probabilistics Methods in Robotics 33


İTÜ-EEF Dept. Of Control Engineering

Introduction: Statistical Tools


• Covariance :
– is a measure of how much two random variables
change together.
– Cov X, Y   E X  μ Y  ν   E XY   μν

– If two variables tend to vary together (that is, when


one of them is above its expected value, then the
other variable tends to be above its expected value
too), then the covariance between the two variables
will be positive.
– when one of them is above its expected value the
other variable tends to be below its expected value,
then the covariance between the two variables will
be negative.
KOM 613E : Probabilistics Methods in Robotics 34
İTÜ-EEF Dept. Of Control Engineering

Introduction: Statistical Tools


• Covariance and correlation:
– The correlation coefficient ρxy is defined by the
ratio:

– Two variables are called uncorrelated if their


covariance is 0,
– if X and Y are normal random variables and their
correlation coefficient is 0, then they are
independent.
– Cov[X, Y ] = 0 , ρxy = 0, E[XY ] = E[X]E[Y ]

KOM 613E : Probabilistics Methods in Robotics 35


İTÜ-EEF Dept. Of Control Engineering

Introduction: Statistical Tools


• Covariance Matrix:
– Given n random variables {X1, . . . ,Xn} their
covariance matrix is defined by:

 C11  C1n 
      
C n1  C nn 


Cij  Var X i , X j 

KOM 613E : Probabilistics Methods in Robotics 36


İTÜ-EEF Dept. Of Control Engineering

Introduction: Statistical Tools


• Normal or Gaussian Distribution :
– A particularly useful pdf is the normal distribution.

Normalized Gaussian curves with expected value μ and variance σ2. The corresponding parameters are
a = 1/(σ√(2π)), b = μ, c = σ
- p(X) = (2πσ)-0.5 exp{-0.5 (x- μ)2/σ2}
- p(X) = det(2πΣ)-0.5 exp{-0.5 (x- μ)TΣ-1 (x- μ)} : where x, μ are vectors and Σ is a matrix

KOM 613E : Probabilistics Methods in Robotics 37


İTÜ-EEF Dept. Of Control Engineering

Introduction: Statistical Tools


• Multivariate Normal distributions :
– If x is a multi-dimensional vector (column vector):
x=(x1, x2, …xn}T
– the density function of the multivariate Normal
distribution s:

KOM 613E : Probabilistics Methods in Robotics 38


İTÜ-EEF Dept. Of Control Engineering

Introduction: Statistical Tools


• Bayes Formula :
P ( x, y )  P ( x | y ) P ( y )  P ( y | x ) P ( x )

P( y | x) P( x) likelihood  prior
P( x y )   : posterior
P( y ) evidence

KOM 613E : Probabilistics Methods in Robotics 41


İTÜ-EEF Dept. Of Control Engineering

Statistical Notation in Prob. Robotics


State : vector x
• A collection of all aspects of the robot and its environment
that can impact the future.
• These aspects can be static or dynamic
• we denote the state as x which is comprised of many
variables.
• the state at time t is xt
Measurements : vector z (the state at time t is zt)
• provides information about a momentary state of the
environment (camera images, range scans,…)
Control Inputs : vector u (the control at time t is ut)
• carry information about the change of state in the
environment (the velocity of a robot.)
KOM 613E : Probabilistics Methods in Robotics 45
İTÜ-EEF Dept. Of Control Engineering

Introduction:
Statistical Notation in Prob. Robotics
Typical state variables include:
• Pose – location and orientation relative to a global
coordinate frame. Rigid mobile robots have up to 6
variables max. 3 for planar.
• Configuration – more often used in manipulators, includes
the joint angles of revolute joints
• Velocities - Rigid mobile robots have up to 6 variables max.
3 for planar. (one for each pose variable)
• Feature locations – E.g. tree, wall, etc. They can be just x,y
or full pose. There can from 1 to several billion features.
• Landmarks – features that are static, distince and
recognized reliably.
KOM 613E : Probabilistics Methods in Robotics 46
İTÜ-EEF Dept. Of Control Engineering

Introduction:
State Estimation Example
• Problem: detect if a door open or closed?
• Have some measurement z
• Rephrase problem: What is the probability
that the door is open given z?
What is P(open|z)?

KOM 613E : Probabilistics Methods in Robotics 47


İTÜ-EEF Dept. Of Control Engineering

Introduction:
State Estimation Example
• Method: We note that Problem:
– P(open|z) is diagnostic knowledge
– P(z|open) is causal knowledge
– Often causal knowledge is easier to obtain
– Bayes rule allows us to use one to calculate the other:

P( z | open) P(open)
P(open | z ) 
P( z )

KOM 613E : Probabilistics Methods in Robotics 48


İTÜ-EEF Dept. Of Control Engineering

Introduction:
State Estimation Example
Sample Data :
• P(z|open) = 0.6 P(z|open) = 0.4
• P(open) = P(open) = 0.5

P( z | open) P(open)
P(open | z ) 
P( z | open) p(open)  P( z | open) p(open)
0.6  0.5 3
P(open | z )    0.6
0.6  0.5  0.4  0.5 5

• z raises the probability that the door is open


KOM 613E : Probabilistics Methods in Robotics 49
İTÜ-EEF Dept. Of Control Engineering

Introduction:
Combining Evidence :
• Suppose our robot obtains another observation
z2.
• How can we integrate this new information?
• More generally, how can we estimate
P(x| z1...zn )?

Recursive Bayesian Updating

P( zn | x, z1,, zn  1) P( x | z1,, zn  1)
P( x | z1,, zn) 
P( zn | z1,, zn  1)
KOM 613E : Probabilistics Methods in Robotics 50
İTÜ-EEF Dept. Of Control Engineering

Introduction:
Markov assumption:
• zn is independent of z1,...,zn-1 if we know x.
P( zn | x)P( x | z1,  , zn  1)
P ( x | z1, , zn) 
• x P( zn | z1, , zn  1)
  P( zn | x)P( x | z1,  , zn  1)
 1...n[  P( zi | x)]P( x)
i 1...n

An equivalent statement to the above is:


“The future is independent of the past if the
present is known. ”
KOM 613E : Probabilistics Methods in Robotics 51
İTÜ-EEF Dept. Of Control Engineering

Introduction:
State Estimation Example 3
• Consider closing the door problem
• pdf is depicted as STATE TRANSITION:
P(x|u,x’) for u = “close door”:

0. 9
0. 1 open cl osed 1
0
• If the door is open, the action “close door”
succeeds in 90% of all cases.
KOM 613E : Probabilistics Methods in Robotics 56
İTÜ-EEF Dept. Of Control Engineering

Introduction:
• Given probability of current state x’, and a control
input u, we can calculate the probability of new
state x by integrating over all possible paths to get
to x.
• Continuous case:

P( x | u)   P( x | u, x' ) P( x' )dx'


• Discrete case:

P( x | u )   P( x | u , x' ) P( x' )
KOM 613E : Probabilistics Methods in Robotics 57
İTÜ-EEF Dept. Of Control Engineering

Introduction:
Bayes Filters: Framework
Given :
• Stream of observaions z and action data u:
dt={u1, z1,…., ut, zt}
• Sensor model : P(z  x)
• Motion model : P(x  u,x’)
• Prior probability of system state P(x).
Desired :
• Estimate of state x of a dynamical system
• Posterior of the state also called Belief :
Bel(xt)=P(xt  u1, z1,…., ut, zt )
KOM 613E : Probabilistics Methods in Robotics 59
İTÜ-EEF Dept. Of Control Engineering

Introduction: Bayes Filters


Markov Assumption :
• Using the Markov Assumption, we can view the estimation
process as:

p( zt | x0:t , z1:t , u1:t )  p( zt | xt ) p( xt | x1:t 1 , z1:t , u1:t )  p( xt | xt 1 , ut )


Underlying Assumptions
• Static world
• Independent noise
• Perfect model, no approximation errors
KOM 613E : Probabilistics Methods in Robotics 60
İTÜ-EEF Dept. Of Control Engineering

Introduction: Bayes Filters


Bel ( xt )   P( zt | xt )  P( xt | ut , xt 1 ) Bel ( xt 1 ) dxt 1
1. Algorithm Bayes_filter( Bel(x),d ):
2. 0
3. If d is a perceptual data item z then
4. For all x do
5. Bel ' ( x)  P( z | x) Bel ( x)
6.     Bel ' ( x)
7. For all x do
8. Bel ' ( x)   1Bel ' ( x)
9. Else if d is an action data item u then
10. For all x do
11. Bel ' ( x)   P( x | u, x' ) Bel ( x' ) dx'
12. Return Bel’(x)

KOM 613E : Probabilistics Methods in Robotics 62


İTÜ-EEF Dept. Of Control Engineering

Introduction: Bayes Filters


Bayes Filters are Familiar! :
Bel ( xt )   P( zt | xt )  P( xt | ut , xt 1 ) Bel ( xt 1 ) dxt 1

• Kalman filters
• Particle filters
• Hidden Markov models
• Dynamic Bayesian networks
• Partially Observable Markov Decision
Processes (POMDPs)

KOM 613E : Probabilistics Methods in Robotics 63


İTÜ-EEF Dept. Of Control Engineering

Summary
• Bayes rule allows us to compute probabilities
that are hard to assess otherwise.
• Under the Markov assumption, recursive
Bayesian updating can be used to efficiently
combine evidence.
• Bayes filters are a probabilistic tool for
estimating the state of dynamic systems.

KOM 613E : Probabilistics Methods in Robotics 64


İTÜ-EEF Dept. Of Control Engineering

Next class…

• State Estimation by Gaussian Filter : Kalman


Filters(KF) and Extended Kalman Filters (EKF).

have any questions or concerns!

KOM 613E : Probabilistics Methods in Robotics 65

You might also like