LiDAR-Inertial Fusion & Factor Graphs

A LiDAR draws walls to the centimetre, but it smears when it moves and goes blind in a plain corridor. An IMU never blinks, but it drifts. On this toy building with a 30 m corridor, LiDAR alone ends its loop 29.8 m off and the IMU alone 44.7 m off. Fused, the loop ends 2.2 m off, and one loop-closure factor brings the worst error down to 0.69 m.

Pick a navigator and set the corridor length. Watch where the map folds. Then we build it piece by piece, from un-bending one sweep to solving the whole loop as one least-squares problem.

You need the Kalman filter and strapdown navigation. We build the rest from zero.

Lesson 17 of 22 in Sensor Fusion: Classical to Modern. It follows Visual-Inertial Odometry and leads to Multimodal Driving Fusion.

Map the building

30 m

Illustrative keyframe toy, seeded: one keyframe per metre around a 20 m wide building. Scan matching 2 cm and 0.25° per step where walls have features; in the corridor this toy matcher keeps its start guess of zero motion. IMU alone: a constant 0.025 m/s² bias. Fused: the IMU carries the corridor with a 0.004 m/s² bias left over. Gauss-Newton solves the loop closure on the whole pose graph.

Chapter 0

A Sharp Pen That Cannot Hold Still

Measure how far the IMU drifts between two LiDAR scans, and how far it drifts alone

A delivery robot rolls down a warehouse aisle. On its roof a LiDAR spins: a laser rangefinder that fires beams and times each echo. Each echo gives a distance to the centimetre. One full turn gives a point cloud, a metric sketch of the room.

The LiDAR has three flaws. It is slow: a spinning unit turns about 10 times a second, so a scan arrives every 100 ms. It smears: the robot moves during each 100 ms sweep. And it can go blind: in a long, plain corridor every scan looks the same, so scans cannot show how far the robot moved along it.

The IMU of Lesson 13 has the opposite profile. It reports hundreds of times a second and works in any corridor. Its flaw is drift. Position comes from integrating acceleration twice, so a constant accelerometer bias grows into an error that grows with time squared.

Compare one gap with one minute

Warm is the IMU alone. Teal is the IMU reset by every LiDAR scan. Blue marks the scan-match noise. Move the scan rate and the bias.

10 Hz
0.050 m/s²

Illustrative; exact for a constant bias and a perfect start: the IMU error is one half b t squared. We made up the 2 cm scan-match noise. Real systems also carry velocity error between scans.

Call the accelerometer bias b and the time since the last correction t. With a perfect start, the position error from a constant bias is:

Say it aloud

e of t equals one half b t squared.

e(t)
e of t the position error t seconds after the last correction, in metres.
½
one half from integrating twice: a steady push covers half of its final speed times the time.
b
b the accelerometer bias, in m/s².
t2
t squared the time since the last correction, squared.
In plain words

Square the time t since the last correction. Multiply by the bias b and halve it. That is how far the IMU has wandered.

With numbers

With b = 0.05 m/s² and one 10 Hz scan gap, t = 0.1 s: e = 0.5 × 0.05 × 0.01 = 0.00025 m, a quarter of a millimetre. Alone for t = 60 s: e = 0.5 × 0.05 × 3600 = 90 m.

So the IMU is close to perfect for one scan gap and useless for a minute. The LiDAR is the reverse. Each scan anchors the robot to the walls, but only ten times a second and only in directions the walls pin down. Fused, the IMU un-bends each sweep and carries the robot between scans and through blind spots. The LiDAR resets the IMU drift at every scan.

The idea of the lesson. The IMU carries the motion and the LiDAR anchors it to the walls. A factor graph adds every constraint, including "I have been here before", into one least-squares problem.
Failure: trusting one sensor. Symptom: with LiDAR alone the map folds in the corridor; with the IMU alone the path drifts away. Measure: the end-of-loop gap in the hero, 29.8 m and 44.7 m. Fix: fuse them, so each covers the other's gap.

The road

  1. Un-bend the sweep: deskew each point with the IMU.
  2. Align two scans: point-to-point against point-to-plane ICP.
  3. Keep the edges and planes: LOAM's feature score.
  4. Every measurement is a factor: MAP as least squares.
  5. Close the loop: sparsity, loop closure and iSAM2.
  6. Fold the IMU: preintegration factors.
  7. A graph or a filter: LIO-SAM against FAST-LIO.
  8. When the walls cannot see: degeneracy from eigenvalues.
  9. Showcase: map the building with every switch.
  10. Field guide: the numbers, the checklist, the code.
