+ All Categories
Home > Documents > CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5...

CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5...

Date post: 11-Jul-2020
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
34
z CMSC828T Vision, Planning And Control In Aerial Robotics FACTOR GRAPH BASED FILTERING USING GTSAM 9/26/2017 1
Transcript
Page 1: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

CMSC828TVision, Planning And Control In

Aerial RoboticsFACTOR GRAPH BASED FILTERING USING GTSAM

9/26/2017 1

Page 2: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

2D Robot World

9/26/2017 2

• World with landmarks• Landmarks are unique and numbered• Each landmark 𝑙𝑙𝑘𝑘 is denoted by,

𝑙𝑙𝑘𝑘 =𝑙𝑙𝑘𝑘,𝑥𝑥𝑙𝑙𝑘𝑘,𝑦𝑦

X

Y

Page 3: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Robot Start

9/26/2017 3

Robot Starts here

Page 4: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Robot Start

9/26/2017 4

Robot Odometry says this is origin

Page 5: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Robot State

9/26/2017 5

Robot State is given by,

𝒙𝒙 =𝑥𝑥𝑦𝑦𝜃𝜃

Because this varies with respect to time, We will write the state as,

𝒙𝒙𝒕𝒕 =𝑥𝑥𝑡𝑡𝑦𝑦𝑡𝑡𝜃𝜃𝑡𝑡

=𝑥𝑥𝑦𝑦𝜃𝜃 𝑡𝑡

X

Y

𝜃𝜃𝒙𝒙𝒕𝒕

Page 6: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Sensor

9/26/2017 6

Robot has a Wide FOV Camera/Lidar of 120°

𝜃𝜃

Page 7: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Measurement Model

9/26/2017 7

Page 8: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Measurement Model

9/26/2017 8

• At 𝒙𝒙𝒕𝒕 the robot observes 𝑙𝑙𝑘𝑘 landmarks where 𝑘𝑘 denotes individual landmark IDs

• Sensor is not perfect hence you see the landmark with a probability of 𝑝𝑝𝑜𝑜𝑜𝑜𝑜𝑜 = 0.95

• The measurement at time 𝑡𝑡 with respect to landmark 𝑙𝑙𝑘𝑘obtained by the robot is given by

𝑚𝑚𝑡𝑡,𝑘𝑘 =𝑚𝑚𝑡𝑡,𝑘𝑘,𝑥𝑥𝑚𝑚𝑡𝑡,𝑘𝑘,𝑦𝑦

• 𝑚𝑚𝑡𝑡,𝑘𝑘 is noisy and can be thought of as drawn from 𝒩𝒩( �𝑚𝑚𝑡𝑡,𝑘𝑘 ,Σ𝑚𝑚)

Missed landmark

x

o

Page 9: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Robot at 𝑡𝑡 = 1

9/26/2017 9

• Odometry is denoted by 𝑜𝑜𝑡𝑡𝑡𝑡+1 between times 𝑡𝑡 and 𝑡𝑡 + 1

• It is obtained by some wheel encoder and can be thought of as drawn from 𝒩𝒩(�𝑜𝑜𝑡𝑡𝑡𝑡+1 ,Σ𝑜𝑜)

Page 10: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

For multiple steps

9/26/2017 10

Page 11: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

SLAM Problem

9/26/2017 11

𝑥𝑥0 =−10−10𝜋𝜋2

Given Initial pose 𝑥𝑥1 , odometry 𝑜𝑜𝑡𝑡𝑡𝑡+1 and landmarkmeasurements𝑚𝑚𝑡𝑡,𝑘𝑘Obtain landmark locations 𝑙𝑙𝑘𝑘 and robot pose 𝑥𝑥𝑡𝑡SLAM stands for “Simultaneous Localization and Mapping”

Page 12: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

SLAM as a Bayes Net

9/26/2017 12

Page 13: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

SLAM as a Bayes Net: Graph

9/26/2017 13

