SLAM Techniques and Algorithms - CRV · PDF fileDefence Research and Development Canada...

Post on 06-Feb-2018

213 views 1 download

Transcript of SLAM Techniques and Algorithms - CRV · PDF fileDefence Research and Development Canada...

Defence Research andDevelopment Canada

Recherche et développementpour la défense Canada Canada

SLAM Techniques and Algorithms

Jack Collier

Defence R&D Canada    •    R & D pour la défense Canada

Goals

What will we learn

Gain an appreciation for what SLAM is and canaccomplish

Understand the underlying theory behind SLAM

Understand the terminology and fundamentalbuilding blocks of SLAM algorithms

Appreciate the deficiencies of SLAM and SLAMalgorithms

Won’t focus on the math, but the concept

Online non-linear feature based SLAM withunknown data association

Defence R&D Canada    •    R & D pour la défense Canada

Outline

What is SLAM?

Probabilistic basis of SLAM

EKF SLAM

Data Association

Closing the Loop

FastSLAM

Sub-Mapping SLAM

Resources

Questions?

Defence R&D Canada    •    R & D pour la défense Canada

What is SLAM?

Simultaneous Localization and Mapping

Given an unknown environment and vehicle pose:

Move through the environmentEstimate the robot poseGenerate a map of environmental features

Use the robot pose estimate to improve the maplandmark position estimates

Use the landmark estimates to improve the robotpose estimate

Defence R&D Canada    •    R & D pour la défense Canada

What is SLAM?and why do we need it?

Robot motion models aren’t accurate

Wheel odometry error is cumulative

IMU sensors errors

Maps are generated from sensors on the vehicle. If wecan’t accurately predict the robot pose then how can weproduce an accurate map.

GPS can help but is not always available or reliable.

Defence R&D Canada    •    R & D pour la défense Canada

What is SLAM?and why do we need it?

Defence R&D Canada    •    R & D pour la défense Canada

What is SLAM?and why do we need it?

Defence R&D Canada    •    R & D pour la défense Canada

What is SLAM?The SLAM problem

Given:

Robot control signal uk (or measurement)

A set of feature observations zK (sensormeasurements)

Estimate:

Map of landmarks Mk+1

Robot Pose Vk+1

Sources of Error:

Control signal

Mapping sensor

Motion model

Observation model

Defence R&D Canada    •    R & D pour la défense Canada

Probabilistic Basis of SLAMProbability Theory

Probability Theory gives us a framework for dealingwith these sources of error

The online SLAM theory is:p(Vk+1,Mk+1|zk , uk)

Estimate the Joint Probability of Vk+1 and Mk+1

conditioned on zk , uk (Joint Conditional PDF)

Defence R&D Canada    •    R & D pour la défense Canada

Probabilistic Basis of SLAMSLAM Probability toolkit

Conditional Probability p(x |y) = p(x ,y)p(y)

Product Rule p(x , y) = p(x |y)p(y)

Bayes Rule p(x |y) = p(y |x)p(x)p(y)

or

p(x |y) = ηp(y |x)p(x)

Gaussian PDFp(x) = det(2πΣ)−

12 exp−1

2(x − x̄)T Σ−1(x − x̄)

Defence R&D Canada    •    R & D pour la défense Canada

Probabilistic Basis of SLAMSLAM as a Bayesian filter

p(Vk+1,Mk+1|zk+1, uk+1) =

ηp(zk+1|Vk+1,Mk+1)p(Vk+1,Mk+1|zk , uk+1) (Bayes Filter) =ηp(zk+1|Vk+1,Mk+1)

∫p(Vk+1,Mk+1|Vk , zk , uk+1)p(Vk |zk , uk+1)dvk

Defence R&D Canada    •    R & D pour la défense Canada

Probabilistic Basis of SLAMSLAM as a Bayesian filter

p(Vk+1,Mk+1|zk+1, uk+1) =ηp(zk+1|Vk+1,Mk+1)p(Vk+1,Mk+1|zk , uk+1) (Bayes Filter)