A LiDAR scans at 10 Hz and the IMU has an accel bias of 0.05 m/s². About how far does the IMU drift between two scans?

Chapter 1

Un-bend the Sweep

Move every point back to one moment, using where the IMU says the robot was when that beam fired

A spinning LiDAR does not take its cloud in one instant. The first beam fires at the start of the 100 ms sweep and the last fires at the end. If the robot moves, the sensor sees each point from a different place. The driver stamps them all as if from one pose, so a straight wall comes back bent. This is motion distortion.

The fix is deskewing. The LiDAR stamps each point with its firing time, tau. The IMU at 200 Hz gives about 20 poses inside each sweep, so we know where the robot was at every tau. Call the raw point p, in the sensor frame at the moment it fired. Call the robot pose at that moment T of tau, and the pose at the start of the sweep T-ref. A pose is a rotation plus a shift, written as one 3 by 3 matrix in 2-D.

Say it aloud

p-ref equals T-ref-inverse, times T of tau, times p.

pref
p-ref the corrected point, written in the reference pose.
Tref−1
T-ref-inverse undoes the reference pose: it takes a world point into the frame of the sweep start.
T(τ)
T of tau the robot pose when this beam fired, from integrating the IMU through the sweep.
p
p the raw point, as the sensor saw it at time tau.
In plain words

Push the raw point p into the world with the pose T of tau where it fired. Pull it back into the reference pose with T-ref-inverse. Every point gets the pose of its own firing time.

With numbers

The robot drives toward a wall at 1.5 m/s. A beam fires at tau = 0.08 s and reads 3.00 m. By then the robot has moved 1.5 × 0.08 = 0.12 m, so T of tau is a 0.12 m shift and p-ref = 3.00 + 0.12 = 3.12 m. Without deskew that point is 12 cm wrong.

Un-bend one sweep

The dashed lines are the real walls. The robot sweeps once while it drives and turns. Choose raw or deskewed, then raise the speed and the turn rate.

1.5 m/s
90°/s

Illustrative toy with exact geometry: a 10 m by 6 m room, 180 beams over one 100 ms sweep, constant speed and turn rate, and a perfect IMU. The raw sweep places every point as if the robot had not moved since the sweep began.

Turning hurts more than driving. At 90°/s the robot turns 9° in one sweep, and a wall 10 m away measured at the end of the sweep lands 1.57 m sideways. So deskew needs the gyroscope at full rate, not one velocity per scan: the correction depends on each point's angle and range.

Failure: a time offset between LiDAR and IMU. Symptom: walls stay thick at low speed and smear most in fast turns. Measure: turn in place; an offset of 20 ms at 90°/s blurs a wall 10 m away by 10 × 1.571 × 0.02 = 0.31 m. Fix: one clock for both sensors, or estimate the offset (Lesson 15).
A sweep takes 100 ms and the robot drives at 2 m/s. Without deskew, how far off is the last point, and what fixes it?

Chapter 2

Align Two Scans: Point-to-Point or Point-to-Plane

Iterate closest points, and measure each gap along the surface normal instead of straight to a neighbour

With clean scans, the next question is how far the robot moved between two of them. Registration finds the rotation and shift that lay the new scan onto the old one, the map. The world did not move, so that transform is the robot's motion.

The classic method is Iterative Closest Point (ICP) (Besl and McKay 1992). Pair each new point with its nearest map point. Find the transform that best aligns the pairs. Apply it, pair again, and repeat until nothing changes.

Point-to-point ICP minimises the straight distance of each pair. But a LiDAR never samples the same spot twice: the new scan hits a wall between the old scan's points. Demanding point on point drags the scan along the wall and can lock it in a wrong place. Chen and Medioni (1992) measured the gap along the surface normal instead, so a point only needs to land on the surface.

Call the new point after the candidate move p-prime and its matched map point q. Call the map surface's unit normal n: the direction straight out of the surface.

Say it aloud

r equals n dot, p-prime minus q.

r
r the point-to-plane residual: the distance into the surface, in metres.
n
n the unit normal of the map surface at q.
·
dot the dot product: it keeps only the part of a vector that points along n.
p′
p-prime the new scan point after the candidate move.
q
q the matched map point on the surface.
In plain words