𝑥𝑥0 𝑥𝑥1 𝑥𝑥2 𝑥𝑥3

𝑚𝑚1 𝑚𝑚2 𝑚𝑚3 𝑚𝑚4 𝑚𝑚5 𝑚𝑚6

𝑙𝑙7 𝑙𝑙16 𝑙𝑙78 𝑙𝑙71 𝑙𝑙82

Page 14: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

SLAM as a Bayes Net: Math

9/26/2017 14

Motion Model:

𝑥𝑥𝑡𝑡 = 𝑓𝑓𝑡𝑡 𝑥𝑥𝑡𝑡−1,𝑢𝑢𝑡𝑡 + 𝑤𝑤𝑖𝑖 ⇔ 𝑃𝑃 𝑥𝑥𝑡𝑡 𝑥𝑥𝑡𝑡−1,𝑢𝑢𝑡𝑡 ∝ e−12 𝑓𝑓𝑡𝑡 𝑥𝑥𝑡𝑡−1,𝑢𝑢𝑡𝑡 −𝑥𝑥𝑡𝑡 Λt

2

Measurement Model:

𝑚𝑚𝑖𝑖 = ℎ𝑖𝑖 𝑥𝑥𝑡𝑡,𝑖𝑖 , 𝑙𝑙𝑘𝑘,𝑖𝑖 + 𝑣𝑣𝑖𝑖 ⇔ 𝑃𝑃 𝑚𝑚𝑖𝑖 𝑥𝑥𝑡𝑡,𝑖𝑖 , 𝑙𝑙𝑘𝑘,𝑖𝑖 ∝ e−12 ℎ𝑖𝑖 𝑥𝑥𝑡𝑡,𝑖𝑖,𝑙𝑙𝑘𝑘,𝑖𝑖 −𝑚𝑚𝑖𝑖 Σ𝑖𝑖

2

MAP to maximize:

𝑃𝑃 𝑋𝑋,𝐿𝐿,𝑀𝑀 = 𝑃𝑃 𝑥𝑥0 �𝑡𝑡=1

𝑇𝑇

𝑃𝑃 𝑥𝑥𝑡𝑡 𝑥𝑥𝑡𝑡−1,𝑢𝑢𝑡𝑡 �𝑖𝑖=1

𝑀𝑀

𝑃𝑃 𝑚𝑚𝑖𝑖 𝑥𝑥𝑡𝑡,𝑖𝑖 , 𝑙𝑙𝑘𝑘,𝑖𝑖

Page 15: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

SLAM as a Factor Graph: Graph

9/26/2017 15

𝑥𝑥0 𝑥𝑥1 𝑥𝑥2 𝑥𝑥3

𝑙𝑙7 𝑙𝑙16 𝑙𝑙78 𝑙𝑙71 𝑙𝑙82

Page 16: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

SLAM as a Factor Graph: Math

9/26/2017 16

Prior:

𝜙𝜙0 𝑥𝑥0 ∝ 𝑃𝑃 𝑥𝑥0Motion Model:

𝜓𝜓𝑡𝑡−1,𝑡𝑡 𝑥𝑥𝑡𝑡−1,𝑥𝑥𝑡𝑡 ∝ 𝑃𝑃 𝑥𝑥𝑡𝑡 𝑥𝑥𝑡𝑡−1,𝑢𝑢𝑡𝑡Measurement Model:

𝜓𝜓𝑡𝑡,𝑘𝑘 𝑥𝑥𝑡𝑡 , 𝑙𝑙𝑘𝑘 ∝ 𝑃𝑃 𝑚𝑚𝑡𝑡,𝑘𝑘 𝑥𝑥𝑡𝑡 , 𝑙𝑙𝑘𝑘Value of the graph to maximize:

𝑃𝑃 Θ ∝ �𝑡𝑡=0

𝑇𝑇