=ηp(zk+1|Vk+1,Mk+1)

∫p(Vk+1,Mk+1|Vk , zk , uk+1)p(Vk |zk , uk+1)dvk

Defence R&D Canada    •    R & D pour la défense Canada

Probabilistic Basis of SLAMSLAM as a Bayesian filter

p(Vk+1,Mk+1|zk+1, uk+1) =ηp(zk+1|Vk+1,Mk+1)p(Vk+1,Mk+1|zk , uk+1) (Bayes Filter) =ηp(zk+1|Vk+1,Mk+1)

∫p(Vk+1,Mk+1|Vk , zk , uk+1)p(Vk |zk , uk+1)dvk

Defence R&D Canada    •    R & D pour la défense Canada

Probabilistic Basis of SLAMSLAM as a Bayesian filter

p(Vk+1,Mk+1|zk+1, uk+1) =ηp(zk+1|Vk+1,Mk+1)p(Vk+1,Mk+1|zk , uk+1) (Bayes Filter) =ηp(zk+1|Vk+1,Mk+1)

∫p(Vk+1,Mk+1|Vk , zk , uk+1)p(Vk |zk , uk+1)dvk

= ηp(zk+1|Vk+1,Mk+1)∫

p(Vk+1|Vk , uk)p(Vk ,Mk |zk , uk)dvk

No closed form solution

Approximate the solution using an Extended Kalman Filter

Defence R&D Canada    •    R & D pour la défense Canada

Probabilistic Basis of SLAMSLAM as a Bayesian filter

p(Vk+1,Mk+1|zk+1, uk+1) =ηp(zk+1|Vk+1,Mk+1)p(Vk+1,Mk+1|zk , uk+1) (Bayes Filter) =ηp(zk+1|Vk+1,Mk+1)

∫p(Vk+1,Mk+1|Vk , zk , uk+1)p(Vk |zk , uk+1)dvk

= ηp(zk+1|Vk+1,Mk+1)∫

p(Vk+1|Vk , uk)p(Vk,Mk|zk,uk)dvk

Prior probability:Prior state and covariance estimates from the last filter iteration

Defence R&D Canada    •    R & D pour la défense Canada

Probabilistic Basis of SLAMSLAM as a Bayesian filter

p(Vk+1,Mk+1|zk+1, uk+1) =ηp(zk+1|Vk+1,Mk+1)p(Vk+1,Mk+1|zk , uk+1) (Bayes Filter) =ηp(zk+1|Vk+1,Mk+1)

∫p(Vk+1,Mk+1|Vk , zk , uk+1)p(Vk |zk , uk+1)dvk

= ηp(zk+1|Vk+1,Mk+1)∫

p(Vk+1|Vk,uk)p(Vk ,Mk |zk , uk)dvk

Motion Model:Probabilistic motion model estimates the new vehicle pose covari-ance estimates from the prior estimate and the control

Defence R&D Canada    •    R & D pour la défense Canada

Probabilistic Basis of SLAMSLAM as a Bayesian filter

p(Vk+1,Mk+1|zk+1, uk+1) =ηp(zk+1|Vk+1,Mk+1)p(Vk+1,Mk+1|zk , uk+1) (Bayes Filter) =ηp(zk+1|Vk+1,Mk+1)

∫p(Vk+1,Mk+1|Vk , zk , uk+1)p(Vk |zk , uk+1)dvk

= ηp(zk+1|Vk+1,Mk+1)∫

p(Vk+1|Vk , uk)p(Vk ,Mk |zk , uk)dvk

Measurement Model:Measurement model gives the expected value of the feature obser-vations.

Defence R&D Canada    •    R & D pour la défense Canada

Probabilistic Basis of SLAMGaussian PDF

Defence R&D Canada    •    R & D pour la défense Canada

Probabilistic Basis of SLAMGaussian PDF

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAM

Simultaneous Localization and Mapping:

Joint estimate both robot pose and position ofunique landmarks

Landmark estimates improve robot pose estimatesand vice versa

