L15. POSE RAPH SLAM -...

49
L15. POSE-GRAPH SLAM NA568 Mobile Robotics: Methods & Algorithms

Transcript of L15. POSE RAPH SLAM -...

Page 1: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

L15. POSE-GRAPH SLAM NA568 Mobile Robotics: Methods & Algorithms

Page 2: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Today’s Topic

Nonlinear Least Squares Pose-Graph SLAM Incremental Smoothing and Mapping

Page 3: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

... ...

Filtering Problem: Motion Prediction Causes Fill-in

Conceptual Abstraction: Full-SLAM Marginalize out the Poses

-1

Feature-Based SLAM

Page 4: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

In feature-based SLAM, the information matrix fills in unless we enforce approximations to make it sparse This is because we are continually marginalizing out the

robot trajectory from the state representation

What if we were to marginalize out the landmarks instead?

... ... Feature-Based SLAM

-1

Feature-Based SLAM

Pose-Base SLAM

-1

... ...

Page 5: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

5

... ...

Feature-based SLAM requires approximations to enforce sparsity.

Furthermore, this approximation is non-trivial.

Pose-Graph SLAM

Conceptual Abstraction: Full-SLAM Marginalize out the Landmarks

-1

Key idea: marginalizing out the landmarks preserves locality

... ...

Page 6: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Three Main SLAM Paradigms

Kalman filter

Particle filter

Graph-based

least squares approach to SLAM

Courtesy: C. Stachniss

Page 7: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Least Squares in General

Approach for computing a solution for an overdetermined system

“More equations than unknowns” Minimizes the sum of the squared errors in the

equations Standard approach to a large set of problems

Today: Application to SLAM

Courtesy: C. Stachniss

Page 8: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Robot pose Constraint

Graph-Based SLAM

Constraints connect the poses of the robot while it is moving

Constraints are inherently uncertain

Courtesy: C. Stachniss

Page 9: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Graph-Based SLAM

Observing previously seen areas generates constraints between non-successive poses

Robot pose Constraint Courtesy: C. Stachniss

Page 10: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Idea of Graph-Based SLAM

Use a graph to represent the problem Every node in the graph corresponds to a pose of

the robot during mapping Every edge between two nodes corresponds to a

spatial constraint between them Graph-Based SLAM: Build the graph and find a

node configuration that minimizes the error introduced by the constraints

Courtesy: C. Stachniss

Page 11: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Graph-Based SLAM in a Nutshell Every node in the graph

corresponds to a robot position and a laser measurement

An edge between two nodes represents a spatial constraint between the nodes

KUKA Halle 22, courtesy of P. Pfaff Courtesy: C. Stachniss

Page 12: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Graph-Based SLAM in a Nutshell Every node in the graph

corresponds to a robot position and a laser measurement

An edge between two nodes represents a spatial constraint between the nodes

KUKA Halle 22, courtesy of P. Pfaff Courtesy: C. Stachniss

Page 13: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Graph-Based SLAM in a Nutshell Once we have the graph, we

determine the most likely map by correcting the nodes

Courtesy: C. Stachniss

Page 14: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Graph-Based SLAM in a Nutshell Once we have the graph, we

determine the most likely map by correcting the nodes

… like this

Courtesy: C. Stachniss

Page 15: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Graph-Based SLAM in a Nutshell Once we have the graph, we

determine the most likely map by correcting the nodes

… like this Then, we can render a map

based on the known poses

Courtesy: C. Stachniss

Page 16: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

The Overall SLAM System

Interplay of front-end and back-end Map helps to determine constraints by reducing the

search space Topic today: optimization

Graph Construction

(Front-End)

Graph Optimization

(Back-End)

raw data graph

(nodes & edges)

node positions

today Courtesy: C. Stachniss

Page 17: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

The Graph

It consists of n nodes Each is a 2D or 3D transformation (the pose of

the robot at time ) A constraint/edge exists between the nodes and

if…

Courtesy: C. Stachniss

Page 18: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Create an Edge If… (1)

…the robot moves from to Edge corresponds to odometry

The edge represents the odometry measurement

Courtesy: C. Stachniss

Page 19: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Create an Edge If… (2)

…the robot observes the same part of the environment from and from

Measurement from Measurement from Courtesy: C. Stachniss

Page 20: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Edge represents the position of seen from based on the observation

Create an Edge If… (2)

…the robot observes the same part of the environment from and from

Construct a virtual measurement about the position of seen from

Courtesy: C. Stachniss

Page 21: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Transformations Transformations can be expressed using homogenous

coordinates

Odometry-Based edge

Observation-Based edge

How node i sees node j

Courtesy: C. Stachniss

Page 22: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Courtesy: M. Kaess

Page 23: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Visual SLAM: Why Filter?

Courtesy: M. Kaess

Page 24: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Visual SLAM

Courtesy: M. Kaess

Page 25: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

The SLAM Problem (t=0)

Robot

Landmark

Landmark measurement

Onboard sensors: – Wheel odometry – Inertial measurement unit

(gyro, accelerometer) – Sonar – Laser range finder – Camera – RGB-D sensors

Courtesy: M. Kaess

Page 26: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

The SLAM Problem (t=1)

Robot

Landmark 1 Landmark 2

Odometry measurement

Landmark measurement

Courtesy: M. Kaess

Page 27: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

The SLAM Problem (t=n-1)

Robot