𝜙𝜙𝑡𝑡 𝜃𝜃𝑡𝑡 �𝑖𝑖,𝑗𝑗 ,𝑖𝑖<𝑗𝑗

𝜓𝜓𝑖𝑖𝑗𝑗 𝜃𝜃𝑖𝑖 ,𝜃𝜃𝑗𝑗

Θ ≜ (𝑋𝑋, 𝐿𝐿)

Page 17: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

SLAM as Non-Linear Least Squares

9/26/2017 17

• Maximum A Posteriori (MAP) estimation

𝑓𝑓 Θ = �𝑖𝑖

𝑓𝑓𝑖𝑖(Θ𝑖𝑖) ,Θ ≜ 𝑋𝑋, 𝐿𝐿 ∀ 𝑓𝑓𝑖𝑖 Θ𝑖𝑖 ∝ e−12 ℎ𝑖𝑖 Θ𝑖𝑖 −𝑚𝑚𝑖𝑖 Σ𝑖𝑖

2

Θ∗ = argmaxΘ

𝑓𝑓 Θ

• Negative Log Likelihood (NLL)

argminΘ

−log 𝑓𝑓(Θ) = argminΘ

12�𝑖𝑖

ℎ𝑖𝑖 Θ𝑖𝑖 − 𝑚𝑚𝑖𝑖 Σ𝑖𝑖2

Page 18: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Numerical Optimization 101

9/26/2017 18

𝑥𝑥∗

Convex function

𝑓𝑓(𝑥𝑥)

𝑥𝑥∗ = argmin𝑥𝑥

𝑓𝑓(𝑥𝑥)

Page 19: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Convex Function

9/26/2017 19

𝑥𝑥∗

Convex function

𝑓𝑓(𝑥𝑥)

𝑥𝑥1, 𝑓𝑓(𝑥𝑥1)𝑥𝑥2, 𝑓𝑓(𝑥𝑥2)

𝑡𝑡𝑥𝑥1 + 1 − 𝑡𝑡 𝑥𝑥2,𝑓𝑓(𝑡𝑡𝑥𝑥1 + 1 − 𝑡𝑡 𝑥𝑥2) , 𝑡𝑡 ∈ [0,1]

Known as “Jensen’s Inequality”

Page 20: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Concave Function

9/26/2017 20

𝑥𝑥∗

Concave function

𝑥𝑥∗ = argmax𝑥𝑥

𝑓𝑓(𝑥𝑥)

Intuitively:Concave = −Convex or vice versa

Page 21: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Non-Convex Function

9/26/2017 21

𝑓𝑓(𝑥𝑥)

𝑥𝑥∗

𝑥𝑥𝑙𝑙∗

𝑥𝑥𝑙𝑙∗𝑥𝑥𝑙𝑙∗ 𝑥𝑥𝑙𝑙∗

Non-convex function

Neither convex nor concaveIntuitively has a lot of local optimum

Page 22: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Convex Optimization 101

9/26/2017 22

𝑥𝑥∗

Convex function

𝑓𝑓(𝑥𝑥) Gradient Direction is the direction of steepest descent

Negative Gradient points to optimum direction

Gradient

Iso-contours of 𝑓𝑓(𝑥𝑥)

Page 23: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Steepest Descent

9/26/2017 23

𝑥𝑥𝑡𝑡+1 = 𝑥𝑥𝑡𝑡 − 𝜏𝜏𝛻𝛻𝑓𝑓 𝑥𝑥𝑡𝑡𝜏𝜏 is called the step-size𝛻𝛻𝑓𝑓(𝑥𝑥) is the local gradient at 𝑥𝑥

Negative Gradient points to optimum direction

Gradient

Iso-contours of 𝑓𝑓(𝑥𝑥)

𝑥𝑥0

𝑥𝑥∗

Page 24: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Step-size Restrictions

9/26/2017 24

𝜏𝜏 < 2𝛼𝛼

for 𝑓𝑓 𝑥𝑥 = 𝛼𝛼2𝑥𝑥2