Take the gap from the map point q to the moved point p-prime. Keep only its part along the normal n. That part is r, so sliding along the wall costs nothing.

With numbers

p-prime = (2.1, 0.3), q = (2.0, 0.0), n = (1, 0). The gap is (0.1, 0.3). Point-to-point scores its length, 0.316 m. Point-to-plane keeps r = 1 × 0.1 + 0 × 0.3 = 0.1 m, the true distance into the wall.

Step ICP onto a corner

Pink is the map: two walls meeting at a corner. Blue is the new scan, sampled at other spots. Thin lines are this iteration's pairs. Choose a residual and press Step.

×1.0

Illustrative toy, exact algebra: 15 map points per wall, 14 scan points per wall placed between them. At ×1.0 the scan starts turned 0.18 rad and shifted 0.35 m and −0.25 m, as in the Code Lab. Point-to-point uses the closed-form best fit of the pairs; point-to-plane solves the linearised rows. Error is the RMS distance to the real walls.

Each point-to-plane iteration is one small least-squares solve. Linearise the rotation, stack one row per point, solve for the twist (a small rotation plus a shift), and apply it. In the device it lands in two iterations. Point-to-point stalls 10.5 cm away, because every point keeps pairing with the same wrong neighbour.

Failure: a wrong local minimum. Symptom: ICP converges with a small residual and the map is still wrong. Measure: compare the result with the IMU's predicted motion; a jump far from it is suspect. Fix: start ICP from the IMU prediction, as LIO-SAM does.
Why does point-to-plane ICP align two scans of a wall better than point-to-point?

Chapter 3

Keep the Edges and the Planes

Score each point by how sharply its neighbours bend, and match only the sharpest and the flattest

A scan holds tens of thousands of points, and most lie on flat surfaces that say the same thing. LOAM, LiDAR Odometry and Mapping (Zhang and Singh 2014), registers only a few informative ones. It scores how much the surface bends at each point. It keeps the sharpest as edge points and the flattest as planar points.

Take a point p-i on one scan line. Take a set S of its neighbours on the same line, half on each side. Call the score c.

Say it aloud

c equals the length of the sum over j in S of p-i minus p-j, divided by the size of S times the length of p-i.

c
c the smoothness score of point i: near 0 on a flat surface, large at a sharp edge.
‖ ‖
the length of the size of a vector.
Σj∈S
the sum over j in S add one term for each neighbour j.
pi − pj
p-i minus p-j the vector from neighbour j to point i.
|S|
the size of S the number of neighbours, so the score does not grow with the window.
‖pi‖
the length of p-i the range of the point, so near and far points score alike.
In plain words

Add up the vectors from each neighbour p-j to the point p-i. On a flat surface they cancel; at a corner they do not. Divide the length of the sum by the neighbour count and by the range. That is c.

With numbers

A point at (5, 0) on a straight wall, with neighbours 0.1 m and 0.2 m away on each side: the four vectors cancel and c = 0. At a corner with neighbours (5, −0.2), (5, −0.1), (4.9, 0) and (4.8, 0), the sum is (0.3, 0.3), of length 0.424, so c = 0.424 / (4 × 5) = 0.021.

Pick the features

Top: one scan line seen from above. Rings are edge points, filled dots are planar points, faint dots are points LOAM drops. Bottom: each point's score c and the edge threshold. Choose a scene, then move the threshold.

0.050

Illustrative toy: 360 beams at 1° on one line, five neighbours on each side, as in common LOAM code. Planar points are those scoring under a tenth of the edge threshold. LOAM also caps the picks per region and skips occluded points; this toy does not.

Edge points match with a point-to-line residual, and planar points with the point-to-plane residual of Chapter 2. LIO-SAM writes the same two distances as its equations 10 and 11. A plane pins motion along its normal, and an edge pins the directions a plane leaves free. LOAM ran its odometry at about 10 Hz and its mapping at 1 Hz.

Failure: an open road. Symptom: drift along the road while the lateral position holds. Measure: count edge points per scan; in the road scene only the two poles give edges. Fix: tune the threshold to the scene, spread the picks over the scan (LOAM splits each scan into four regions), and lean on the IMU along the road.
A point on a flat wall has a smoothness score c near 0. Why?

Chapter 4

Every Measurement Is a Factor