Use standard Extended Kalman Filtering techniques

Assumes Gaussian noise and error.

Mk =

xm1

ym1...

xmn

ymn

, Vk =

x rk

y rk

θrk

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMAlgorithm

Xk =

(Vk

Mk

), Pk =

(Pv Pvm

PTvm Pm

)(1)

Prediction - A prediction of the new state vector andcovariance matrix is calculated from the previous stateand covariance, and the new control uk .

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMAlgorithm

Xk =

(Vk

Mk

), Pk =

(Pv Pvm

PTvm Pm

)(1)

Data Association - Find matches between the currentlandmarks Mk and the new set of observed features zk .

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMAlgorithm

Xk =

(Vk

Mk

), Pk =

(Pv Pvm

PTvm Pm

)(1)

Measurement Update - Calculate the Kalman gain foreach observed landmark and update the state and covari-ance values based on that Kalman gain and the measure-ment innovation.

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMAlgorithm

Xk =

(Vk

Mk

), Pk =

(Pv Pvm

PTvm Pm

)(1)

Augmentation - Integrate newly observed landmarks intothe state vector and covariance matrix.

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMLinearization

Kalman Filters work under a linear Gaussianassumption

Robot motion and measurement functions arenon-linear

Use Taylor Expansion to linearize (Approximate aGaussian)g ≈ g + g ′

g ′ is Jacobian of the function with respect to itsvariables

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMLinearization

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMPrediction

Predict the robot motion from the control signal

Linearize to approximate the Gaussian

V̄k+1 = Vk + ∆V

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMPrediction

Predict the robot motion from the control signal

Linearize to approximate the Gaussian

Vk+1 =

x rk

y rk

θrk

+

− vk

ωksin(θr

k) + vk

ωksin(θr

k + ωk∆t)vk

ωkcos(θr

k)− vk

ωkcos(θr

k + ωk∆t)

ωk∆t

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMPrediction

Predict the robot motion from the control signal

Linearize to approximate the Gaussian

P̄v(k+1) = GkPv(k)GTk

P̄vm(k+1) = RkQRTk

P̄k+1 =

(P̄v(k+1) P̄vm(k+1)

P̄Tvm(k+1) Pm

)

G linearizes the state transition functionR maps additional motion noise into the state space

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMFeature Extraction Algorithms

Extract stable salient features from environment):

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMFeature Extraction Algorithms

What do we want in feature extraction algorithm?

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMFeature Extraction Algorithms

What do we want in feature extraction algorithm?

Stable features

Outlier rejection

Accuracy

Speed

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMFeature Extraction Algorithms

What do we want in feature extraction algorithm?

Expectation Maximization

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMFeature Extraction Algorithms

What do we want in feature extraction algorithm?

RANSAC

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMFeature Extraction Algorithms

What do we want in feature extraction algorithm?

Split and Merge

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMFeature Extraction Algorithms

What do we want in feature extraction algorithm?

Hough Transform

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMFeature Extraction Algorithms

What do we want in feature extraction algorithm?

Incremental Line Fitting

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMLaser Feature Extraction

Extract features from Raw laserdata

Incremental algorithm (linetracking)

Fit a line to a set of pointsCompute the residualIf below error threshold addanother point and repeatIf above the last point addedis a feature

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMData Association

Find matches between features and landmarks

For each feature

Calculate the predicted feature for each landmark(measurement model)compute the Mahalanobis Distance:choose the feature/landmark with the lowestdistance (Maximum Likelihood) below somethreshold

End for

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMData Association

Measurement Model:

zmj =

(rmj

βmj

)=

( √∆y 2 + ∆x2

arctan (∆y ,∆x)

)

Mahalanobis Distance normalizes feature/landmarkdistance based on their covariances:

dij = (zi − zmj )T (Hj

¯Pk+1HjT + R)−1(zi − zm

j )

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMData Association

Measurement Model:

zmj =

(rmj

βmj

)=

( √∆y 2 + ∆x2

arctan (∆y ,∆x)

)Mahalanobis Distance normalizes feature/landmarkdistance based on their covariances:

dij = (zi − zmj )T (Hj

¯Pk+1HjT + R)−1(zi − zm

j )

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMWhy Mahalanobis Distance?

Why Mahalanobis Distance:

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMWhy Mahalanobis Distance?

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMWhy Mahalanobis Distance?

Points which lie on the same covariance ellipse have areequidistant

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMUpdate

For each data association

Calculate Kalman Gain:Kj = P̄k+1Hj

T (Hj P̄k+1HjT + R)−1

H linearizes the measurement modelUpdate state and covariance estimates:Xk+1 = X̄k+1 + Kj(zi − zm

j )

Pk+1 = P̄k+1 − KjHj P̄k+1

End for

Innovation vector - Larger → bigger correction

Kalman Gain - Weights the innovation vector.Smaller measurement error → higher gain (trustthe measurement)Smaller covariance → smaller gain (trust theprediction)

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMAugment

State Vector and Covariance matrix grow as newlandmarks are observed

If a feature has no matches, add it to the statevector as a new landmark

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMAugment

New Landmark Locations:

xmi = x r

k + ri cos(θrk + βi)

ymi = y r

k + ri sin(θrk + βi)

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMAugment

Append to state vector:

X =

Xxmi

ymi

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMAugment

Original Covariance Matrix:

P =

(Pv Pvm

PvmT Pm

)

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMAugment

Augmented Covariance Matrix:

Pa =

Pv Pvm PvTFi

T

PvmT Pm Pvm

TFiT

FiPv FiPvm FiPvFiT + MiRMi

T

F and M are the Jacobians which linearize the new land-mark equations with respect to vehicle pose and measure-ment variables respectively

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMOther Issues

Can use provisional landmark list to reject spuriousfeatures

Pruning (removing old/irrelevant landmarks)

Landmark Signatures (reflectivity/color/shape/etc.)

Landmark minimum distance

Intelligent update (Only update relevant landmarks)

Sub-Mapping (more on this later)

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMAdvantages

Straightforward application of the EKF

Large body of research to pull from

Works reasonably well for small number of featuresand distinct landmarks

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMDisadvantages

Complexity Quadratic with number of features

No guarantee of convergence in non-linear case

Make hard decisions about data associations

Can’t correct for erroneous data associations

Need sufficiently distinct landmarks (low clutter)

Gaussian Assumption

Defence R&D Canada    •    R & D pour la défense Canada

EKF SLAMVariants

Unscented KF SLAM

Linearization using Sigma pointsPreserves the true mean and covariance of theposterior

Extended Information Filter SLAM

Dual representation of EKFLess complex measurement update

Defence R&D Canada    •    R & D pour la défense Canada

Data AssociationErroneous data association WILL cause SLAM to fail!

1 feature to 2 landmarks

2 features to 1 landmark

clutter

Symmetry

Reduce the maxMahalanobis distance?

Defence R&D Canada    •    R & D pour la défense Canada

Data Association

How do determine the correspondence between a featureand landmark?

Individual Compatibility

Joint Compatibility Branch and Bound

Combined Constrained Data Association

Randomized Joint Compatibility

Multi hypothesis Data Association

Defence R&D Canada    •    R & D pour la défense Canada

Data AssociationIndividual Compatibility

Calculate Mahalanobis distance from each featureto landmark

Choose feature with smallest distance to landmarkwithin threshold (validation gate)

Disregard ambiguous associations

Advantage: Simple

Disadvantage: Can be error prone especially inclutter

Defence R&D Canada    •    R & D pour la défense Canada

Data AssociationJoint Compatibility Branch and

Bound

Consider multiple associations simultaneously

Find the largest set of matches which correspond

Joint Mahalanobis distance measurement with jointvalidation gate

Branch and bound interpretation tree search

Advantage: Robust

Disadvantage: Tree search computation/May beAmbiguous sets

Defence R&D Canada    •    R & D pour la défense Canada

Data AssociationJoint Compatibility Branch and

Bound