𝛻𝛻𝑓𝑓 𝑥𝑥 = 𝛼𝛼𝑥𝑥

𝑥𝑥𝑡𝑡+1 = 𝑥𝑥𝑡𝑡 − 𝜏𝜏𝛼𝛼𝑥𝑥𝑡𝑡

Sort of like PD controller

Too high 𝜏𝜏 will cause you to diverge

Too low 𝜏𝜏 will take forever to converge 𝑥𝑥∗

Convex function

𝑓𝑓(𝑥𝑥)

𝑥𝑥𝑡𝑡 𝜏𝜏 =2𝛼𝛼

𝜏𝜏 =1𝛼𝛼

Page 25: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Lipschitz Constant

9/26/2017 25

𝛻𝛻𝑓𝑓 𝑥𝑥 − 𝛻𝛻𝑓𝑓 𝑦𝑦 ≤ 𝑀𝑀‖𝑥𝑥 − 𝑦𝑦‖

Here 𝑀𝑀 is the Lipschitz constant or intuitively 𝑀𝑀 represents a function of maximum curvature

If a Hessian exists: 𝑀𝑀 ≥ 𝛻𝛻2𝑓𝑓 𝑥𝑥

The step-size restriction becomes

𝜏𝜏 <2𝑀𝑀

It is generally hard to obtain a value of 𝑀𝑀

There are methods to find “best” 𝜏𝜏 for each step and are called Line Search Methods

Page 26: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Recall Condition Number

9/26/2017 26

𝜅𝜅 denotes how sensitive the function is to noise or in other words how circular are the iso-contours

Page 27: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

The “Best” Pre-conditioner

9/26/2017 27

argmin𝑥𝑥

𝑓𝑓(𝑥𝑥) argmin𝑦𝑦

𝑓𝑓(𝐏𝐏𝑦𝑦)𝑥𝑥 = 𝐏𝐏𝑦𝑦

Hessians𝐇𝐇 𝐏𝐏𝐓𝐓𝐇𝐇𝐏𝐏

When 𝐏𝐏 = 𝐇𝐇−𝟏𝟏𝟐𝟐,𝐏𝐏𝐓𝐓𝐇𝐇𝐏𝐏 = 𝐇𝐇−𝟏𝟏𝟐𝟐𝐇𝐇𝐇𝐇−𝟏𝟏𝟐𝟐 = 𝐈𝐈

𝑃𝑃

Page 28: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Newton’s Method

9/26/2017 28

argmin𝑥𝑥

𝑓𝑓(𝑥𝑥) argmin𝑦𝑦

𝑓𝑓 𝐇𝐇−12𝑦𝑦𝑥𝑥 = 𝐇𝐇−12𝑦𝑦

Gradient Step becomes 𝑦𝑦𝑘𝑘+1 = 𝑦𝑦𝑘𝑘 − 𝐇𝐇−12𝛻𝛻𝑓𝑓 𝐇𝐇−12𝑦𝑦𝑘𝑘

Changing back variables to 𝑥𝑥 we get

𝑥𝑥𝑡𝑡+1 = 𝑥𝑥𝑡𝑡 − 𝐇𝐇−1𝛻𝛻𝑓𝑓(𝑥𝑥𝑡𝑡)

−𝐇𝐇−1𝛻𝛻𝑓𝑓(𝑥𝑥𝑡𝑡) is called the Newton direction

Page 29: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Gauss Newton Method

9/26/2017 29

Modification of Newton’s method to find minimum of a sum of squared function valuesLet the function we are minimizing be

𝐹𝐹 𝑥𝑥 =12�𝑖𝑖=1

𝑚𝑚

𝑓𝑓𝑖𝑖 𝑥𝑥 2 =12

𝑓𝑓 𝑥𝑥 2 =12𝑓𝑓 𝑥𝑥 𝑇𝑇𝑓𝑓 𝑥𝑥

