2019 - Slam I - After Lecture
2019 - Slam I - After Lecture
Margarita Chli
Roland Siegwart and Nick Lawrance
§ Approaches to SLAM:
§ Bundle Adjustment
§ Filtering (UKF/EKF/Particle Filter SLAM)
§ Keyframes
Computer
Vision
&
Robotics
How can a body navigate in a previously unknown environment, while constantly building and
updating a map of its workspace using onboard sensors & onboard computation?
WHEN IS IT NECESSARY?
§ When a robot must be truly autonomous (no human input)
§ When there is no prior knowledge about the environment
§ When we cannot rely exclusively on pre-placed beacons or external positioning systems (e.g.
GPS)
§ When the robot needs to know where it is
§ SLAM
ivation
SLAM | a from
| Maps short history
AerialofImagery
photogrammetry
. Slotted templets being laid at the Soil Conservation Service, U.S. Department of Agriculture.
Points surveyed on the ground: physically nailed into the board. Other tie points: loosely constrain the cardboard templates
act on topographic mapping of developments in land and air survey: 1900-1939. Cartography and Geographic
J.W. 1917. The use of the panoramic camera in Chasseaud, P. 1999. Artillery’s astrologers: A history of
e, 29(3):155–174, 2002.!
aphic surveying . . . Mobile
Autonomous U.S. Geological
Robots Survey. USGS British survey and mapping on the Western Front.
in no. Margarita Chli, Nick Lawrance
657. Washington, and Roland
D.C.: SiegwartAdjustment
Government
Bundle Lewes, Sussex: Mapbooks. 5 May 3, 2014 SLAM I | 8
ASL
Autonomous Systems Lab
Michael J. Broxton, Ara V. Nefian, Zachary Moratto, Taemin Kim, Michael Lundy, and Aleksandr V. Segal, "3D Lunar Terrain Reconstruction
nd
Fig.K.12.
Di. Rigorous photogrammetric
Residuals of check pointsprocessing of hirise
onto HiRISE stereo
image imagery
mosaics for mars
before andtopographic mapping.
ng, IEEE
after BA.Transactions on, (99):1–15,
(a) Before BA 2008.!
(exaggerated
R. Li, J. Hwangbo, Y. Chen, and
50 times). (b) After BA (exaggerated
Geoscience and Remote Sensing,
K. Di. Fig. 14. HiRISE orthophoto draped on corresponding DEM with vertical
R. Li, J. Hwangbo,
Rigorous
Fig. 12. Geoscience
Residuals of
andcheck
Y. Chen,processing
photogrammetric
points
Remote
and K. Di.ofRigorous
onto IEEE
Sensing, HiRISE hirise
image
photogrammetric
stereo
Transactions
imagery
mosaics
on, before
(99):1–15,
processing
for mars
and
2008.!
of hirise
topographic stereo imagery for mars topographic mapping.
mapping.
afterIEEE
BA.Transactions
(a) Before BAon, (99):1–15, 2008.!
(exaggerated 50 times). (b) After BA (exaggerated
200 times). Bundle Adjustment
Autonomous Mobile Robots Paul Furgale
12
200 times).exaggeration of two times.
Paul
May 3, 2014
Furgale Bundle Adjustment Bundle Adjustment
12 May 3, 2014 13 May 3, 2014
Margarita Chli, Nick Lawrance and Roland Siegwart SLAM I | 11
intersection using bundle-adjusted orientation parameters, are
ASL
Autonomous Systems Lab
§ Traditional SLAM:
Pick natural scene features as landmarks, observe their
motion & reason about robot motion
§ Research into:
§ Good features to track, sensors, trackers, representations,
assumptions
§ Ways of dealing with uncertainty in the processes
involved
§ Assumption:
Robot’s uncertainty at starting position is zero
B C
On every frame:
§ Predict how the robot has moved
§ Measure
A
§ Update the internal representations
On every frame:
§ Predict how the robot has moved
§ Measure
A
§ Update the internal representations
On every frame:
§ Predict how the robot has moved
§ Measure
A
§ Update the internal representations
B C
On every frame:
§ Predict how the robot has moved
§ Measure
A
§ Update the internal representations
On every frame:
§ Predict how the robot has moved
§ Measure
A
§ Update the internal representations
On every frame:
§ Predict how the robot has moved
§ Measure
A
§ Update the internal representations
On every frame:
§ Predict how the robot has moved
§ Measure
A
§ Update the internal representations
On every frame:
§ Predict how the robot has moved
§ Measure
A
§ Update the internal representations
§ Robot pose at time t : xt a Robot path up to this time: {x0, x1,…, xt}
m
B2 Cm3
§ Robot motion between time t-1 and t : ut (e.g. control inputs)
a Sequence of robot relative motions: {u0, u1,…, ut}
xt-1 ut
§ The true map of the environment: {m0, m1,…, mN} imag
e
§ At each time t the robot makes measurements zi zi xt
a Set of all measurements (observations): {z0, z1,…, zk} m
A1
§ The Full SLAM problem: estimate the posterior p(x0:t ,m0:N | z0:k ,u0:t )
§ The Online SLAM problem: estimate the posterior p(xt ,m0:N | z0:k ,u0:t )
Autonomous Mobile Robots
Margarita Chli, Nick Lawrance and Roland Siegwart SLAM I | 24
ASL
Autonomous Systems Lab
m0 m1 m2 m3 m4 m5 m6 m7 m8
x0 x1 x2 x3 . . .
u0 u1 u2 u3
x0 x1 x2 x3
§ Eliminate observations & control-input nodes and solve for the constraints between poses and
landmarks.
§ Globally consistent solution, but infeasible for large-scale SLAM
Filtering
m0 m1 m2 m3 m4 m5 m6 m7 m8
x0 x1 x2 x3
§ Eliminate all past poses: ‘summarize’ all experience with respect to the last pose, using a state
vector and the associated covariance matrix
SLAM | filtering
x0 x1
§ Pros
ü Can run online
ü Works well for problems experiencing
expected perturbations/uncertainty
§ Cons
x Unimodal estimate
x States must be well approximated by a Gaussian
x The vanilla implementation does not scale very well with larger maps
Autonomous Mobile Robots
Margarita Chli, Nick Lawrance and Roland Siegwart SLAM I | 29
ASL
Autonomous Systems Lab
SLAM | filtering
x0 x1
§ Particle Filtering
pi = { y ti , wi }
§ Represents belief by a series of samples
§ Each Particle = a hypothesis of the state with an
associated weight (all weights should add up to 1)
§ Follows the “predict/measure/update” approach
§ Assumption:
Robot’s uncertainty at starting position is zero
B C
On every frame:
§ Predict how the robot has moved
§ Measure
A
§ Update the internal representations
On every frame:
§ Predict how the robot has moved
§ Measure
A
§ Update the internal representations
On every frame:
§ Predict how the robot has moved
§ Measure
A
§ Update the internal representations
B C
On every frame:
§ Predict how the robot has moved
§ Measure
A
§ Update the internal representations
On every frame:
§ Predict how the robot has moved
§ Measure
A
§ Update the internal representations
On every frame:
§ Predict how the robot has moved
§ Measure
A
§ Update the internal representations
On every frame:
§ Predict how the robot has moved
§ Measure
A
§ Update the internal representations
On every frame:
§ Predict how the robot has moved
§ Measure
A
§ Update the internal representations
On every frame:
§ Predict how the robot has moved
§ Measure
A
§ Update the internal representations
SLAM | filtering
x0 x1
§ Pros
ü Noise densities can be from any distribution
ü Works for multi-modal distributions
ü Easy to implement
§ Cons
x Does not scale to high-dimensional problems Distribution in the robot’s position estimate:
x Requires many particles to have good convergence • red dots – particle filtering
• red ellipse – EKF filtering
Autonomous Mobile Robots
Margarita Chli, Nick Lawrance and Roland Siegwart SLAM I | 41
ASL
Autonomous Systems Lab
Key-frames
m0 m1 m2 m3 m4 m5 m6 m7 m8
x0 x1 x2 x3
§ Retain the most ‘representative’ poses (key-frames) and their dependency links a optimize the
resulting graph
SLAM | keyframes
§ Keyframe-based SLAM
[PTAM, Klein & Murray, ISMAR 2007]
§ Minimizes the least-squares cost function
§ Typically optimizes over a window of recent
keyframes for efficiency
§ Assumes Gaussian noise densities
§ Pros
ü Known to provide better balance between
accuracy & efficiency than filtering
ü Permits processing of many more features
per frame than filtering
§ Cons
x Size of optimization window affects scalability
and convergence
Autonomous Mobile Robots
Margarita Chli, Nick Lawrance and Roland Siegwart SLAM I | 43
ASL
Autonomous Systems Lab
§ EKF SLAM summarizes all past experience in an extended state vector yt comprising of the
robot pose xt and the position of all the features mi in the map, and an associated covariance
matrix Py : ⎡ xt ⎤ ⎡ Pxx Pxm .. Pxm ⎤ Y
t 1 n−1
⎢m ⎥ ⎢P Pm1m1 .. Pm1mn−1 ⎥⎥
mx
yt = ⎢ 1 ⎥ , Pyt = ⎢ 1
⎢ ... ⎥ ⎢ .. .. .. .. ⎥
⎢ ⎥ ⎢ ⎥
m
⎣ n −1 ⎦ ⎣⎢ Pmn−1x Pmn−1m1 .. Pmn−1mn−1 ⎦⎥
X
§ The predicted robot pose x̂t at time-stamp t is computed using the estimated pose xt −1 at time-stamp t-1
and the odometric control input ut = {ΔSl , ΔS r }
⎡ ΔS r + ΔSl ΔS r − ΔSl ⎤
cos(θ + )⎥
⎡ Xˆ t ⎤ ⎡ X t −1 ⎤ ⎢ 2
t −1
2b ΔSl ; ΔS r : distance travelled by the left and right wheels resp.
⎢ ⎥ ⎢ ΔS + ΔS ΔS r − ΔSl ⎥
ˆxt = f ( xt −1 , ut ) = ⎢ Yˆt ⎥ = ⎢ Yt −1 ⎥ + ⎢ r l
sin(θ t −1 + )⎥ b : distance between the two robot wheels
⎢ ⎥ ⎢ 2 2b ⎥
⎢ θˆ ⎥ ⎢ θ ⎥ ΔS r − ΔSl (based on the example of Section 5.8.4 of the AMR book)
⎣ t ⎦ ⎣ t −1 ⎦ ⎢ ⎥
Odometry function ⎢⎣ b ⎥⎦
§ During this step, the position of the features remains unchanged. EKF Prediction Equations:
⎡ ΔS r + ΔSl ΔS r − ΔSl ⎤ Jacobians of f
cos( θ + )⎥
⎡ Xˆ t ⎤ ⎡ X t ⎤ ⎢ 2
t −1
2b
⎢ ˆ ⎥ ⎢
Y ⎥ ⎢ ΔS r + ΔSl ΔS r − ΔSl ⎥
Y sin(θ t −1 + )⎥
⎢ t ⎥ ⎢ t ⎥ ⎢
⎢ θˆ ⎥ ⎢ θ t ⎥
t
⎢ 2
Δ S − Δ S
2b ⎥ ˆ T
Pyt = Fy Pyt−1 Fy + Fu Qt Fu
T
⎢ ⎥ ⎢ ⎥ ⎢ r l ⎥
α ˆ α ⎢ b ⎥
yˆ t = ⎢⎢ 0 ⎥⎥ = ⎢ 0 ⎥ + ⎢ ⎥
rˆ0 ⎢ r0 ⎥ 0
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎢ ... ⎥ ⎢ ... ⎥ ⎢ 0 ⎥ Covariance at previous Covariance of noise
⎢ ˆ ⎥ ⎢αˆ ⎥ ⎢ ... ⎥ time-stamp associated to the motion
⎢ α n − 1 ⎥ ⎢ n −1 ⎢ ⎥
⎥
⎢⎣ rˆn −1 ⎥⎦ ⎢⎣ rn −1 ⎥⎦ ⎢ 0 ⎥
Autonomous Mobile Robots
⎢ ⎥
Margarita Chli, Nick Lawrance and Roland Siegwart
⎣ 0 ⎦ SLAM I | 46
ASL
Autonomous Systems Lab
xt = [ X t , Yt , θ t ]T yt = [ X t , Yt ,θ t , α 0 , r0 ,...,α n −1 , rn −1 ]T
§ The prediction function is: § The prediction function is:
xˆt = f ( xt −1 , ut ) yˆ t = f ( yt −1 , ut )
⎡ ΔS r + ΔSl ΔS − ΔSl ⎤
cos(θ t −1 + r )⎥
⎡ ΔS r + ΔSl ΔS r − ΔSl ⎤ ⎡Xˆ t ⎤ ⎡ Xt ⎤ ⎢ 2 2b
cos(θ + )⎥ ⎢
Yˆt
⎥ ⎢ ⎥ ⎢ ΔS r + ΔSl ΔS r − ΔSl ⎥
⎡ Xˆ t ⎤ ⎡ X t −1 ⎤ ⎢ 2
t −1
2b ⎢ ⎥ ⎢ Y t ⎥ ⎢
2
sin( θ t −1 +
2b
)⎥
⎢ ˆ⎥ ⎢ ⎢ ΔS + ΔS ΔS r − ΔSl ⎥ ⎢θˆ ⎥ ⎢ θt ⎥ ⎢
S S
⎥
⎥ r l ⎢ t ⎥ ⎢ ⎢ Δ − Δ ⎥
⎢ Yt ⎥ = ⎢ Yt −1 ⎥ + ⎢ sin(θ t −1 + )⎥ ⎥ r l
αˆ 0 ⎥ ⎢ α 0 ⎥ ⎢ b ⎥
⎢ θˆ ⎥ ⎢ θ ⎥ ⎢ 2 2b ⎥
⎢
yˆ t = ⎢ ⎥ =
⎢ r0 ⎥
+⎢
0 ⎥
rˆ0
⎣ t ⎦ ⎣ t −1 ⎦ ⎢ ΔS r − ΔSl ⎥ ⎢ ⎥ ⎢ ⎥ ⎢
0
⎥
⎢ ... ⎥ ⎢ ... ⎥ ⎢ ⎥
⎢⎣ b ⎥⎦ ⎢ ˆ ⎥ ⎢αˆ ⎥ ⎢ ... ⎥
⎢ α n −1 ⎥ ⎢ n −1 ⎢ ⎥
⎥
⎢⎣ rˆn −1 ⎥⎦ ⎣⎢ rn −1 ⎦⎥ ⎢ 0 ⎥
⎢ ⎥
⎣ 0 ⎦
Pˆxt = Fx Pxt −1 Fx + Fu Qt Fu
T T
Pˆyt = Fy Pyt−1 Fy + Fu Qt Fu
T T
§ The application of the measurement model is the same as in EKF localization. The predicted
observation of each feature mi is:
⎡αˆ i ⎤ The predicted new pose is used to predict
zˆi = ⎢ ⎥ = hi ( xˆt , mi ) where each feature lies in measurement space
⎣ rˆi ⎦
§ After obtaining the set of actual observations z0:n-1 the EKF state gets updated:
Jacobian of h Measurement
yt = yˆ t + K t ( z0:n−1 − h0:n−1 ( xˆt , m0:n−1 )) noise
yt
ˆ
P = P −K Σ K yt
T
t IN t where
Σ IN = HPˆyt H T + R
K t = Pˆyt H (Σ IN ) −1
“Innovation” (= observation-prediction)
Innovation
Kalman Gain
Covariance
MonoSLAM
margaritachli.com
§ Features (points, lines, …) are extracted from all frames and matched among them
§ Process all images simultaneously: images do not need to be ordered
§ Optimization to recover both:
§ camera motion and
§ 3D structure
up to a scale factor
§ Not real-time
§ Features (points, lines, …) are extracted from all frames and matched among them
§ Process all images simultaneously: images do not need to be ordered
§ Optimization to recover both:
§ camera motion and
§ 3D structure
up to a scale factor
§ Not real-time
Landmark’s state
e.g. 3D position for point-
features
Mean Covariance
(state vector) matrix
d×1 d×d
Camera state
: Position [3 dim.]
: Orientation using quaternions [4 dim.]
: Linear velocity [3 dim.]
Autonomous Mobile Robots
Margarita Chli, Nick Lawrance and Roland Siegwart
: Angular velocity [3 dim.] SLAM I | 55
ASL
Autonomous Systems Lab
At each time step, the unknown linear a and angular α accelerations (characterized by zero-
mean Gaussian distribution) cause an impulse of velocity:
§ Based on the predicted new camera pose a predict which known features will be visible and where
they will lie in the image
§ Use measurement model h to identify the predicted location zˆi = hi ( xˆt , yi ) of each feature and an
associated search region (defined in the corresponding diagonal block of Σ IN = HP ˆ HT + R )
t
§ Essentially: project the 3D ellipsoids from the SLAM map onto the image space
where: Σ IN = HPˆt H T + R
Kt = Pˆt H (Σ IN ) −1
Autonomous Mobile Robots
Margarita Chli, Nick Lawrance and Roland Siegwart SLAM I | 59
MonoSLAM | applications
§ At start up: the robot makes the first measurements and the covariance matrix is populated
assuming that these (initial) features are uncorrelated a off-diagonal elements are zero.
⎡ Pxx 0 0 ... 0 0 ⎤
⎢ ⎥
⎢ 0 Py0 y0 0 ... 0 0 ⎥
⎢ ⎥
⎢ 0 0 Py1y1 ... 0 0 ⎥
P0 = ⎢ ⎥
... ... ... ... ... ...
⎢ ⎥
⎢ 0 0 0 ... Pyn−2 yn−2 0 ⎥
⎢ ⎥
⎢⎣ 0 0 0 ... 0 Pyn−1yn−1 ⎥⎦
§ When the robot starts moving & taking new measurements, both the robot pose and features
start becoming correlated. ˆ T T
Pyt = Fy Pyt−1 Fy + Fu Qt Fu
§ Accordingly, the covariance matrix becomes dense.
Autonomous Mobile Robots
Margarita Chli, Nick Lawrance and Roland Siegwart SLAM I | 61
ASL
Autonomous Systems Lab
§ The state vector in EKF SLAM is much larger than the state vector in EKF localization
§ Newly observed features are added to the state vector a The covariance matrix grows
quadratically with the no. features a computationally expensive for large-scale SLAM.
§ Approach to attack this: sparsify the structure of the covariance matrix (via approximations)
Chli & Davison, ICRA 2009
2 3
Map management
& optimisation
Mapping &
loop-closure
detection
64