PotentialMatchesz1→ L1 or L2z2→ L2 or L3z3→ L4Null

Defence R&D Canada    •    R & D pour la défense Canada

Data AssociationJoint Compatibility Branch and

Bound

Defence R&D Canada    •    R & D pour la défense Canada

Data AssociationCombined Constrained Data

Association

Correspondence Graph technique

Nodes are individually compatible associations

Edges are compatible associations

Find the maximum clique of associations that aremutually compatible

Consider both relative and absolute constraints

Advantage: Can work with no pose info (relativeconstraints)

Disadvantage: May be ambiguous sets

Defence R&D Canada    •    R & D pour la défense Canada

Data AssociationRandomized Joint Compatibility

JCBB with RANSAC

Uses relative constraints

Randomly select m of the n feature measurements

Advantage: Reduced complexity, no pose necessary

Disadvantage: Don’t always know Pfail and Pgood

Defence R&D Canada    •    R & D pour la défense Canada

Closing the LoopWhat is loop closing?

Even with the best SLAM algorithm poseuncertainty will increase as the vehicle moves.

This pose uncertainty means that landmarklocations further from the map origin have a higheruncertainty

Revisiting a previously observed landmarkssignificantly reduces uncertainty in robot andlandmark pose estimates

Errors in landmark estimates are correlated withrobot pose

New pose info necessarily improved landmarkestimates

Defence R&D Canada    •    R & D pour la défense Canada

Closing the LoopHow to Close the loop

Map Matching Techniques (feature matching)Can use pose estimate to constrain the searchExpectation Maximization AlgorithmNon-linear Optimization

Defence R&D Canada    •    R & D pour la défense Canada

FastSLAMRepresent probability distributions by set of particlesRao-Blackwellized particle filter (low dimensionalEKFs)Each particle maintains its own pose and mapestimates (multi-hypothesis)Each landmark has its own EKFN landmarks and M particles we have MxN + 1filters

Defence R&D Canada    •    R & D pour la défense Canada

FastSLAMAlgorithm

Do M times:

Retrieve pose from particle k

Predict a new pose (motion model)

Data Association

Measurement Update

Importance Weight

ENDRe-sample with Replacement using the importanceweight

Raw Odometry

FastSLAM

Defence R&D Canada    •    R & D pour la défense Canada

FastSLAMAdvantages

Time logarithmic to number of landmarks

Multi-hypothesis data association (robustness)

No linearization of non-linear motion models

Solves both full SLAM and Online SLAM problems

Defence R&D Canada    •    R & D pour la défense Canada

FastSLAMDisadvantages

Throws away correlations

Over optimistic pose estimate

Harder to close the loop

Defence R&D Canada    •    R & D pour la défense Canada

Sub-Mapping SLAM

Partition SLAM into sub-mapsOptimally Fuse at a global level periodicallyReduces EKF linearization errorsReduces computational complexityClosing the loop techniques for sub-maps

Defence R&D Canada    •    R & D pour la défense Canada

Sub-Mapping SLAMAlgorithms

ATLAS

Hybrid-SLAM

Decoupled Stochastic Mapping

Hierarchical SLAM

Conditionally In dependant SLAM

Divide and Conquer

EKF SLAM vs. D&C SLAM

Defence R&D Canada    •    R & D pour la défense Canada

Other Topics

Visual SLAM

SIFT, Harris Corners, SURF, etc. for featuresNo range to featuresInverse Depth

Muti-robot SLAM

Teams map buildingInformation sharing/cooperation

Learning for SLAM

Adaptive SLAMLearnt sensor, observation, motion models

6-DOF SLAM/Mesh Models

Feature Extraction Algorithms

Scan matching

Defence R&D Canada    •    R & D pour la défense Canada

Resources

Probabilistic Robotics

SLAM Summer School 2009http://www.acfr.usyd.edu.au/education/summerschool.shtml

openslam.org (MATLAB, C, Different algorithms,data sets, etc.)

Defence R&D Canada    •    R & D pour la défense Canada

Questions?