Write each reading as a weighted squared error, and find the trajectory with the smallest total

One scan match gives one step. A robot takes thousands, and the drift piles up. Now and then it gets a GNSS fix, or sees a place it has seen before. A factor graph holds all of these in one picture.

It has two kinds of node. Variables are the unknowns: the robot poses, and often velocities and IMU biases. Factors are the measurements, and each one connects only the variables it talks about. An odometry factor links two poses in a row. A GNSS fix touches one pose. A loop closure links two poses far apart in time.

Each factor scores a guess. With Gaussian noise, its negative log-likelihood is a squared residual over the noise variance. Probabilities multiply, so their logs add, and the most probable trajectory, the MAP (maximum a posteriori) estimate, minimises a sum. Call the stacked unknowns x, the residual of factor i r-i of x, and its noise sigma-i.

Say it aloud

x-hat equals the argmin over x of the sum over i of r-i of x squared, over sigma-i squared.

x̂
x-hat the MAP estimate: every pose at once.
argminx
the argmin over x the x that makes what follows smallest.
Σi
the sum over i one term per factor.
ri(x)2
r-i of x squared how badly the guess x disagrees with measurement i, squared.
σi2
sigma-i squared the noise variance of measurement i. Dividing by it gives precise sensors a bigger vote.
In plain words

For a guess x, compute each factor's residual r-i. Square it and divide by its variance sigma-i squared. Add them all. x-hat is the guess with the smallest total.

With numbers

Two poses. A prior says x0 = 0 (variance 1). Odometry says x1 − x0 = 10 (variance 1). A GNSS fix says x1 = 11 (variance 4). Setting both derivatives to zero gives 2 x0 − x1 = −10 and −x0 + 1.25 x1 = 12.75. So x0 = 0.167 and x1 = 10.333. x1 sits nearer the odometry because the fix is four times noisier.

Weigh three votes

Top: the graph. Circles are variables, squares are factors. Bottom: where each vote and the estimate sit. Move the fix and its noise.

11.0
2.0

Exact solution of the three-factor least squares in the With numbers line. The filter row is a Kalman filter run forward on the same chain.

A Kalman filter on this chain gives the same x1 = 10.333, with variance 1.333. But it leaves x0 at 0, because it never revisits the past. The graph moves x0 to 0.167. A Kalman filter is a factor graph shaped like a chain and solved forward once, the view Dellaert and Kaess (2017) build on. The graph is the general object: it can keep every past pose and add factors that reach back.

Failure: wrong weights. Symptom: one sensor bends the trajectory more than it should. Measure: each factor's weighted residual r² / σ² at the solution; over many factors it should average about 1. Fix: set sigma from the sensor. A sigma 10 times too small gives that factor 100 times the vote.
In a factor graph, what is one factor, and what does MAP estimation compute?

Chapter 5

Close the Loop, Keep It Sparse

Add one factor between the end and the start, and watch the correction spread back along the loop

Drive a loop and the odometry drift leaves the end short of the start. Then place recognition fires: this scan matches a scan from the start. That match becomes a loop-closure factor between the last pose and the first. A filter cannot use it, because it dropped the old pose. The graph kept every pose, so it can.

Gauss-Newton solves the graph: linearise each residual, then solve one linear system for the correction. Call each factor's Jacobian J-i, how its residual moves when the variables move. Call its weight Omega-i, one over its variance, and the system matrix H.

Say it aloud

H equals the sum over i of J-i-transpose, Omega-i, J-i.

H
H the information matrix of the whole graph: one row and one column per variable.
Σi
the sum over i one block per factor.
JiT
J-i-transpose the Jacobian laid on its side, so the product is square.
Ωi
Omega-i the weight of factor i: one over its variance.
Ji
J-i the Jacobian of factor i: nonzero only for the variables it touches.
In plain words

For each factor, multiply its Jacobian J-i by its weight Omega-i and by itself. That block lands only on the rows and columns of the variables the factor touches. Add every block to get H, then solve H times the correction equals minus the gradient.

With numbers

An odometry factor between x-k and x-k-plus-one has J = [−1, 1] and Omega = 1, so it adds [[1, −1], [−1, 1]] on rows k and k+1 only. For 9 poses in a chain with a prior, H has 25 of 81 entries filled. A loop closure adds 2 more, at the corners. With 101 poses: 303 of 10,201, or 3%.