Our problem setup is as follows: argmin𝑥𝑥

𝐹𝐹(𝑥𝑥)

The gradient vector 𝑔𝑔 is obtained as follows,

𝑔𝑔𝑗𝑗 = �𝑖𝑖=1

𝑚𝑚

𝑓𝑓𝑖𝑖𝜕𝜕𝑓𝑓𝑖𝑖𝜕𝜕𝑥𝑥𝑗𝑗

To obtain the Hessian we need to differentiate the gradient elements with respect to 𝑥𝑥𝑘𝑘

𝐻𝐻𝑗𝑗𝑘𝑘 = �𝑖𝑖=1

𝑚𝑚𝜕𝜕𝑓𝑓𝑖𝑖𝜕𝜕𝑥𝑥𝑗𝑗

𝜕𝜕𝑓𝑓𝑖𝑖𝜕𝜕𝑥𝑥𝑘𝑘

+ 𝑓𝑓𝑖𝑖𝜕𝜕2𝑓𝑓𝑖𝑖𝜕𝜕𝑥𝑥𝑗𝑗𝜕𝜕𝑥𝑥𝑘𝑘

Page 30: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Gauss Newton Method

9/26/2017 30

𝐻𝐻𝑗𝑗𝑘𝑘 = �𝑖𝑖=1

𝑚𝑚𝜕𝜕𝑓𝑓𝑖𝑖𝜕𝜕𝑥𝑥𝑗𝑗

𝜕𝜕𝑓𝑓𝑖𝑖𝜕𝜕𝑥𝑥𝑘𝑘

+ 𝑓𝑓𝑖𝑖𝜕𝜕2𝑓𝑓𝑖𝑖

𝜕𝜕𝑥𝑥𝑗𝑗𝜕𝜕𝑥𝑥𝑘𝑘Now, ignore all the second-order derivative terms (second term) in the above expression

𝐻𝐻𝑗𝑗𝑘𝑘 ≈�𝑖𝑖=1

𝑚𝑚

𝐽𝐽𝑖𝑖𝑗𝑗𝐽𝐽𝑖𝑖𝑘𝑘

Where 𝐽𝐽𝑖𝑖𝑗𝑗 = 𝜕𝜕𝑓𝑓𝑖𝑖𝜕𝜕𝑥𝑥𝑗𝑗

are the components of the Jacobian Matrix 𝐉𝐉

Now, 𝑔𝑔 = 𝐉𝐉𝑇𝑇𝑓𝑓 and 𝐇𝐇 ≈ 𝐉𝐉𝑇𝑇𝐉𝐉The update equations for Gauss Newton method become

𝑥𝑥𝑡𝑡+1 = 𝑥𝑥𝑡𝑡 − 𝐉𝐉𝑇𝑇𝐉𝐉 −1𝐉𝐉𝑇𝑇𝑓𝑓Why is this better than Newton’s Method with the update rule 𝑥𝑥𝑡𝑡+1 = 𝑥𝑥𝑡𝑡 − 𝐇𝐇−1𝛻𝛻𝑓𝑓 𝑥𝑥𝑡𝑡 = 𝑥𝑥𝑡𝑡 − 𝐇𝐇−1𝐉𝐉𝑇𝑇𝑓𝑓Complicated Hessian computation is avoided

Page 31: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Levenberg–Marquardt (LM) Method

9/26/2017 31

Also called “Damped Least Squares”The update rule is

𝑥𝑥𝑡𝑡+1 = 𝑥𝑥𝑡𝑡 − �𝐇𝐇−1𝛻𝛻𝑓𝑓 𝑥𝑥𝑡𝑡Here �𝐇𝐇 is modified Hessian

�𝐇𝐇 = 𝑯𝑯 + 𝜆𝜆diag 𝐇𝐇LM method blends the Steepest Descent method and Newton’s methodRecall steepest descent method update rule is

