Top Banner
Filtering and Estimation for Mobile Robots Nathan Michael MEAM 620 Spring, 2008 University of Pennsylvania Philadelphia, Pennsylvania
236

Filtering and Estimation With Builds

Dec 23, 2015

Download

Documents

arafatasghar

Part of a series handouts on Upenn's Courseware on Advanced Robotics.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Filtering and Estimation With Builds

Filtering and Estimation for Mobile Robots

Nathan MichaelMEAM 620Spring, 2008

University of PennsylvaniaPhiladelphia, Pennsylvania

Page 2: Filtering and Estimation With Builds

Reference

Page 3: Filtering and Estimation With Builds

Outline

• Kinematic Model of a Mobile Robot

• Kalman Filter

• Extended Kalman Filter

• Unscented Kalman Filter

• Particle Filter

Page 4: Filtering and Estimation With Builds

Outline

• Kinematic Model of a Mobile Robot

• Kalman Filter

• Extended Kalman Filter

• Unscented Kalman Filter

• Particle Filter

Page 5: Filtering and Estimation With Builds

Mobile Robot Model

t1

t0

Page 6: Filtering and Estimation With Builds

Mobile Robot Model

t1

t0

Differential Drive

v!

(x, y)

!l

!r

!

Page 7: Filtering and Estimation With Builds

Mobile Robot Model

t1

t0

Differential Drive

!r – Right wheel orientation!l – Left wheel orientation

v!

(x, y)

!l

!r

!

Page 8: Filtering and Estimation With Builds

Mobile Robot Model

t1

t0

Differential Drive

! – Robot orientation(x, y) – Robot center position

!r – Right wheel orientation!l – Left wheel orientation

v!

(x, y)

!l

!r

!

Page 9: Filtering and Estimation With Builds

Mobile Robot Model

t1

t0

Differential Drive

! – Robot orientation(x, y) – Robot center position

!r – Right wheel orientation!l – Left wheel orientation

v – Linear velocity! – Angular velocity

v!

(x, y)

!l

!r

!

Page 10: Filtering and Estimation With Builds

Mobile Robot Model

t1

t0

Differential Drive

! – Robot orientation(x, y) – Robot center position

!r – Right wheel orientation!l – Left wheel orientation

v – Linear velocity! – Angular velocity

Pose

v!

(x, y)

!l

!r

!

Page 11: Filtering and Estimation With Builds

Mobile Robot Model

t1

t0

Differential Drive

! – Robot orientation(x, y) – Robot center position

!r – Right wheel orientation!l – Left wheel orientation

v – Linear velocity! – Angular velocity

Pose

Kinematic Velocities

v!

(x, y)

!l

!r

!

Page 12: Filtering and Estimation With Builds

Mobile Robot Model

t1

t0

!

(x, y)

!l

!r

Page 13: Filtering and Estimation With Builds

Mobile Robot Model

t1

t0

!

(x, y)

!l

!r

d!

dt=

r

b

!d!r

dt! d!l

dt

"Wheel radius

Wheel base

Page 14: Filtering and Estimation With Builds

Mobile Robot Model

t1

t0

!

(x, y)

!l

!r

d!

dt=

r

b

!d!r

dt! d!l

dt

"Wheel radius

Wheel basedx

dt=

r cos !

2

!d!l

dt+

d!r

dt

"

dy

dt=

r sin !

2

!d!l

dt+

d!r

dt

"

Page 15: Filtering and Estimation With Builds

Mobile Robot Model

t1

t0

xt = xt!1 + !x

yt = yt!1 + !y

Discrete State Updates

!t = !t!1 + !!

Page 16: Filtering and Estimation With Builds

Mobile Robot Model

t1

t0

xt = xt!1 + !x

yt = yt!1 + !y

Discrete State Updates

R

Treat discrete changes as motions along circles of constant radius

!t = !t!1 + !!

Page 17: Filtering and Estimation With Builds

Mobile Robot ModelDiscrete State Updates

xc = x! v

!sin "

R

R =!!!v

!

!!!

v = R!(xc, yc)

yc = y +v

!cos "

Page 18: Filtering and Estimation With Builds

Mobile Robot ModelDiscrete State Updates

R

(xc, yc)xt = xt!1 + !x

yt = yt!1 + !y

!t = !t!1 + !!

Page 19: Filtering and Estimation With Builds

Mobile Robot ModelDiscrete State Updates

R

(xc, yc)xt = xt!1 + !x

yt = yt!1 + !y

!t = !t!1 + !!

?

Page 20: Filtering and Estimation With Builds

Mobile Robot ModelDiscrete State Updates

R

(xc, yc)xt = xt!1 + !x

yt = yt!1 + !y

!t = !t!1 + !!

!

"xt

yt

!t

#

$ =

!

"xc,t!1 + v