Add the loop factor

Left: the poses, the odometry factors (blue squares) and the true ring (dashed). Right: the filled entries of H. Switch the loop closure, then raise the drift.

12 cm

Illustrative linear toy: 12 steps around a ring of radius 4 m, positions only. Each odometry step carries the same drift vector plus 3 cm of seeded noise. Odometry sigma 0.1 m, loop sigma 0.05 m, a tight prior on the first pose. Solved exactly; the grid shows one axis.

That sparsity is why smoothing runs in real time. iSAM2 (Kaess et al. 2012) keeps the factored H as a Bayes tree. A new factor edits only the part of the tree that holds its variables, up to the root, and leaves the rest. It also relinearises only the variables whose estimate moved enough. An odometry factor at the end touches a few variables; a loop closure touches the whole loop, once.

Failure: a false loop closure. Symptom: the map is fine, then folds or tears right after one loop event. Measure: log each closure with its match score; the bad one has a weak score and a large residual after the solve. Fix: check each candidate with ICP and a strict fitness test, and use a robust cost so one factor cannot dominate.
The odometry has drifted 2 m when the robot recognises its start. Why can a smoother fix this when a Kalman filter cannot?

Chapter 6

Fold 200 IMU Ticks into One Factor

Sum the IMU between two keyframes once, and correct the sum for a new bias without integrating again

Between two keyframes 1 s apart, a 200 Hz IMU gives 200 readings. One factor per reading would bloat the graph. Preintegration sums them once into one relative motion: the change in velocity, position and rotation from keyframe i to keyframe j. Lupton and Sukkarieh (2012) introduced it, and Forster et al. (2017) carried it onto the rotation manifold.

The sum depends on the bias estimate, and the optimiser changes the bias at every iteration. Integrating 200 readings again each time is the cost we wanted to avoid. Two tricks remove it. We write the sum in keyframe i's own frame, so it does not depend on where keyframe i is. And a bias change shifts the sum by a derivative computed once.

Take one axis with no rotation. Call the accelerometer reading at tick k a-k, the bias estimate b, and the tick length delta-t. Call the velocity change from keyframe i up to tick k delta-v-i-k.

Say it aloud

Delta-v-i-j equals the sum over k of a-k minus b, times delta-t. Delta-p-i-j equals the sum over k of delta-v-i-k times delta-t, plus one half of a-k minus b, times delta-t squared.

Δvij
delta-v-i-j the velocity change from keyframe i to keyframe j, in m/s.
Δpij
delta-p-i-j the position change between the keyframes beyond what the start velocity alone gives, in metres.
Σk
the sum over k one term per IMU tick between the keyframes.
ak
a-k the accelerometer reading at tick k, in m/s².
b
b the current bias estimate, in m/s².
Δt
delta-t one tick: 1/200 s at 200 Hz.
Δvik
delta-v-i-k the running velocity change from keyframe i up to tick k.
In plain words

Walk the ticks from keyframe i to keyframe j. At each tick, take the bias b off the reading a-k. Add it to the running velocity change, and add the distance that tick covers to the position change. The two totals are the factor.

With numbers

With a made-up wobbling profile, 200 ticks over T = 1 s give delta-v = 0.0033 m/s and delta-p = 0.0490 m. If b rises by 0.02 m/s², the derivatives say delta-v drops by T × 0.02 = 0.02 m/s and delta-p by ½ T² × 0.02 = 0.01 m. Integrating all 200 ticks again gives the same: −0.0167 m/s and 0.0390 m.

Fold the ticks

Top: every IMU reading between keyframe i and keyframe j. Bottom: the running position change. Move the bias change and compare the derivative shortcut (dashed) with a full re-integration (solid).

200 Hz
+0.02 m/s²

Illustrative 1-D toy: the readings follow 0.3 sin(2πt) plus seeded noise of 0.05 m/s², keyframes 1 s apart. In 1-D the shortcut is exact; with rotation it is first order.

In 1-D the shortcut is exact, because the sums are linear in b. With rotation, the gyro bias enters through products of rotations, so the correction is first order and is redone only when the bias moves far. The factor ties pose, velocity and bias at both keyframes. So LiDAR factors teach the graph the IMU bias; LIO-SAM optimises the bias jointly with the poses.