𝑥𝑥𝑡𝑡+1 = 𝑥𝑥𝑡𝑡 − 𝜏𝜏𝛻𝛻𝑓𝑓 𝑥𝑥𝑡𝑡And Newton’s method update rule is

𝑥𝑥𝑡𝑡+1 = 𝑥𝑥𝑡𝑡 − 𝐇𝐇−1𝛻𝛻𝑓𝑓 𝑥𝑥𝑡𝑡• Steepest descent works well when we are far from minima and Newton’s method which assumes local

quadratic approximation works well near the minima as the quadratic approximation is good• In the LM update rule when 𝜆𝜆 gets small the rule approaches Newton’s method and when 𝜆𝜆 is large LM

approaches steepest descent

Page 32: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Dogleg Method

9/26/2017 32

Chooses between steepest descent (Cauchy) step and Gauss-Newton step

Let ℎ = 𝑥𝑥𝑡𝑡+1 − 𝑥𝑥𝑡𝑡 be the update rule such that 𝑥𝑥𝑡𝑡+1 = 𝑥𝑥𝑡𝑡 + ℎ

Cauchy step is given by ℎ𝐶𝐶 = −𝜏𝜏𝐉𝐉𝑇𝑇𝑓𝑓

Gauss-Newton step is given by ℎ𝐺𝐺𝐺𝐺 = − 𝐉𝐉𝑇𝑇𝐉𝐉 −1𝐉𝐉𝑇𝑇𝑓𝑓

Dogleg uses a region of trust Δ around the linearization point to choose between Cauchy and GN

steps

ℎ𝑑𝑑𝑙𝑙 = ℎ𝐶𝐶 + 𝜆𝜆 𝑑𝑑𝐺𝐺𝐺𝐺 − 𝑑𝑑𝐶𝐶Here 𝜆𝜆 ∈ 0,1 is the largest value in such that ℎ𝑑𝑑𝑙𝑙 ≤ Δ

If 𝐉𝐉 is nearly singular then ℎ𝑑𝑑𝑙𝑙 = ℎ𝐶𝐶Update rule is: 𝑥𝑥𝑡𝑡+1 = 𝑥𝑥𝑡𝑡 + ℎ𝑑𝑑𝑙𝑙

Page 33: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

Ordering

9/26/2017 33

• Selecting the correct column ordering matters since it decides the sparsity of information matrix

• Use COLAMD to find the best ordering just based on information matrix

• COLAMD stands for “COLumnApproximate Minimum Degree permutation”

Original Data

Original Data LU

COLAMD Data

COLAMD Data LU

Sparsity patterns

Page 34: CMSC828 Integration Of Vision, Planning And Control In ... GTSAM.pdf · z Robot State 9/26/2017 5 Robot State is given by, 𝒙𝒙= 𝑥𝑥 𝑦𝑦 𝜃𝜃 Because this varies

z

References

9/26/2017 34

• GTSAM4 Tutorial Slides: https://www.cc.gatech.edu/grads/j/jdong37/files/gtsam-tutorial.pdf• Frank Dallert’s Hands-On GTSAM Tutorial:

https://research.cc.gatech.edu/borg/sites/edu.borg/files/downloads/gtsam.pdf• Tom Goldstein’s amazing optimization slides:

https://www.cs.umd.edu/~tomg/course/764_2017/L7_grad_descent.pdf• Boyd’s Optimization book: https://web.stanford.edu/~boyd/cvxbook/• Simple Optimization: https://www.neuraldesigner.com/blog/5_algorithms_to_train_a_neural_network• Matlab’s Optimization: https://www.mathworks.com/help/optim/ug/equation-solving-algorithms.html#f51887• LM Optimizer: https://www.cs.nyu.edu/~roweis/notes/lm.pdf• Dogleg Optimizer: http://ceres-solver.org/nnls_solving.html• COLAMD: https://www.mathworks.com/help/matlab/ref/colamd.html


Recommended