Landmark 1 Landmark 2

Odometry measurement

Landmark measurement

Courtesy: M. Kaess

Page 28: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

The SLAM Problem (t=n)

Odometry measurement

Landmark measurement

Courtesy: M. Kaess

Page 29: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Factor Graph Representation

Robot pose

Landmark position

Landmark measurement

Odometry measurement

Bipartite graph with variable nodes and factor nodes

Courtesy: M. Kaess

Page 30: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Factor Graph Representation: Pose Graph

Loop closing constraint

Robot pose

Landmark position

Landmark measurement

Odometry measurement

Courtesy: M. Kaess

Bipartite graph with variable nodes and factor nodes

Page 31: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Factor Graph Representation: Bundle Adjust.

Pose

Point

Point measurement

Bipartite graph with variable nodes and factor nodes

Courtesy: M. Kaess

Page 32: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Nonlinear Least-Squares

Repeatedly solve linearized system (GN)

A b Gaussian noise

poses points

[Dellaert and Kaess, IJRR 06]

Courtesy: M. Kaess

Page 33: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Solving the Linear Least-Squares System

ATA A

Measurement Jacobian

Information matrix

Normal equations

Solve:

Courtesy: M. Kaess

Page 34: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Solving the Linear Least-Squares System

Can we simply invert ATA to solve for x?

Yes, but we shouldn’t… The inverse of ATA is dense ! O(n3)

Can do much better by taking advantage of sparsity!

ATA Information matrix

Normal equations

Courtesy: M. Kaess

Page 35: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Solving the Linear Least-Squares System

R

ATA Information matrix

Square root information matrix

Normal equations

Matrix factorization

Solve:

A

Measurement Jacobian

[Dellaert and Kaess, IJRR 06]

Courtesy: M. Kaess

Page 36: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Matrix – Square Root Factorization •QR on A: Numerically More Stable

•Cholesky on ATA: Faster

A QR R

Cholesky R ATA

Courtesy: M. Kaess

Page 37: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Retaining Sparsity: Variable Ordering Fill-in depends on elimination order:

ATA R Default ordering (poses, landmarks)

Ordering based on COLAMD heuristic [Davis04] (best order: NP hard)

factor

permute

factor

[Dellaert and Kaess, IJRR 06]

Courtesy: M. Kaess

Page 38: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Solving by Backsubstitution

After factorization: RTR x = ATb

Forward substitution RTy = ATb, solve for y

Backsubstition R x = y, solve for x

RT

R

Courtesy: M. Kaess

Page 39: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Full Bundle Adjustment

Graph grows with time: Have to solve a sequence of increasingly larger BA

problems Will become too expensive even for sparse Cholesky

F. Dellaert and M. Kaess, “Square Root SAM: Simultaneous localization and

mapping via square root information smoothing,” IJRR 2006

From Strasdat et al, 2011 IVC “Visual SLAM: Why filter?”

Courtesy: M. Kaess

Page 40: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Keyframe Bundle Adjustment

Drop subset of poses to reduce density/complexity Only retain “keyframes” necessary for good map

Complexity still grows with time, just slower

Courtesy: M. Kaess

Page 41: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Filter

Keyframe idea not applicable: map would fall apart Instead, marginalize out previous poses

Extended Kalman Filter (EKF) Problems when used for Visual SLAM:

All points become fully connected ! expensive Relinearization not possible ! inconsistent

Courtesy: M. Kaess

Page 42: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Incremental Solver

Back to full BA and keyframes:

New information is added to the graph Older information does not change Can be exploited to obtain an efficient solution!

Courtesy: M. Kaess

Page 43: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Incremental Smoothing and Mapping (iSAM)

Courtesy: M. Kaess

Page 44: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

iSAM Solving a growing system:

Exact/batch (quickly gets expensive) Approximations Incremental Smoothing and Mapping (iSAM)

Key idea:

Append to existing matrix factorization “Repair” using Givens rotations

Periodic batch steps for Relinearization Variable reordering (to keep sparsity)

R

R’

New measurements ->

[Kaess et al., TRO 08]

Courtesy: M. Kaess

Page 45: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Zeroing entries with Givens Rotations:

Factor Updates with Givens Rotations

Numerically stable !

Old R factor

New rows

New R factor: Triangulated using

Givens Rotations

Constant time!

Courtesy: M. Kaess

Page 46: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Greedy approach Arbitrary placement of newest variable

Variable Reordering – Constrained COLAMD

Much cheaper!

Constrained Ordering Newest variables forced to the end

Number of affected variables: low high

Courtesy: M. Kaess

Page 47: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Variable Reordering – Fill-in Incremental ordering still yields good overall ordering

Only slightly more fill-in than batch COLAMD ordering Constrained ordering is worse than naïve/greedy: Suboptimal ordering because of partial constraint,

but cheaper to update!

Courtesy: M. Kaess

Page 48: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

iSAM

Example from real sequence: Square root inf. matrix Side length: 21000 variables Dense: 1.7GB, sparse: 1MB

233499 non-zeros ≈ 0.1% density ≈ 11/column

R

[Kaess et al., TRO 08]

Courtesy: M. Kaess

Page 49: L15. POSE RAPH SLAM - robots.engin.umich.edurobots.engin.umich.edu/mobilerobotics/media/Prof_Eustice_slides/L... · In feature-based SLAM, the information matrix fills in unless we

Next Lecture

FastSLAM