Failure: a bad start. Symptom: the trajectory tilts or curves from the first second, even in a rich scene. Measure: hold the robot still for a few seconds; the bias estimates should settle and gravity should point straight down. Fix: a still start, or estimate gravity and bias before moving.
The optimiser raises the bias estimate by 0.02 m/s². Keyframes are 1 s apart. What happens to the preintegrated position change?

Chapter 7

A Graph or an Iterated Filter

Compare LIO-SAM's factor graph with FAST-LIO's filter, and count what each Kalman gain costs

Two designs lead the field. LIO-SAM (Shan et al. 2020) builds a factor graph with four factor types: IMU preintegration, LiDAR odometry, GNSS and loop closure, solved by iSAM2. It adds a keyframe when the robot moves 1 m or turns 10°. Its title says tightly coupled: the IMU deskews and seeds scan matching, and the LiDAR factors correct the IMU bias. But the LiDAR enters the graph as a finished relative pose from scan matching, not as point residuals.

FAST-LIO (Xu and Zhang 2021) is an iterated error-state Kalman filter. It fuses each feature point's residual directly and re-linearises the update until it converges. It deskews by running the IMU backward through the sweep. FAST-LIO2 (2022) drops feature extraction, registers raw points, and keeps the map in an incremental k-d tree, the ikd-Tree.

A scan gives over a thousand residuals, and the usual gain inverts a matrix as big as the measurement count. FAST-LIO rewrites the gain so the inverse is state-sized. Call the state covariance P (n by n), the measurement Jacobian H (m rows), the measurement noise R (m by m) and the gain K.

Say it aloud

K equals the inverse of, H-transpose R-inverse H plus P-inverse, times H-transpose R-inverse.

K
K the Kalman gain: n rows, m columns. It turns residuals into a state correction.
H
H the measurement Jacobian: one row per point residual, one column per state.
HT
H-transpose H laid on its side.
R−1
R-inverse one over each residual's noise variance. R is diagonal, so this is cheap.
P−1
P-inverse the prior information from the IMU prediction, n by n.
( )−1
the inverse of here an n by n matrix, n = 18 states in FAST-LIO and 24 in FAST-LIO2.
In plain words

Weight each residual row of H by R-inverse. Add the weighted rows into one n by n information matrix, add P-inverse, and invert that small matrix. Multiply by H-transpose R-inverse. The result equals the usual gain P H-transpose times the inverse of H P H-transpose plus R.

With numbers

FAST-LIO's state has 18 numbers. With 1,802 points, the usual form inverts an 1,802 by 1,802 matrix: of order 1,802³ = 5.9 billion operations. The new form is of order 1,802 × 18² + 18³ = 0.59 million. The paper measured 1,621 ms against 1.16 ms at that size (its Table II).

Count the cost of one gain

Log axes. Red is the usual gain, which inverts an m by m matrix. Teal is FAST-LIO's form. The dots are the paper's measured times. Choose the state size and move the point count.

1,800

Operation counts are orders of magnitude (m³ against m n² + n³), not timings. The dots are the paper's measured milliseconds, from FAST-LIO Table II (307 to 1,802 feature points), on their own scale.

DesignEngineWhat entersLoop closure
LIO-SAMfactor graph, iSAM2scan-match poses, IMU preintegration, GNSS, loopsbuilt in: one more factor
FAST-LIO2iterated error-state Kalman filterevery raw point's residual, the IMUnone: odometry only
Failure: pure odometry on a long run. Symptom: every local scan looks crisp, but a long loop ends far from its start. Measure: drive a known loop and measure the end gap. Fix: FAST-LIO2 is odometry only; add a pose-graph back end for loop closure, a common hybrid.
FAST-LIO rewrites the Kalman gain. What problem does that solve?

Chapter 8

When the Walls Cannot See Motion

Read the scan's information matrix, find the direction with no information, and let the IMU carry it

In a straight corridor, sliding the scan along the walls changes no point-to-plane residual. The registration has a flat direction, and the solver can return any answer along it. This is degeneracy, and we can detect it from the scan itself.

For a pure shift, each planar point's residual changes by its normal dotted with the shift (Chapter 2). So each point adds its normal to the scan's information matrix, the same H as Chapter 5 for one scan match. Call the normal of point k n-k.

Say it aloud

H equals the sum over k of n-k times n-k-transpose.

