Localization & SLAM · Theory · M5
M5-T7 — LeGO-LOAM
If the robot drives on the ground, use the ground: it pins three of the six degrees of freedom for free.
A car or a wheeled robot spends its life on a surface. LeGO-LOAM (Shan and Englot, 2018) builds on LOAM by recognising that fact: it separates the ground from the objects, uses each for the degrees of freedom it constrains best, and removes noise before matching. The result runs on an embedded computer (a Jetson TX2 class board) at sensor rate. This lesson explains the three ideas and when they fail.
Learning objectives
After this lesson, you should be able to:
- Describe range-image segmentation and ground extraction in LeGO-LOAM.
- Explain why edge features from objects and planar features from the ground constrain different degrees of freedom.
- Describe the two-step optimisation and why it is cheaper and better conditioned.
- State the assumptions that make it work and the terrain on which it fails.
The problem and the intuition
A cyclist on a flat road knows three things almost for free: how high the bike is, and how much it is leaning forward or sideways. The road tells them. What the road does not tell them is where along it they are, how far left or right, and which way they point; for those they look at poles, buildings and kerbs. LeGO-LOAM does the same: planar patches of ground fix height, roll and pitch; edges of objects fix x, y and yaw.
Different features constrain different degrees of freedom. Using each where it is strong makes two easy problems out of one hard one.
The algorithm: segment, select, solve in two steps
Problem. Run LOAM-style odometry and mapping on a ground vehicle with a spinning LiDAR (the paper uses a Velodyne VLP-16), in real time on a low-power computer, and in noisy environments where leaves, grass and rain create clutter.
Assumptions. The vehicle moves on a roughly planar ground that is visible to the sensor; the ground is not wholly dominated by slopes or stairs; the scan has structure along rings; objects (walls, trees, poles) exist for the horizontal constraints.
- Project to a range image. The scan becomes a 2D image with one row per ring (16) and one column per azimuth (1800 at 0.2°), each pixel holding the range. Neighbours in the image are neighbours in space.
- Ground extraction. For vertically adjacent pixels, compute the angle of the line between them against the horizontal; if it is small (below about 10°), both are ground points. Done for the lowest rings (those that can hit the ground).
- Segmentation of the rest. Cluster the non-ground pixels by growing regions in the image: two neighbouring pixels belong to the same object if the angle β between the beam to the nearer point and the line joining them exceeds a threshold (about 60°; a small β means they lie on a surface seen at a grazing angle that may be two objects). Clusters with fewer than 30 points (or fewer than 5 spanning three rows) are discarded as noise: leaves, rain, small blobs.
- Features. Compute the LOAM smoothness (M5-T3) on the segmented points. Edge features are selected from the segmented (non-ground) points; planar features are selected from the ground points. The image is divided into sub-images so that features are spread around the vehicle.
- Two-step Levenberg-Marquardt odometry. (1) Match planar (ground) features between consecutive scans to estimate [tz, roll, pitch]. (2) With those fixed, match edge features to estimate [tx, ty, yaw]. Compose the two to get the six-DOF transform.
- Mapping. Register the features to a map built from the stored feature sets of recent keyframes (as a sliding set of “surrounding” frames), refining the pose.
- Loop closure. A simple scheme: search the keyframe history for positions within a radius of the current pose, run ICP between the current features and the candidate’s surroundings, and if the fit is good add a loop factor to a pose graph optimised with iSAM2.
- range image
- an image whose pixels store range, indexed by ring and azimuth. It gives neighbourhoods for free.
- β
- the angle used in the segmentation test: between the line connecting two neighbouring points and the beam to the closer one.
- [tz, roll, pitch]
- the three degrees of freedom of the vehicle relative to the ground plane.
- [tx, ty, yaw]
- the three degrees of freedom of motion in the plane.
Strengths, limitations, failure modes
| Strength | Limitation / failure mode |
|---|---|
| Fast and light: fewer, cleaner features; two 3-DOF solves | Assumes visible, mostly flat ground; steep slopes, stairs and off-road terrain break the split |
| Segmentation removes small noise clusters (vegetation, rain) | Small genuine objects (poles, thin signs) can be discarded as noise |
| Ground features constrain z, roll, pitch even in empty scenes | Horizontal motion in an empty parking lot has no edges: x, y, yaw drift |
| Loop closure with a pose graph bounds long-term drift | The simple Euclidean-distance loop detection fails when drift exceeds the search radius |
A worked example: what the ground and the objects constrain
- The ground alone. A horizontal plane has normal z. The point-to-plane Jacobian row for any ground point is [nᵀ, (p × n)ᵀ] with n = (0, 0, 1) and p = (x, y, z): the row is [0, 0, 1, y, −x, 0]. It involves tz, roll (coefficient y) and pitch (coefficient −x) only; the yaw and the horizontal translations have zero coefficients. The ground thus constrains exactly the three degrees of freedom of step 1, and says nothing about the others.
- A vertical pole. An edge feature on a vertical pole has a line direction z: the point-to-line residual only measures the horizontal offset (the component perpendicular to z). It constrains tx and ty and, through the lever arm, yaw; it does not constrain tz (sliding along the pole). A wall behaves like a set of poles side by side.
- Cost. A 6-DOF LM iteration with 300 features builds a 6×6 normal matrix from 300 Jacobian rows; two 3-DOF steps build two 3×3 matrices from 150 rows each. The arithmetic is similar, but each step converges in fewer iterations because the problems are better conditioned, and the paper reports the two-step method reduces the computation time while keeping accuracy.
- On a slope. If the vehicle drives up a 15° ramp, the “ground” plane is tilted. Ground extraction with a 10° threshold between rings still works for the part of the ground that the sensor sees at its own tilt, but the horizontal-plane assumption that z, roll and pitch are separable from x, y, yaw is violated: a 15° pitch couples z and x. Errors appear as vertical drift on hills.
- In an empty parking lot. Step 1 works (the ground is everywhere), step 2 has no edge features: x, y and yaw are not constrained by the scan; the system relies on the prior and drifts. The remedy is another sensor or a map.
The lab’s last stage uses logs from a failed run, where exactly this kind of reasoning identifies the cause.
Engineering implications and limitations
Engineering implications
- Check the assumptions about your vehicle. A wheeled robot or car: good. A legged robot on rubble, a drone, a handheld device: the ground-based decomposition does not hold.
- Tune the segmentation to the environment. A cluster size threshold that removes grass also removes poles in a sparse scene; log how many points are discarded as noise.
- Watch the ground fraction. The share of points labelled ground should be stable; a sudden fall means the ground is no longer visible (a ramp, a kerb).
- Add an IMU or wheel odometry for the unconstrained directions; LeGO-LOAM alone cannot recover in featureless open ground.
- Prefer a robust loop detector than a plain radius search (Scan Context, M5-T10) and verify before accepting; LeGO-LOAM’s original scheme accepts candidates by ICP fitness only.
- Use it where it fits. For a ground vehicle in a structured environment on embedded hardware it is a strong baseline; for others, prefer LIO-SAM or FAST-LIO.
Limits
The decomposition is an assumption about the world, not a theorem: it is exact only on flat ground, where the Jacobians separate exactly. The system also inherits LOAM’s limits: no IMU, constant-velocity deskewing, features that need ring structure, and a map that is a set of keyframe feature clouds rather than a unified representation.
Common misconceptions
“LeGO-LOAM is a new SLAM theory.”
It is a set of engineering improvements on LOAM that exploit the ground-vehicle assumption.
“Removing clusters of fewer than 30 points only removes noise.”
It also removes small real objects; the threshold is a trade-off.
“The ground gives all six constraints.”
A plane constrains height, roll and pitch only; horizontal position and yaw need edges.
“Two steps are an approximation of the six-DOF solve.”
They are exact when the ground plane is horizontal and the two groups of degrees of freedom decouple; on slopes they are approximate.
Engineering takeaways
- LeGO-LOAM segments the range image into ground and object clusters and discards small clusters as noise.
- Planar ground features constrain [tz, roll, pitch]; edge features from objects constrain [tx, ty, yaw].
- The two-step LM solves two 3-DOF problems: cheaper, better conditioned, and fast enough for embedded boards.
- It assumes a ground vehicle on mostly flat terrain with visible structure; slopes and empty areas break it.
- Loop closure uses a radius search, ICP and iSAM2; stronger detectors (Scan Context) are advisable.
References and further reading
Primary papers and authoritative documentation.
- Shan, T. and Englot, B. (2018). LeGO-LOAM: Lightweight and ground-optimized lidar odometry and mapping on variable terrain. IEEE/RSJ IROS.
- Bogoslavskyi, I. and Stachniss, C. (2016). Fast range image-based segmentation of sparse 3D laser scans for online operation. IEEE/RSJ IROS: the segmentation method used.
- Zhang, J. and Singh, S. (2014). LOAM: Lidar odometry and mapping in real-time. Robotics: Science and Systems.
- Kaess, M. et al. (2012). iSAM2: Incremental smoothing and mapping using the Bayes tree. International Journal of Robotics Research 31(2).
Knowledge check
Three conceptual questions. Write an answer, then reveal the explanation. Your answers stay in your browser.
Question 1
Why does the ground plane constrain only [tz, roll, pitch] and not the horizontal translation or yaw?
Explanation
The point-to-plane Jacobian for a plane with normal z is [0, 0, 1, y, −x, 0]: the horizontal translations and the yaw rotation about z do not change the distance to a horizontal plane. Only height and the two tilts do, so step 1 can estimate exactly those.
Question 2
A LeGO-LOAM robot enters a wide empty car park. Which degrees of freedom does it lose, and what happens to the trajectory?
Explanation
Step 2 has no object features: x, y and yaw are unconstrained by the scan, while the ground still fixes z, roll and pitch. The pose then follows the prior (constant velocity), which accumulates error without bound until structure appears. Add wheel odometry or an IMU for those directions.
Question 3
Why might discarding clusters smaller than 30 points hurt in a sparse outdoor scene?
Explanation
In a sparse scene a pole or a sign may only give 10–20 points and be the only edge feature available; removing it as noise leaves step 2 with too few edges. The threshold is a trade-off between noise rejection and keeping thin, informative structure.
What’s next
Ground vehicles can lean on the ground. The next lesson takes the other route to robustness: a tightly coupled inertial sensor and a factor graph, as in LIO-SAM.
Related content
Nothing below is required to finish this lesson.
- BeforeM5-T6: A-LOAM
Read A-LOAM as an Ceres-based reimplementation of LOAM and map its modules to the algorithm.
- LabM5-L5: Investigate a Failed LiDAR Mapping Run
Given the logs of a failed run, find the root cause among several candidate failures.
Get notified when the next lesson and new labs are released.
One email per new lesson or lab.