! sin (!t!1 + "!t)yc,t!1 ! v

! cos (!t!1 + "!t)!t!1 + "!t

#

$

?

Page 21: Filtering and Estimation With Builds

t1

t0

Velocity model

v = v + !v

! = ! + "!

yt = yt!1 +v

!cos "t!1 !

v

!cos("t!1 + !!t)

xt = xt!1 !v

!sin "t!1 +

v

!sin("t!1 + !!t)

!t = !t!1 + "!t + #!!t

Mobile Robot Model

Page 22: Filtering and Estimation With Builds

t1

t0

Velocity model

v = v + !v

! = ! + "!

yt = yt!1 +v

!cos "t!1 !

v

!cos("t!1 + !!t)

xt = xt!1 !v

!sin "t!1 +

v

!sin("t!1 + !!t)

!t = !t!1 + "!t + #!!t

Gaussian noise

Mobile Robot Model

Page 23: Filtering and Estimation With Builds

t1

t0

Velocity model

v = v + !v

! = ! + "!

yt = yt!1 +v

!cos "t!1 !

v

!cos("t!1 + !!t)

xt = xt!1 !v

!sin "t!1 +

v

!sin("t!1 + !!t)

!t = !t!1 + "!t + #!!t

Gaussian noise

Why?

Mobile Robot Model

Page 24: Filtering and Estimation With Builds

Outline

• Kinematic Model of a Mobile Robot

• Kalman Filter

• Extended Kalman Filter

• Unscented Kalman Filter

• Particle Filter

Page 25: Filtering and Estimation With Builds

Kalman Filter

• Linear system model with Gaussian noise

• Moments parameterization

• First moment - mean

• Second moment - covariance

Page 26: Filtering and Estimation With Builds

Kalman Filter

• Linear system model with Gaussian noise

• Moments parameterization

• First moment - mean

• Second moment - covariance

What if the system isnonlinear?

Page 27: Filtering and Estimation With Builds

Kalman Filter

• Linear system model with Gaussian noise

• Moments parameterization

• First moment - mean

• Second moment - covariance

Is this a reasonable characterization of the system?

What if the system isnonlinear?

Page 28: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Kt = !tCTt (Ct!tC

Tt + Qt)!1

Page 29: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

That’s it, only five equations.

Kt = !tCTt (Ct!tC

Tt + Qt)!1

Page 30: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Prediction

Kt = !tCTt (Ct!tC

Tt + Qt)!1

Page 31: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Prediction

Where should the state be at this point?

Kt = !tCTt (Ct!tC

Tt + Qt)!1

Page 32: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

Linear system model

Page 33: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut System input

Page 34: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut System input

System covariance

Page 35: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

We are stating that the system process behaves based on the following assumption:

p(xt | ut, xt!1) =e!

12 (xt!Atxt!1!Btut)

T R!1t (xt!Atxt!1!Btut)

det(2!Rt)12

Page 36: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + BtutProcess model

We are stating that the system process behaves based on the following assumption:

p(xt | ut, xt!1) =e!

12 (xt!Atxt!1!Btut)

T R!1t (xt!Atxt!1!Btut)

det(2!Rt)12

Page 37: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

At this point, the filter parameters are:• First and second moments• System process model• State update• Input update• Process noise

Page 38: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

At this point, the filter parameters are:• First and second moments• System process model• State update• Input update• Process noise

Page 39: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

At this point, the filter parameters are:• First and second moments• System process model• State update• Input update• Process noise

Not always constant,consider adaptive filters for

unknown process noise.

Page 40: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

Example:u = [x, y]T

µt = µt!1 + [x!t, y!t]TA = I2, B = !tI2, Rt = diag(!2

1 , !22)

!t = !t!1 + diag(!21 , !2

2)

Page 41: Filtering and Estimation With Builds

Example:u = [x, y]T

µt = µt!1 + [x!t, y!t]TA = I2, B = !tI2, Rt = diag(!2

1 , !22)

!t = !t!1 + diag(!21 , !2

2)

!1

!2x

y

Equipotentialellipse

Page 42: Filtering and Estimation With Builds

Example:u = [x, y]T

µt = µt!1 + [x!t, y!t]TA = I2, B = !tI2, Rt = diag(!2

1 , !22)

!t = !t!1 + diag(!21 , !2

2)

!1

!2x

y

Equipotentialellipse t = 0

!0 = I2µ0 = [0, 0]T

Page 43: Filtering and Estimation With Builds

Example:u = [x, y]T

µt = µt!1 + [x!t, y!t]TA = I2, B = !tI2, Rt = diag(!2

1 , !22)

!t = !t!1 + diag(!21 , !2

2)

!1

!2x

y

Equipotentialellipse t = 0

!0 = I2µ0 = [0, 0]T

t = 1

µ1

!1

Page 44: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Measurementupdate

Kt = !tCTt (Ct!tC

Tt + Qt)!1

Page 45: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Kalman gain

Kt = !tCTt (Ct!tC

Tt + Qt)!1

Page 46: Filtering and Estimation With Builds

Kalman Filter(algorithm)

Kalman gain

Kt = !tCTt (Ct!tC

Tt + Qt)!1

How much weight should be given to the prediction versus the measurement?

Page 47: Filtering and Estimation With Builds

Kalman Filter(algorithm)

Kalman gain

Kt = !tCTt (Ct!tC

Tt + Qt)!1

How much weight should be given to the prediction versus the measurement?

More parameters to consider:• Linear measurement model• Measurement noise

Page 48: Filtering and Estimation With Builds

Kalman Filter(algorithm)

Kalman gain

Kt = !tCTt (Ct!tC

Tt + Qt)!1

How much weight should be given to the prediction versus the measurement?

More parameters to consider:• Linear measurement model• Measurement noise

Page 49: Filtering and Estimation With Builds

Kalman Filter(algorithm)

Kt = !tCTt (Ct!tC

Tt + Qt)!1

The measurement of the state behaves based on the following assumption:

p(zt | xt) =e!

12 (zt!Ctxt)

T Q!1t (zt!Ctxt)

det(2!Qt)12

Page 50: Filtering and Estimation With Builds

Kalman Filter(algorithm)

µt = µt + Kt(zt ! Ctµt)

Kt = !tCTt (Ct!tC

Tt + Qt)!1

Innovation

What is the error between the actual and predicted measurements?

Page 51: Filtering and Estimation With Builds

Kalman Filter(algorithm)

µt = µt + Kt(zt ! Ctµt)

Kt = !tCTt (Ct!tC

Tt + Qt)!1

As a thought exercise, what if we have a perfect measurement model

and state feedback?

Page 52: Filtering and Estimation With Builds

Kalman Filter(algorithm)

µt = µt + Kt(zt ! Ctµt)

Kt = !tCTt (Ct!tC

Tt + Qt)!1

As a thought exercise, what if we have a perfect measurement model

and state feedback?

Ct = IN , Qt = 0N ! Kt = IN , µt = zt

Page 53: Filtering and Estimation With Builds

Kalman Filter(algorithm)

µt = µt + Kt(zt ! Ctµt)

Kt = !tCTt (Ct!tC

Tt + Qt)!1

As a thought exercise, what if we have a perfect measurement model

and state feedback?

Ct = IN , Qt = 0N ! Kt = IN , µt = zt

Page 54: Filtering and Estimation With Builds

Kalman Filter(algorithm)

Kt = !tCTt (Ct!tC

Tt + Qt)!1

!t = (I !KtCt)!t

How does the error of the measurement model differ from the predicted error?

Page 55: Filtering and Estimation With Builds

Kalman Filter(algorithm)

Kt = !tCTt (Ct!tC

Tt + Qt)!1

!t = (I !KtCt)!t

Consider again if we have perfect measurements.

Page 56: Filtering and Estimation With Builds

Kalman Filter(algorithm)

Kt = !tCTt (Ct!tC

Tt + Qt)!1

!t = (I !KtCt)!t

Consider again if we have perfect measurements.

Ct = IN , Kt = IN ! !t = 0N

Page 57: Filtering and Estimation With Builds

Kalman Filter(algorithm)

Kt = !tCTt (Ct!tC

Tt + Qt)!1

!t = (I !KtCt)!t

Consider again if we have perfect measurements.

Ct = IN , Kt = IN ! !t = 0N

Clearly perfect information means there is no error, so the error is degenerate (a point).

Page 58: Filtering and Estimation With Builds

This is just a thought exercise!

Kalman Filter(algorithm)

Kt = !tCTt (Ct!tC

Tt + Qt)!1

!t = (I !KtCt)!t

Consider again if we have perfect measurements.

Ct = IN , Kt = IN ! !t = 0N

Page 59: Filtering and Estimation With Builds

Kalman Filter(algorithm)

Example (cont.):

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Kt = !tCTt (Ct!tC

Tt + Qt)!1

Ct = I2, Qt = diag(!21, !22)

Page 60: Filtering and Estimation With Builds

Example (cont.):

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Kt = !tCTt (Ct!tC

Tt + Qt)!1

Ct = I2, Qt = diag(!21, !22)

Kt = !t(!t + Qt)!1

= (!t!1 + diag(!21 , !2

2)) ·(!t!1 + diag(!2

1 + "21, !22 + "22))

!1

Page 61: Filtering and Estimation With Builds

Kt = !t(!t + Qt)!1

= (!t!1 + diag(!21 , !2

2)) ·(!t!1 + diag(!2

1 + "21, !22 + "22))

!1

µt = (I2 !Kt)µt + Ktzt

!t = (I2 !Kt)!t

µt = µt!1 + [x!t, y!t]T

!t = !t!1 + diag(!21 , !2

2)

Example (cont.):

Page 62: Filtering and Estimation With Builds

t = 0

!0 = I2µ0 = [0, 0]T

t = 1

µ1

!1

Prediction

Page 63: Filtering and Estimation With Builds

t = 0

!0 = I2µ0 = [0, 0]T

t = 1

µ1

!1

Prediction

µ1

!1

zt

Qt

Measurement

Page 64: Filtering and Estimation With Builds

t = 0

!0 = I2µ0 = [0, 0]T

t = 1

µ1

!1

!1 µ1

Prediction

µ1

!1

zt

Qt

Measurement

Page 65: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

What about computational complexity?

Kt = !tCTt (Ct!tC

Tt + Qt)!1

Page 66: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

What about computational complexity?

Kt = !tCTt (Ct!tC

Tt + Qt)!1 N = 2?

Page 67: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

What about computational complexity?

Kt = !tCTt (Ct!tC

Tt + Qt)!1 N = 2?

N = 210?

Page 68: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

What about computational complexity?

Kt = !tCTt (Ct!tC

Tt + Qt)!1 N = 2?

N = 210?

What about global

uncertainty?

Page 69: Filtering and Estimation With Builds

Kalman Filter(algorithm)

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

What about computational complexity?

Kt = !tCTt (Ct!tC

Tt + Qt)!1

What if we redefine the parameterization?

N = 2?N = 210?

What about global

uncertainty?

Page 70: Filtering and Estimation With Builds

Re-parameterization

! =" !1

Information matrix

Page 71: Filtering and Estimation With Builds

Re-parameterization

! =" !1

Information matrix

! = !!1µInformation vector

Page 72: Filtering and Estimation With Builds

Information Filter(algorithm)

!t = !t(At!!1t!1!t!1 + Btut)

!t = CTt Q!1

t Ct + !t

!t = CTt Q!1

t zt + !t

!t = (At!!1t!1A

Tt + Rt)!1

Page 73: Filtering and Estimation With Builds

Information Filter(algorithm)

!t = !t(At!!1t!1!t!1 + Btut)

!t = CTt Q!1

t Ct + !t

!t = CTt Q!1

t zt + !t

!t = (At!!1t!1A

Tt + Rt)!1

Prediction

Page 74: Filtering and Estimation With Builds

Information Filter(algorithm)

!t = !t(At!!1t!1!t!1 + Btut)

!t = CTt Q!1

t Ct + !t

!t = CTt Q!1

t zt + !t

!t = (At!!1t!1A

Tt + Rt)!1

Prediction

Measurement

Page 75: Filtering and Estimation With Builds

KF/IF Comparison

!t = !t(At!!1t!1!t!1 + Btut)

!t = CTt Q!1

t Ct + !t

!t = CTt Q!1

t zt + !t

!t = (At!!1t!1A

Tt + Rt)!1

Information Filter

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Kt = !tCTt (Ct!tC

Tt + Qt)!1

Kalman Filter

! =" !1 ! = !!1µReminder:

Page 76: Filtering and Estimation With Builds

KF/IF Comparison

!t = !t(At!!1t!1!t!1 + Btut)

!t = CTt Q!1

t Ct + !t

!t = CTt Q!1

t zt + !t

!t = (At!!1t!1A

Tt + Rt)!1

Information Filter

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Kt = !tCTt (Ct!tC

Tt + Qt)!1

Kalman Filter

!t = "!1t

! =" !1 ! = !!1µReminder:

Page 77: Filtering and Estimation With Builds

KF/IF Comparison

!t = !t(At!!1t!1!t!1 + Btut)

!t = CTt Q!1

t Ct + !t

!t = CTt Q!1

t zt + !t

!t = (At!!1t!1A

Tt + Rt)!1

Information Filter

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Kt = !tCTt (Ct!tC

Tt + Qt)!1

Kalman Filter

!t = !tµt

! =" !1 ! = !!1µReminder:

Page 78: Filtering and Estimation With Builds

KF/IF Comparison

!t = !t(At!!1t!1!t!1 + Btut)

!t = CTt Q!1

t Ct + !t

!t = CTt Q!1

t zt + !t

!t = (At!!1t!1A

Tt + Rt)!1

Information Filter

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Kt = !tCTt (Ct!tC

Tt + Qt)!1

Kalman Filter

! =" !1 ! = !!1µReminder:

Computational complexity?

Page 79: Filtering and Estimation With Builds

KF/IF Comparison

!t = !t(At!!1t!1!t!1 + Btut)

!t = CTt Q!1

t Ct + !t

!t = CTt Q!1

t zt + !t

!t = (At!!1t!1A

Tt + Rt)!1

Information Filter

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Kt = !tCTt (Ct!tC

Tt + Qt)!1

Kalman Filter

! =" !1 ! = !!1µReminder:

Computational complexity?

Page 80: Filtering and Estimation With Builds

KF/IF Comparison

!t = !t(At!!1t!1!t!1 + Btut)

!t = CTt Q!1

t Ct + !t

!t = CTt Q!1

t zt + !t

!t = (At!!1t!1A

Tt + Rt)!1

Information Filter

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Kt = !tCTt (Ct!tC

Tt + Qt)!1

Kalman Filter

! =" !1 ! = !!1µReminder:

Computational complexity?

We need the information matrix inverse to compute the mean.

µ = !!1!

Page 81: Filtering and Estimation With Builds

KF/IF Comparison

!t = !t(At!!1t!1!t!1 + Btut)

!t = CTt Q!1

t Ct + !t

!t = CTt Q!1

t zt + !t

!t = (At!!1t!1A

Tt + Rt)!1

Information Filter

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Kt = !tCTt (Ct!tC

Tt + Qt)!1

Kalman Filter

! =" !1 ! = !!1µReminder:

The choice of IF or KF is application dependent.

Page 82: Filtering and Estimation With Builds

What if the process or measurement model is non-linear (or both are non-linear)?

Page 83: Filtering and Estimation With Builds

What if the process or measurement model is non-linear (or both are non-linear)?

We could linearize the system model about the mean ...

Page 84: Filtering and Estimation With Builds

Outline

• Kinematic Model of a Mobile Robot

• Kalman Filter

• Extended Kalman Filter

• Unscented Kalman Filter

• Particle Filter

Page 85: Filtering and Estimation With Builds

Extending the Kalman Filter

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Kt = !tCTt (Ct!tC

Tt + Qt)!1

(to non-linear system models)

KF algorithm

Page 86: Filtering and Estimation With Builds

Extending the Kalman Filter

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Kt = !tCTt (Ct!tC

Tt + Qt)!1

(to non-linear system models)

µt = g(ut, µt!1)Non-linear

process model

Page 87: Filtering and Estimation With Builds

Extending the Kalman Filter

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Kt = !tCTt (Ct!tC

Tt + Qt)!1

(to non-linear system models)

Linear process model

µt = g(ut, µt!1)Non-linear

process model

Page 88: Filtering and Estimation With Builds

Extending the Kalman Filter

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Kt = !tCTt (Ct!tC

Tt + Qt)!1

(to non-linear system models)

Linear process model

h(µt)Non-linear

measurement model

µt = g(ut, µt!1)Non-linear

process model

Page 89: Filtering and Estimation With Builds

Extending the Kalman Filter

!t = At!t!1ATt + Rt

µt = Atµt!1 + Btut

µt = µt + Kt(zt ! Ctµt)

!t = (I !KtCt)!t

Kt = !tCTt (Ct!tC

Tt + Qt)!1

(to non-linear system models)

Linear process model

h(µt)Non-linear

measurement model

µt = g(ut, µt!1)Non-linear

process model

Linear measurement

model

Page 90: Filtering and Estimation With Builds

Extended Kalman Filter(algorithm)

!t = Gt!t!1GTt + Rt

µt = g(ut, µt!1)

Kt = !tHTt (Ht!tH

Tt + Qt)!1

µt = µt + Kt(zt ! h(µt))

!t = (I !KtHt)!t

Page 91: Filtering and Estimation With Builds

Extended Kalman Filter(algorithm)

!t = Gt!t!1GTt + Rt

µt = g(ut, µt!1)

Kt = !tHTt (Ht!tH

Tt + Qt)!1

µt = µt + Kt(zt ! h(µt))

!t = (I !KtHt)!t

Linearized process model

Page 92: Filtering and Estimation With Builds

Extended Kalman Filter(algorithm)

!t = Gt!t!1GTt + Rt

µt = g(ut, µt!1)

Kt = !tHTt (Ht!tH

Tt + Qt)!1

µt = µt + Kt(zt ! h(µt))

!t = (I !KtHt)!t

Linearized process model

Linearized measurement

model

Page 93: Filtering and Estimation With Builds

Extended Kalman Filter(algorithm)

!t = Gt!t!1GTt + Rt

µt = g(ut, µt!1)

Kt = !tHTt (Ht!tH

Tt + Qt)!1

µt = µt + Kt(zt ! h(µt))

!t = (I !KtHt)!t

Linearized process model

Linearized measurement

model

Linearization is generally a first order Taylor expansion.

Page 94: Filtering and Estimation With Builds

Extended Kalman Filter(algorithm)

Mobile robot example:

t0

Page 95: Filtering and Estimation With Builds

t1

Extended Kalman Filter(algorithm)

Mobile robot example:

t0

Page 96: Filtering and Estimation With Builds

t1

Extended Kalman Filter(algorithm)

Mobile robot example:

t0(v, !)

Page 97: Filtering and Estimation With Builds

t1

Extended Kalman Filter(algorithm)

Mobile robot example:

t0

Laser

(v, !)

Page 98: Filtering and Estimation With Builds

t1

Extended Kalman Filter(algorithm)

Mobile robot example:

t0

Laser

(v, !)Robot has a map of the environment.

Page 99: Filtering and Estimation With Builds

t1

Extended Kalman Filter(algorithm)

Mobile robot example:

t0

Laser

(v, !)Robot has a map of the environment.

We’ll consider the problemof localization via velocity

information and feature detection with unknown correspondence.

Page 100: Filtering and Estimation With Builds

t1

Extended Kalman Filter(algorithm)

Mobile robot example:

t0

Velocity model

v = v + !v

! = ! + "!

yt = yt!1 +v

!cos "t!1 !

v

!cos("t!1 + !!t)

xt = xt!1 !v

!sin "t!1 +

v

!sin("t!1 + !!t)

!t = !t!1 + "!t + #!!t

Page 101: Filtering and Estimation With Builds

t1

Extended Kalman Filter(algorithm)

Mobile robot example:

t0

Velocity model

v = v + !v

! = ! + "!

yt = yt!1 +v

!cos "t!1 !

v

!cos("t!1 + !!t)

xt = xt!1 !v

!sin "t!1 +

v

!sin("t!1 + !!t)

!t = !t!1 + "!t + #!!t

Gaussian noise

Page 102: Filtering and Estimation With Builds

t1

Extended Kalman Filter(algorithm)

Mobile robot example:

t0

Velocity model

v = v + !v

! = ! + "!

yt = yt!1 +v

!cos "t!1 !

v

!cos("t!1 + !!t)

xt = xt!1 !v

!sin "t!1 +

v

!sin("t!1 + !!t)

!t = !t!1 + "!t + #!!t... but the EKF already accounts for noise.

Page 103: Filtering and Estimation With Builds

t1

Extended Kalman Filter(algorithm)

Mobile robot example:

t0

Computing G:

From Taylor expansion:

g(ut, xt!1) ! g(ut, µt!1) + Gt(xt!1 " µt!1)

Page 104: Filtering and Estimation With Builds

t1

Extended Kalman Filter(algorithm)

Mobile robot example:

t0

Computing G:

From Taylor expansion:

g(ut, xt!1) ! g(ut, µt!1) + Gt(xt!1 " µt!1)

Gt =!g(ut, µt!1)

!xt!1

Page 105: Filtering and Estimation With Builds

t1

Extended Kalman Filter(algorithm)

Mobile robot example:

t0

dxt

dxt!1= 1,

dxt

dyt!1= 0

Computing G:

dxt

d!t!1= ! v

"cos !t!1 +

v

"cos(!t!1 + "!t)

dyt

d!t!1= ! v

"sin !t!1 +

v

"sin(!t!1 + "!t)

dyt

dxt!1= 0,

dyt

dyt!1= 1

d!t

dxt!1= 0,

d!t

dyt!1= 0,

d!t

d!t!1= 1

Page 106: Filtering and Estimation With Builds

t1

Extended Kalman Filter(algorithm)

Mobile robot example:

t0

dxt

dxt!1= 1,

dxt

dyt!1= 0

Computing G:

dxt

d!t!1= ! v

"cos !t!1 +

v

"cos(!t!1 + "!t)

dyt

d!t!1= ! v

"sin !t!1 +

v

"sin(!t!1 + "!t)

dyt

dxt!1= 0,

dyt

dyt!1= 1

d!t

dxt!1= 0,

d!t

dyt!1= 0,

d!t

d!t!1= 1Partial derivatives

Page 107: Filtering and Estimation With Builds

t1

Extended Kalman Filter(algorithm)

Mobile robot example:

t0

Computing G:

G =

!

"1 0 ! v

w cos !t!1 + vw cos(!t!1 + "!t)

0 1 ! vw sin !t!1 + v

w sin(!t!1 + "!t)0 0 1

#

$

Page 108: Filtering and Estimation With Builds

t1

Extended Kalman Filter(algorithm)

Mobile robot example:

t0

Computing G:

G =

!

"1 0 ! v

w cos !t!1 + vw cos(!t!1 + "!t)

0 1 ! vw sin !t!1 + v

w sin(!t!1 + "!t)0 0 1

#

$

What about the process noise?

Page 109: Filtering and Estimation With Builds

t1

Extended Kalman Filter(algorithm)

Mobile robot example:

t0

Computing G:

G =

!

"1 0 ! v

w cos !t!1 + vw cos(!t!1 + "!t)

0 1 ! vw sin !t!1 + v

w sin(!t!1 + "!t)0 0 1

#

$

What about the process noise?

Rt = VtMtVTt

Page 110: Filtering and Estimation With Builds

t1

Extended Kalman Filter(algorithm)

Mobile robot example:

t0

Computing G:

G =

!

"1 0 ! v

w cos !t!1 + vw cos(!t!1 + "!t)

0 1 ! vw sin !t!1 + v

w sin(!t!1 + "!t)0 0 1

#

$

What about the process noise?

Rt = VtMtVTt

Mt =!!v 00 !!

", Vt =

"g(ut, µt!1)"ut

Page 111: Filtering and Estimation With Builds

t1

Extended Kalman Filter(algorithm)

Mobile robot example:

t0

Computing G:

G =

!

"1 0 ! v

w cos !t!1 + vw cos(!t!1 + "!t)

0 1 ! vw sin !t!1 + v

w sin(!t!1 + "!t)0 0 1

#

$

What about the process noise?

Rt = VtMtVTt

Mt =!!v 00 !!

", Vt =

"g(ut, µt!1)"utNoise in control space

Page 112: Filtering and Estimation With Builds

Extended Kalman Filter(algorithm)

Mobile robot example:Measurement model

Obstacles detected

!r

zit = (ri

t, !it)

Page 113: Filtering and Estimation With Builds

Extended Kalman Filter(algorithm)

Mobile robot example:Measurement model

Obstacles detected

!r

zit = (ri

t, !it)

Obstacle

i = 1

i = 2

Page 114: Filtering and Estimation With Builds

Extended Kalman Filter(algorithm)

Mobile robot example:Measurement model

Obstacles detected

!r

zit = (ri

t, !it)

Obstacle

i = 1

i = 2

RangeBearing

Page 115: Filtering and Estimation With Builds

Extended Kalman Filter(algorithm)

Mobile robot example:Measurement model

Obstacles detected

!r

zit = (ri

t, !it)

We have a map, let’s use it!

Page 116: Filtering and Estimation With Builds

Extended Kalman Filter(algorithm)

Mobile robot example:Measurement model

Obstacles detected

!r

zit = (ri

t, !it)

We have a map, let’s use it!

• We compute the predicted measurement according to the map• Correspond observed and predicted obstacles• Update the estimate parameters

Page 117: Filtering and Estimation With Builds

Extended Kalman Filter(algorithm)

Mobile robot example:Measurement model

Obstacles detected

!r

zit = (ri

t, !it)

What if we wanted to incorporatemore information into the model, such as the shape, reflectivity, texture, etc.?

Page 118: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

imk

Page 119: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

i

What is the predicted range and bearing of each obstacle according to the map.

mk

Page 120: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

i

What is the predicted range and bearing of each obstacle according to the map.

mk

zkt =

! "(mk,x ! x)2 + (mk,y ! y)2

atan2(mk, y ! y, mk, x ! x)! !

#

Page 121: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

i

What is the predicted range and bearing of each obstacle according to the map.

Checkfor

agreement!

mk

zkt =

! "(mk,x ! x)2 + (mk,y ! y)2

atan2(mk, y ! y, mk, x ! x)! !

#

Page 122: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

i

What is the predicted range and bearing of each obstacle according to the map.

Checkfor

agreement!

mk

Linearization of the measurement model

Hkt =

!h(µt, k, m)!xt

h(xt, k, m) ! h(µt, k, m) + Hkt (xt " µt)

zkt =

! "(mk,x ! x)2 + (mk,y ! y)2

atan2(mk, y ! y, mk, x ! x)! !

#

Page 123: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

i

What is the predicted range and bearing of each obstacle according to the map.

Checkfor

agreement!

mk

What is ?h(µt, k, m)

Linearization of the measurement model

Hkt =

!h(µt, k, m)!xt

h(xt, k, m) ! h(µt, k, m) + Hkt (xt " µt)

zkt =

! "(mk,x ! x)2 + (mk,y ! y)2

atan2(mk, y ! y, mk, x ! x)! !

#

Page 124: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

i

What is the predicted range and bearing of each obstacle according to the map.

Checkfor

agreement!

mk

What is ?h(µt, k, m)

Linearization of the measurement model

Hkt =

!h(µt, k, m)!xt

h(xt, k, m) ! h(µt, k, m) + Hkt (xt " µt)

zkt =

! "(mk,x ! x)2 + (mk,y ! y)2

atan2(mk, y ! y, mk, x ! x)! !

#

Page 125: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

Page 126: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

zkt =

! "(mk,x ! x)2 + (mk,y ! y)2

atan2(mk, y ! y, mk, x ! x)! !

#

Page 127: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

Hkt =

!

"!mk,x!x

zkt,r

!mk,y!yzk

t,r0

mk,y!y(zk

t,r)2!mk,x!x

(zkt,r)2

!1

#

$

zkt =

! "(mk,x ! x)2 + (mk,y ! y)2

atan2(mk, y ! y, mk, x ! x)! !

#

Page 128: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

Hkt =

!

"!mk,x!x

zkt,r

!mk,y!yzk

t,r0

mk,y!y(zk

t,r)2!mk,x!x

(zkt,r)2

!1

#

$

Skt = Hk

t !t(Hkt )T + Qt

Done

zkt =

! "(mk,x ! x)2 + (mk,y ! y)2

atan2(mk, y ! y, mk, x ! x)! !

#

Page 129: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

Hkt =

!

"!mk,x!x

zkt,r

!mk,y!yzk

t,r0

mk,y!y(zk

t,r)2!mk,x!x

(zkt,r)2

!1

#

$

Skt = Hk

t !t(Hkt )T + Qt

DoneError covariance of this predicted measurement

zkt =

! "(mk,x ! x)2 + (mk,y ! y)2

atan2(mk, y ! y, mk, x ! x)! !

#

Page 130: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

Hkt =

!

"!mk,x!x

zkt,r

!mk,y!yzk

t,r0

mk,y!y(zk

t,r)2!mk,x!x

(zkt,r)2

!1

#

$

Skt = Hk

t !t(Hkt )T + Qt

DoneError covariance of this predicted measurement

Now that we’ve gone through all of the possible obstacles, we need to figure out a correspondence.

zkt =

! "(mk,x ! x)2 + (mk,y ! y)2

atan2(mk, y ! y, mk, x ! x)! !

#

Page 131: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

DoneCompute zk

t , Hkt , Sk

t

Page 132: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

DoneCompute zk

t , Hkt , Sk

t

Compute the most likely obstacle that matches the observed obstacle using “Maximum Likelihood.”

Page 133: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

DoneCompute zk

t , Hkt , Sk

t

Compute the most likely obstacle that matches the observed obstacle using “Maximum Likelihood.”

j = arg maxk

e!12 (zi

t!zkt )T (Sk

t )!1(zit!zk

t )

det(2!Skt ) 1

2

Page 134: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

DoneCompute zk

t , Hkt , Sk

t

Compute the most likely obstacle that matches the observed obstacle using “Maximum Likelihood.”

j = arg maxk

e!12 (zi

t!zkt )T (Sk

t )!1(zit!zk

t )

det(2!Skt ) 1

2

ML gives us the predicted obstacle that corresponds with the observed obstacle

with highest probability.

Page 135: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

DoneCompute zk

t , Hkt , Sk

t

Compute jAt this point, we only need to update the estimate to

include the information from this measurement.

Page 136: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

DoneCompute zk

t , Hkt , Sk

t

Compute jAt this point, we only need to update the estimate to

include the information from this measurement.As the EKF is recursive, we can incrementally

introduce each observed obstacle.

Page 137: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

DoneCompute zk

t , Hkt , Sk

t

Compute jAt this point, we only need to update the estimate to

include the information from this measurement.As the EKF is recursive, we can incrementally

introduce each observed obstacle.Ki

t = !t(Hji )T (Sj

t )!1

!t = (I !KitH

jt )!t

µt = µt + Kit(z

it ! zj

t )

Page 138: Filtering and Estimation With Builds

Mobile robot example (Measurement model):

For each observed obstacle:For each predicted obstacle (from the map):

DoneCompute zk

t , Hkt , Sk

t

Compute jAt this point, we only need to update the estimate to

include the information from this measurement.As the EKF is recursive, we can incrementally

introduce each observed obstacle.Ki

t = !t(Hji )T (Sj

t )!1

!t = (I !KitH

jt )!t

µt = µt + Kit(z

it ! zj

t )

Done, µt = µt, !t = !t

Page 139: Filtering and Estimation With Builds

Extended Kalman Filter• Handles non-linear systems via linearization• Assumes a unimodal solution

Page 140: Filtering and Estimation With Builds

Extended Kalman Filter• Handles non-linear systems via linearization• Assumes a unimodal solution

Multi-hypothesis filters address this issue.

Page 141: Filtering and Estimation With Builds

Extended Kalman Filter• Handles non-linear systems via linearization• Assumes a unimodal solution

Multi-hypothesis filters address this issue.

Example (multi-robot range-only sensing):

Page 142: Filtering and Estimation With Builds

Extended Kalman Filter• Handles non-linear systems via linearization• Assumes a unimodal solution

Multi-hypothesis filters address this issue.

Example (multi-robot range-only sensing):Robot is here.

Page 143: Filtering and Estimation With Builds

Extended Kalman Filter• Handles non-linear systems via linearization• Assumes a unimodal solution

Multi-hypothesis filters address this issue.

Example (multi-robot range-only sensing):

Measurements indicate it could

be at either location!

Robot is here.

Page 144: Filtering and Estimation With Builds

Extended Kalman Filter• Handles non-linear systems via linearization• Assumes a unimodal solution

Multi-hypothesis filters address this issue.

Example (multi-robot range-only sensing):

Measurements indicate it could

be at either location!

Robot is here.

Consider usingmultiple hypotheses and monitor each

estimate covariance.

Page 145: Filtering and Estimation With Builds

What about the EKF in the information form?

Page 146: Filtering and Estimation With Builds

Extended Information Filter(algorithm)

!t = (Gt!!1t!1G

Tt + Rt)!1

!t = !t + HTt Q!1

t Ht

µt!1 = !!1t!1!t!1

!t = !t + HTt Q!1

t (zt ! h(µt)!Htµt))

µt = g(ut, µt!1)

!t = !tµt

! =" !1 ! = !!1µReminder:

Page 147: Filtering and Estimation With Builds

Gazebo Simulation Example

Robot follows a simple trajectory:

v = 0.1 m/s! = 0.1 rad/s

Page 148: Filtering and Estimation With Builds

Gazebo Simulation Example

Robot is equipped with a GPS sensor.

Page 149: Filtering and Estimation With Builds

Gazebo Simulation Example

Page 150: Filtering and Estimation With Builds

Gazebo Simulation Example

GPS

Page 151: Filtering and Estimation With Builds

Gazebo Simulation Example

GPS

Estimate

Page 152: Filtering and Estimation With Builds

Gazebo Simulation Example

GPS

EstimateTrue Position

Page 153: Filtering and Estimation With Builds

Gazebo Simulation Example

Position Error Angular Error

Page 154: Filtering and Estimation With Builds

Gazebo Simulation Example

GPS

Estimate

Position Error Angular Error

Page 155: Filtering and Estimation With Builds

Gazebo Simulation Example

GPS

Estimate

Position Error Angular Error

Are the results reasonable given the system model and sensors?

Page 156: Filtering and Estimation With Builds

Gazebo Simulation ExampleAre the results reasonable given the system model and sensors?

Page 157: Filtering and Estimation With Builds

Gazebo Simulation ExampleAre the results reasonable given the system model and sensors?

To answer this question we need to examine the system characterization:

• How was the filter initialized?• How were the process and measurement noise models defined?

Page 158: Filtering and Estimation With Builds

Gazebo Simulation ExampleAre the results reasonable given the system model and sensors?

To answer this question we need to examine the system characterization:

• How was the filter initialized?• How were the process and measurement noise models defined?

µ = [0, 0, 0]T

! = 100I3

Page 159: Filtering and Estimation With Builds

Gazebo Simulation ExampleAre the results reasonable given the system model and sensors?

To answer this question we need to examine the system characterization:

• How was the filter initialized?• How were the process and measurement noise models defined?

µ = [0, 0, 0]T

! = 100I3

R = 0.1I3

Q =

!

"10 0 00 10 00 0 2

#

$

Page 160: Filtering and Estimation With Builds

Gazebo Simulation ExampleAre the results reasonable given the system model and sensors?

To answer this question we need to examine the system characterization:

• How was the filter initialized?• How were the process and measurement noise models defined?

µ = [0, 0, 0]T

! = 100I3

R = 0.1I3

Q =

!

"10 0 00 10 00 0 2

#

$

Why?

Page 161: Filtering and Estimation With Builds

Gazebo Simulation ExampleAre the results reasonable given the system model and sensors?

To answer this question we need to examine the system characterization:

• How was the filter initialized?• How were the process and measurement noise models defined?

µ = [0, 0, 0]T

! = 100I3

R = 0.1I3

Q =

!

"10 0 00 10 00 0 2

#

$

Why?

Filters requiretuning, guessing isnot a good idea!

Page 162: Filtering and Estimation With Builds

Gazebo Simulation Example

From the world file:

Mt =!0.5 0.10.1 0.5

"

In simulation we have access to the error models.

Page 163: Filtering and Estimation With Builds

t1

Extended Kalman Filter(algorithm)

Mobile robot example:

t0

Computing G:

G =

!

"1 0 ! v

w cos !t!1 + vw cos(!t!1 + "!t)

0 1 ! vw sin !t!1 + v

w sin(!t!1 + "!t)0 0 1

#

$

What about the process noise?

Rt = VtMtVTt

Mt =!!v 00 !!

", Vt =

"g(ut, µt!1)"utNoise in control space

Recall:

Page 164: Filtering and Estimation With Builds

Gazebo Simulation ExampleIn simulation we have access to the error models.

From the world file:

Mt =!0.5 0.10.1 0.5

"

Noise in control space

Rt = VtMtVTt Non-constant noise

Page 165: Filtering and Estimation With Builds

Gazebo Simulation ExampleIn simulation we have access to the error models.

From the world file:

Mt =!0.5 0.10.1 0.5

"

Noise in control space

Rt = VtMtVTt

Vt =!g(ut, µt!1)

!ut=

!

"#

! sin !+sin(!+wt!t)"t

vt(sin !!sin(!+"t!t))"2

t+ vt cos(!+"t!t)!t

"tcos !!cos(!+wt!t)

"t!vt(cos !!cos(!+"t!t))

"2t

+ vt sin(!+"t!t)!t"t

0 !t

$

%&

Non-constant noise

Page 166: Filtering and Estimation With Builds

Gazebo Simulation ExampleIn simulation we have access to the error models.

From the world file:

Q =

!

"1 0 00 1 00 0 0.4

#

$

GPS provides state information directly.

Page 167: Filtering and Estimation With Builds

Gazebo Simulation ExampleOld Results New Results

Page 168: Filtering and Estimation With Builds

Position Error Angular Error

Old

New

Page 169: Filtering and Estimation With Builds

Gazebo Simulation Example

Can we improve these results?

Page 170: Filtering and Estimation With Builds
Page 171: Filtering and Estimation With Builds

How is it possible that these results are better?

Page 172: Filtering and Estimation With Builds

Is there a better way to compute the noise?

Page 173: Filtering and Estimation With Builds

Adaptive Filtering Techniques

• Generally applies to fitting or “learning” system models.

• Updates the process (measurement) model based on the disparity between the predicted and sensed state (measurements).

Page 174: Filtering and Estimation With Builds

Gazebo Simulation using an Adaptive EKF

Page 175: Filtering and Estimation With Builds

Gazebo Simulation using an Adaptive EKF

Position Error Angular Error

Page 176: Filtering and Estimation With Builds

Outline

• Kinematic Model of a Mobile Robot

• Kalman Filter

• Extended Kalman Filter

• Unscented Kalman Filter

• Particle Filter

Page 177: Filtering and Estimation With Builds

Unscented Kalman Filter

• “Derivative-free” alternative to EKF

• Higher-order approximation accuracy than EKF (2nd vs. 1st)

• Represents varying distributions via dicrete points (sigma points)

Page 178: Filtering and Estimation With Builds

Unscented Kalman Filter

R2

Page 179: Filtering and Estimation With Builds

Unscented Kalman Filter

Sigma point

Equipotential ellipse

R2

N = 2

Page 180: Filtering and Estimation With Builds

Unscented Kalman Filter

g(µt!1, ut)

Sigma point

Equipotential ellipse

R2

N = 2

Page 181: Filtering and Estimation With Builds

Unscented Kalman Filter

g(µt!1, ut)

Sigma point

Equipotential ellipse

R2

N = 2

Page 182: Filtering and Estimation With Builds

Unscented Kalman Filter

g(µt!1, ut)

Sigma point

Sigma points are typically (but not necessarily)distributed in this manner.

Equipotential ellipse

R2

N = 2

Page 183: Filtering and Estimation With Builds

Unscented Kalman Filter

g(µt!1, ut)

Sigma point

Sigma points are typically (but not necessarily)distributed in this manner.

Equipotential ellipse

The following derivation assumes this distribution in N.

R2

N = 2

Page 184: Filtering and Estimation With Builds

Unscented Kalman Filter

“... it is easier to approximate a probability distributionthan it is to approximate an arbitrary nonlinear functionor transformation.”

Page 185: Filtering and Estimation With Builds

Unscented Kalman Filter(algorithm)

At a high level:

Page 186: Filtering and Estimation With Builds

Unscented Kalman Filter(algorithm)

At a high level:1. Initialize sigma points based on the moments parameterization.

Page 187: Filtering and Estimation With Builds

Unscented Kalman Filter(algorithm)

At a high level:1. Initialize sigma points based on the moments parameterization.2. Transform the sigma points according to the nonlinear process model.

Page 188: Filtering and Estimation With Builds

Unscented Kalman Filter(algorithm)

At a high level:1. Initialize sigma points based on the moments parameterization.2. Transform the sigma points according to the nonlinear process model.3. Initialize predicted sigma points based on the transformed sigma points.

Page 189: Filtering and Estimation With Builds

Unscented Kalman Filter(algorithm)

At a high level:1. Initialize sigma points based on the moments parameterization.2. Transform the sigma points according to the nonlinear process model.3. Initialize predicted sigma points based on the transformed sigma points.4. Transform the predicted sigma points according to the nonlinear measurement model.

Page 190: Filtering and Estimation With Builds

Unscented Kalman Filter(algorithm)

At a high level:1. Initialize sigma points based on the moments parameterization.2. Transform the sigma points according to the nonlinear process model.3. Initialize predicted sigma points based on the transformed sigma points.4. Transform the predicted sigma points according to the nonlinear measurement model.5. Update the moments parameterization based on the measurement correction.

Page 191: Filtering and Estimation With Builds

Initialization of Sigma Points

si = {xi, Wi}

Each Sigma point is defined by a state and weight:

xi ! RN

Wi ! R

Page 192: Filtering and Estimation With Builds

Initialization of Sigma PointsSigma points must have the following properties:

2N!

i=0

Wi = 1

µ =2N!

i=0

Wixi

! =2N!

i=0

Wi(xi ! µ)(xi ! µ)T

Page 193: Filtering and Estimation With Builds

Initialization of Sigma PointsSigma points must have the following properties:

Consistent with first moment

2N!

i=0

Wi = 1

µ =2N!

i=0

Wixi

! =2N!

i=0

Wi(xi ! µ)(xi ! µ)T

Page 194: Filtering and Estimation With Builds

Initialization of Sigma PointsSigma points must have the following properties:

Consistent with first moment Consistent with

second moment

2N!

i=0

Wi = 1

µ =2N!

i=0

Wixi

! =2N!

i=0

Wi(xi ! µ)(xi ! µ)T

Page 195: Filtering and Estimation With Builds

Initialization of Sigma Points

x0 = µ

Page 196: Filtering and Estimation With Builds

Initialization of Sigma Points

x0 = µ

xi = µ +

!"N

1!W0!

#

i

Page 197: Filtering and Estimation With Builds

Initialization of Sigma Points

x0 = µ

xi = µ +

!"N

1!W0!

#

ii = {1, . . . , N}

Page 198: Filtering and Estimation With Builds

Initialization of Sigma Points

x0 = µ

xi = µ +

!"N

1!W0!

#

i

rowi if B = AT A

columni if B = AAT

Matrix Square-Root

i = {1, . . . , N}

Page 199: Filtering and Estimation With Builds

Initialization of Sigma Points

x0 = µ

xi = µ +

!"N

1!W0!

#

i

rowi if B = AT A

columni if B = AAT

Matrix Square-Root

xi+N = µ!!"

N

1!W0!

#

i

i = {1, . . . , N}

Page 200: Filtering and Estimation With Builds

Initialization of Sigma Points

x0 x1

x2

x3

x4R2

Page 201: Filtering and Estimation With Builds

Initialization of Sigma Points

Wi =1!W0

2N

Page 202: Filtering and Estimation With Builds

Initialization of Sigma Points

Wi =1!W0

2Ni = {1, . . . , 2N}

Page 203: Filtering and Estimation With Builds

Initialization of Sigma Points

Wi =1!W0

2Ni = {1, . . . , 2N}

W0 =!

N + !, ! = "2(N + #)!N

Page 204: Filtering and Estimation With Builds

Initialization of Sigma Points

Wi =1!W0

2Ni = {1, . . . , 2N}

W0 =!

N + !, ! = "2(N + #)!N

Scaling parameters

Page 205: Filtering and Estimation With Builds

Initialization of Sigma Points

!

! = 1, " = 0.1 : 0.1 : 1

µ = [0, 0]

! =!2 00 1

"

Page 206: Filtering and Estimation With Builds

Initialization of Sigma PointsInitialize(µ, !, !, ") :

Page 207: Filtering and Estimation With Builds

Initialization of Sigma PointsInitialize(µ, !, !, ") :

W0 =!

N + !, ! = "2(N + #)!N

Page 208: Filtering and Estimation With Builds

Initialization of Sigma PointsInitialize(µ, !, !, ") :

W0 =!

N + !, ! = "2(N + #)!N

x0 = µ

Page 209: Filtering and Estimation With Builds

Initialization of Sigma PointsInitialize(µ, !, !, ") :

W0 =!

N + !, ! = "2(N + #)!N

x0 = µ

xi = µ +

!"N

1!W0!

#

i

Page 210: Filtering and Estimation With Builds

Initialization of Sigma PointsInitialize(µ, !, !, ") :

W0 =!

N + !, ! = "2(N + #)!N

x0 = µ

xi = µ +

!"N

1!W0!

#

i

xi+N = µ!!"

N

1!W0!

#

i

Page 211: Filtering and Estimation With Builds

Unscented Kalman Filter(algorithm)

{x0, xi} = Initialize(µ, !, !, ")

{x0, xi} = g(x0, xi, u)

Prediction

! =2N!

i=0

Wi(xi ! µ)(xi ! µ)T + R

µ =2N!

i=0

Wixi

Page 212: Filtering and Estimation With Builds

Unscented Kalman Filter(algorithm)

{x0, xi} = Initialize(µ, !, !, ")

{x0, xi} = g(x0, xi, u)

Prediction

! =2N!

i=0

Wi(xi ! µ)(xi ! µ)T + R

µ =2N!

i=0

Wixi

Page 213: Filtering and Estimation With Builds

Correction of Sigma Points

{x0, xi} = Initialize(µ, !, !, ")

{z0, zi} = h(x0, xi, u)

z =2N!

i=0

Wizi

S =2N!

i=0

Wi(zi ! z)(zi ! z)T + Q

! =2N!

i=0

Wi(xi ! µ)(zi ! z)T

K = !S!1

Page 214: Filtering and Estimation With Builds

Unscented Kalman Filter(algorithm)

{xi, µ, !} = Prediction(µ, !, u, !, ")

µ = µ + K(z ! z)

! = !!KSKT

{z, µ, !, K, S} = Sigma Correction(xi, µ, !, !, ")

Page 215: Filtering and Estimation With Builds

Outline

• Kinematic Model of a Mobile Robot

• Kalman Filter

• Extended Kalman Filter

• Unscented Kalman Filter

• Particle Filter

Page 216: Filtering and Estimation With Builds

Particle Filters

• Nonparametric representation of estimation

• Permits a broader space of distributions (including multimodal distributions)

• Represents estimates as discrete hypotheses (particles)

• Samples (and resamples) based on probability distribution of process and measurement models

Page 217: Filtering and Estimation With Builds

Basic Particle Filter

Page 218: Filtering and Estimation With Builds

Basic Particle FilterThere are many

variations!

Page 219: Filtering and Estimation With Builds

Basic Particle FilterThere are many

variations!xm

t

Xt = {!x1t , w1

t ", . . . , !xMt , wM

t "}

Page 220: Filtering and Estimation With Builds

Basic Particle FilterThere are many

variations!xm

t

Basic idea:

• Create a set of weighted hypotheses (particles) based on the previous set of hypotheses, system inputs, and measurements.

Xt = {!x1t , w1

t ", . . . , !xMt , wM

t "}

Page 221: Filtering and Estimation With Builds

Basic Particle FilterThere are many

variations!xm

t

Basic idea:

• Create a set of weighted hypotheses (particles) based on the previous set of hypotheses, system inputs, and measurements.

• Create a set of hypotheses sampled from the weighted hypotheses based on the distribution of weights.

Xt = {!x1t , w1

t ", . . . , !xMt , wM

t "}

Page 222: Filtering and Estimation With Builds

Basic Particle FilterThere are many

variations!xm

t

Basic idea:

• Create a set of weighted hypotheses (particles) based on the previous set of hypotheses, system inputs, and measurements.

• Create a set of hypotheses sampled from the weighted hypotheses based on the distribution of weights.

Monte Carlo method

Xt = {!x1t , w1

t ", . . . , !xMt , wM

t "}

Page 223: Filtering and Estimation With Builds

Basic Particle FilterThere are many

variations!xm

t

Basic idea:

• Create a set of weighted hypotheses (particles) based on the previous set of hypotheses, system inputs, and measurements.

• Create a set of hypotheses sampled from the weighted hypotheses based on the distribution of weights.

Monte Carlo method

Sample Importance Resampling

Xt = {!x1t , w1

t ", . . . , !xMt , wM

t "}

Page 224: Filtering and Estimation With Builds

Basic Particle Filter(algorithm)

For M particles:

Page 225: Filtering and Estimation With Builds

Basic Particle Filter(algorithm)

For M particles:sample xm

t ! p(xt | ut, xmt!1)

Page 226: Filtering and Estimation With Builds

Basic Particle Filter(algorithm)

For M particles:sample xm

t ! p(xt | ut, xmt!1)

Sampling introduces noiseto every particle

Page 227: Filtering and Estimation With Builds

Basic Particle Filter(algorithm)

For M particles:sample xm

t ! p(xt | ut, xmt!1)

wmt = p(zt | xm

t )

Sampling introduces noiseto every particle

Page 228: Filtering and Estimation With Builds

Basic Particle Filter(algorithm)

For M particles:sample xm

t ! p(xt | ut, xmt!1)

wmt = p(zt | xm

t )Importance Factor

Sampling introduces noiseto every particle

Page 229: Filtering and Estimation With Builds

Basic Particle Filter(algorithm)

For M particles:sample xm

t ! p(xt | ut, xmt!1)

wmt = p(zt | xm

t )Xt = Xt + !xm

t , wmt "

End

Importance Factor

Sampling introduces noiseto every particle

Page 230: Filtering and Estimation With Builds

Basic Particle Filter(algorithm)

For M particles:sample xm

t ! p(xt | ut, xmt!1)

wmt = p(zt | xm

t )Xt = Xt + !xm

t , wmt "

End

Importance Factor

Xt = Importance Resampling(Xt)

Sampling introduces noiseto every particle

Page 231: Filtering and Estimation With Builds

Importance Resampling

Take the particles and lay them side-by-side according

to each particles weight.

xmt

Page 232: Filtering and Estimation With Builds

Importance Resampling

Take the particles and lay them side-by-side according

to each particles weight.

xmt

x1t

w1t

xmt

wmt

Page 233: Filtering and Estimation With Builds

Importance Resampling

Take the particles and lay them side-by-side according

to each particles weight.

xmt

x1t

w1t

xmt

wmt

Normalize the weights and sample based on this distribution.

Page 234: Filtering and Estimation With Builds

Importance Resampling

Take the particles and lay them side-by-side according

to each particles weight.

xmt

x1t

w1t

xmt

wmt

Normalize the weights and sample based on this distribution.

Particles with higher weights will be selected

with higher probability.

Page 235: Filtering and Estimation With Builds

Common Issues

• Particle deprivation

• Random number generation

• Resampling frequency

Page 236: Filtering and Estimation With Builds

Common Issues

• Particle deprivation

• Random number generation

• Resampling frequency

wmt =

!1 if resampling took placep(zt | xm

t ) wmt!1 otherwise