H
H the 2 by 2 information matrix of one scan match, for a shift in x and y.
Σk
the sum over k one term per planar point.
nk
n-k the unit normal of the surface at point k, as a column.
nkT
n-k-transpose the same normal as a row, so the product is a 2 by 2 block.
In plain words

For each planar point, multiply its normal n-k by itself into a 2 by 2 block, and add all the blocks. Each eigenvalue of H says how stiffly the scan pins motion along its eigenvector. A tiny smallest eigenvalue means a blind direction.

With numbers

A corridor along x: 120 points on each wall have n = (0, ±1), so each adds 1 to the y-y entry, 240 in all. Three points on an end wall have n = (1, 0) and add 3 to the x-x entry. The eigenvalues are 3 and 240, and the condition number is 240 / 3 = 80. With a threshold of 100, x is blind.

Find the blind direction

Left: the scene with its scan points and normals, and the information ellipse. Right: the two eigenvalues against the threshold. Choose a scene, then add end-wall points.

3

Illustrative toy matching the Code Lab: 120 points per long wall, unit normals, shift only (no rotation), threshold 100. The ellipse axes grow with the square root of each eigenvalue.

Zhang, Kaess and Singh (2016) defined a degeneracy factor from the smallest eigenvalue. Their solution remapping keeps the scan's correction in the well-constrained directions and takes the prediction in the blind ones. They set the threshold from data, between degenerate and healthy scenes. In a factor graph the same idea means: give the scan factor almost no weight along the blind eigenvector, and let the IMU factor carry it.

Failure: the telescoping corridor. Symptom: a corridor comes out shorter than it is while its walls stay sharp. Measure: log the smallest eigenvalue per scan; it drops as the robot enters. In the hero, LiDAR alone squeezes a 30 m corridor to 0.09 m. Fix: detect it, and lean on the IMU along the blind eigenvector.
How does a LiDAR-inertial system detect a degenerate corridor, and what does it do?

Chapter 9

Showcase: Map the Building

Switch the IMU, the degeneracy check and the loop closure on and off, and read the error along the loop

Here is the hero's building again, with every switch exposed. The pose graph has one keyframe per metre. Where walls have features, LiDAR odometry factors link the keyframes; in the corridor, IMU-carried factors do. One loop closure links the last pose to the first. Gauss-Newton solves it, as in Chapter 5.

Map the building with every switch

Top: the map, truth dashed. Bottom: the error at every pose, corridor shaded; dashed is the odometry before the solve. Flip the switches and watch what the loop closure can and cannot fix.

30 m

Illustrative keyframe toy, seeded, the same engine as the hero. Phone and tactical differ only in the bias left over in the corridor: 0.004 against 0.0005 m/s². The check gives blind corridor factors a 5 m sigma along the corridor; without it they claim 2 cm.

Start with the defaults: IMU on, loop on, a 30 m corridor. The worst error is 0.69 m and the corridor comes out 30.34 m long. A tactical IMU brings the worst error to 0.28 m.

Now turn the IMU off. The corridor factors claim 2 cm, so the solver believes the squeezed corridor. The loop still closes to 0.41 m, but the map folds: worst error 26.5 m, corridor 2.0 m long. Turn the degeneracy check on. The blind factors now carry 5 m of doubt along the corridor, and the loop closure stretches the corridor back to 29.4 m, worst error 0.79 m.

Failure: an overconfident factor. Symptom: the loop closes and the map is still folded. Measure: the corridor length, 2.0 m against 30 m, while each corridor factor fits its scans to 2 cm. Fix: mark the blind direction, so its factors carry honest doubt and the solve can move them.
With the IMU off and no degeneracy check, the loop closure closes the gap but leaves the corridor 2.0 m long. Why?

Chapter 10

Field Guide

Keep the equations, the numbers, the checklist, the failures and the code in one place

The IMU deskews each sweep and carries the robot between scans. Point-to-plane registration on edge and planar features turns each scan into a motion estimate. A factor graph adds those estimates, preintegrated IMU factors, GNSS fixes and loop closures, and solves them as one sparse least-squares problem. The scan's eigenvalues say where the walls cannot see, and there the IMU takes over.

QuantityFormulaNumbers from this page
IMU drifte = ½ b t²0.25 mm per 0.1 s gap; 90 m in 60 s
Deskewpref = Tref−1 T(τ) p3.00 m read at τ = 0.08 s becomes 3.12 m
Point-to-planer = n · (p′ − q)0.1 m, where point-to-point says 0.316 m
Smoothnessc = ‖Σ(pi − pj)‖ / (|S| ‖pi‖)0 on a wall, 0.021 at a corner
MAPx̂ = argmin Σ ri² / σi²x0 = 0.167, x1 = 10.333
InformationH = Σ JiT Ωi Ji101 poses: 303 of 10,201 entries
PreintegrationΔp shifts by −½ T² δbδb = 0.02: 1.0 cm, no re-integration
FAST-LIO gainK = (HTR−1H + P−1)−1HTR−11,802 points: 1,621 ms to 1.16 ms (paper)
DegeneracyH = Σ nk nkTeigenvalues 3 and 240, condition 80

Checklist

  1. Need loop closure, GNSS or a reusable map: a factor graph. Need the lowest latency on a small computer: an iterated filter. Many systems run a filter front end and a graph back end.
  2. Share one clock between LiDAR and IMU, and deskew every point by its own time.
  3. Voxel-downsample the cloud, and keep features spread over the scan.
  4. Start scan matching from the IMU prediction.
  5. Add keyframes by distance and angle (LIO-SAM: 1 m or 10°).
  6. Check every loop candidate with ICP before it enters the graph, and use a robust cost.
  7. Add GNSS factors outdoors, weighted by the receiver's own covariance.
  8. Log the smallest eigenvalue of every scan match, and give blind directions honest doubt.

Read the symptom

SymptomCauseTest
Walls thicken with speedno deskew, or a LiDAR-IMU time offsetdrive one wall slow, then fast; turn in place
Corridor shrinks or stretchesdegeneracylog the smallest eigenvalue
Tilted from the first secondbad gravity or bias startstand still; bias settles, gravity points down
Map tears after a loop eventa false loop closurelog each closure's match and ICP score
Blur that grows with turn ratewrong LiDAR-IMU extrinsicrotate in place; recalibrate (Lesson 15)
Crisp locally, bent globallyodometry drift with no loopsdrive a known loop, measure the gap
pythonimport numpy as np

def point_to_plane_step(P, Q, NQ, thresh=100.0):
    # P: new scan (N,2) already moved by the IMU guess; Q, NQ: map points and unit normals
    idx = ((P[:, None] - Q[None]) ** 2).sum(2).argmin(1)   # closest map point
    q, n = Q[idx], NQ[idx]
    r = np.sum(n * (P - q), axis=1)                   # r = n . (p' - q)
    R90p = np.stack([-P[:, 1], P[:, 0]], axis=1)          # small-rotation column
    J = np.column_stack([np.sum(n * R90p, axis=1), n])     # rows [n.R90p, nx, ny]
    H = J.T @ J                                         # information of this scan match
    w, V = np.linalg.eigh(H[1:, 1:])                       # shift block: sum n n^T
    blind = V[:, w < thresh]                              # directions the walls cannot see
    dx = np.linalg.lstsq(J, -r, rcond=None)[0]                # twist: (dtheta, dx, dy)
    dx[1:] -= blind @ (blind.T @ dx[1:])                     # remap: keep the IMU guess there
    return dx, w

Where it runs

LiDAR-inertial odometry maps places where GNSS is weak or absent: warehouses, mines, tunnels and building interiors. Survey vans and handheld scanners use it to build maps, and drones and legged robots use it to move. The software is open: LOAM-style feature registration, LIO-SAM on the GTSAM library, and FAST-LIO2.

Keep going

References

The takeaway. Let the IMU carry the motion and the walls anchor it. Write every reading as a factor, give blind directions honest doubt, and let one loop closure pull the whole map straight.
What is the deepest link between this lesson and the Kalman filter of Lesson 5?

Now press Present or Teach and derive it from memory. Cover the drift law, deskew, point-to-plane, the smoothness score, MAP as least squares, the sparse H, preintegration, FAST-LIO's gain and the eigenvalue test. Then go back to the building and say why one loop factor fixes the fused map but not LiDAR alone.

Credit

Lesson 17 of 22 in Sensor Fusion: Classical to Modern on Engineermaxxing. Every toy number on this page carries the word illustrative; the paper numbers name their source.

Sensor Fusion: Classical to Modern · Lesson 17: LiDAR-Inertial Fusion & Factor Graphs
Previous: Visual-Inertial Odometry · Next: Multimodal Driving Fusion · Back to Gleams