AnyLearn
All lessons
Roboticsadvanced

LiDAR and Point Clouds

How LiDAR fires pulses and measures time-of-flight to build a 3D point cloud; data structures, voxel downsampling, ICP registration, ground segmentation, and an honest comparison with cameras for robot perception.

Not signed in โ€” your progress and quiz score won't be saved.
Lesson progress1 / 9

How LiDAR measures range

A LiDAR (Light Detection and Ranging) unit fires a short laser pulse and measures the time-of-flight (ToF) until the return arrives at the detector:

d=cโ‹…ฮ”t2d = \frac{c \cdot \Delta t}{2}

where cโ‰ˆ3ร—108c \approx 3 \times 10^8 m/s is the speed of light and ฮ”t\Delta t is the round-trip time. A 10 ns timing resolution gives 1.5 m range resolution โ€” too coarse. Modern sensors interpolate the return pulse shape to achieve 2-4 cm range precision. Rotating mechanical LiDARs (Velodyne VLP-16, HDL-64) spin a mirror to sweep multiple laser beams through 360ยฐ; solid-state units (Livox MID-360, Ouster OS1) use MEMS mirrors or optical phased arrays. Typical specs: 10-20 Hz scan rate, 0-100 m range, ยฑ2 cm accuracy, 16-128 beams (channels). Sparsity is the fundamental limitation: at 20 m a 16-beam unit has roughly 0.5 m vertical spacing between rings.

Full lesson text

All 9 steps on one page โ€” for reading, reference, and search.

Show

1. How LiDAR measures range

A LiDAR (Light Detection and Ranging) unit fires a short laser pulse and measures the time-of-flight (ToF) until the return arrives at the detector:

d=cโ‹…ฮ”t2d = \frac{c \cdot \Delta t}{2}

where cโ‰ˆ3ร—108c \approx 3 \times 10^8 m/s is the speed of light and ฮ”t\Delta t is the round-trip time. A 10 ns timing resolution gives 1.5 m range resolution โ€” too coarse. Modern sensors interpolate the return pulse shape to achieve 2-4 cm range precision. Rotating mechanical LiDARs (Velodyne VLP-16, HDL-64) spin a mirror to sweep multiple laser beams through 360ยฐ; solid-state units (Livox MID-360, Ouster OS1) use MEMS mirrors or optical phased arrays. Typical specs: 10-20 Hz scan rate, 0-100 m range, ยฑ2 cm accuracy, 16-128 beams (channels). Sparsity is the fundamental limitation: at 20 m a 16-beam unit has roughly 0.5 m vertical spacing between rings.

2. The point cloud as a data structure

A single LiDAR scan produces a point cloud: an unordered set of 3D points {pi}โŠ‚R3\{\mathbf{p}_i\} \subset \mathbb{R}^3, each with optional attributes (intensity, ring ID, timestamp). This is fundamentally different from images โ€” there is no regular grid. Two representations dominate in practice:

  • Flat array (float32[N, 4] with columns [x,y,z,intensity][x, y, z, \text{intensity}]): cache-friendly, easy to broadcast; spatial queries are O(N)O(N).
  • KD-tree (built with scipy.spatial.KDTree or FLANN): O(logโกN)O(\log N) radius / nearest-neighbour queries; amortised over many lookups.
  • Voxel hash map: buckets space into a 3D grid; O(1)O(1) insert and lookup, but memory spikes for large scenes.

For real-time robotics (10 Hz, Nโ‰ˆ105N \approx 10^5 points), the KD-tree rebuild per scan is a bottleneck โ€” prebuilding an incremental variant or using GPU-accelerated libraries (cuPCL) is common.

3. Voxel downsampling

Raw LiDAR scans are dense near the sensor and sparse far away. Voxel downsampling normalises density: partition 3D space into a grid of cubes of side length vv, then replace all points inside a voxel with their centroid (or any representative point). This reduces NN by 3-10ร— with minimal loss of structure at the chosen scale vv.

import open3d as o3d
import numpy as np

# Load raw scan
pcd = o3d.io.read_point_cloud("scan.pcd")
print(f"Before: {len(pcd.points)} points")

# Voxel downsample at 10 cm resolution
down = pcd.voxel_down_sample(voxel_size=0.10)   # metres
print(f"After: {len(down.points)} points")

# Estimate surface normals for ICP / segmentation
down.estimate_normals(
    search_param=o3d.geometry.KDTreeSearchParamHybrid(
        radius=0.3, max_nn=30
    )
)

Choosing vv: too large destroys thin objects (fences, poles); too small and you gain nothing. For urban outdoor SLAM, 10-20 cm is typical; for warehouse robots, 2-5 cm.

4. Point cloud registration and ICP

Registration aligns two overlapping point clouds โ€” the core primitive in LiDAR odometry. Iterative Closest Point (ICP) is the classic algorithm:

  1. For each point pi\mathbf{p}_i in the source cloud, find its nearest neighbour qi\mathbf{q}_i in the target cloud.
  2. Solve for the rigid transform (R,t)(R, \mathbf{t}) that minimises โˆ‘iโˆฅRpi+tโˆ’qiโˆฅ2\sum_i \|R\mathbf{p}_i + \mathbf{t} - \mathbf{q}_i\|^2 (closed-form via SVD of the cross-covariance matrix).
  3. Apply the transform and repeat until convergence.

ICP converges to the correct answer only if the initial alignment is close (typically within 1-2 m and 10ยฐ). In practice, LiDAR SLAM front ends use NDT (Normal Distributions Transform) or feature-based matching (LOAM: extract edge and planar features) for coarse alignment, then refine with ICP. Convergence failure modes: symmetrical scenes (long straight corridors), degenerate geometries (flat ground only), and dynamic objects (pedestrians move between scans).

5. Ground plane segmentation

Separating the drivable ground from obstacles is a foundational operation. The simplest method is RANSAC plane fitting: repeatedly sample 3 non-collinear points, fit a plane, count inliers within distance threshold ฯต\epsilon, and keep the best hypothesis:

import open3d as o3d

pcd = o3d.io.read_point_cloud("scan.pcd")

# RANSAC plane segmentation
plane_model, inliers = pcd.segment_plane(
    distance_threshold=0.15,  # metres
    ransac_n=3,
    num_iterations=200
)
[a, b, c, d] = plane_model
print(f"Plane equation: {a:.2f}x + {b:.2f}y + {c:.2f}z + {d:.2f} = 0")

ground = pcd.select_by_index(inliers)
obstacles = pcd.select_by_index(inliers, invert=True)

Limitations: sloped terrain breaks a single-plane assumption (use multi-plane fitting or normal-based region growing); bridge decks and ramps require elevation maps (costmaps). After ground removal, Euclidean cluster extraction groups remaining points into obstacle candidates for downstream detection.

6. LiDAR vs camera: honest tradeoffs

Engineers love to debate this. Here is an honest comparison:

PropertyLiDARCamera
Metric depthDirect, 2-4 cm accuracyStereo or monocular (indirect, noisier)
RangeUp to 100-200 mStereo reliable up to 10-30 m
Texture / colorNone (intensity only)Full RGB, semantic richness
Performance in darknessFull (active sensor)Degraded without illumination
Rain / fogSignificant degradationDegraded but milder
CostHigh (500โˆ’500-75,000)Low (10โˆ’10-500)
Data rate10-20 Hz, ~1-10 M pts/scan30-120 Hz, dense pixels
Thin object detectionMisses wires, glassCan detect via texture

The verdict for autonomous vehicles: both. Cameras provide semantic richness (reading signs, traffic lights); LiDAR provides reliable metric structure. Fusing them โ€” LiDAR-camera fusion โ€” is the dominant architecture in serious production stacks.

7. LiDAR odometry and mapping

LiDAR odometry uses scan-to-scan (or scan-to-submap) registration to estimate robot motion. The pipeline:

  1. Receive new scan at time tt.
  2. Downsample and extract features (edges on high-curvature points, planes on low-curvature patches โ€” LOAM's insight).
  3. Register features against the local map to get relative pose ฮ”T\Delta T.
  4. Compose: Tt=Ttโˆ’1โ‹…ฮ”TT_t = T_{t-1} \cdot \Delta T.
  5. Add scan to local map, keyframe if motion exceeds threshold.

A flat featureless floor is the death scenario: all points are coplanar, so the cross-covariance SVD loses one singular value, and the component along the floor normal is unobservable. Good systems detect this degeneracy by checking the condition number of the information matrix and fuse IMU data to constrain the missing DOFs. Without loop closure, LiDAR odometry drifts at roughly 0.5-2% of distance travelled โ€” better than camera VO, but still non-zero.

8. LiDAR processing pipeline

From raw scan to obstacle list โ€” the standard stack.

flowchart LR
  S["Raw scan N points"]
  V["Voxel downsample"]
  G["Ground segmentation RANSAC"]
  O["Obstacle points"]
  C["Euclidean clustering"]
  R["Registration ICP or NDT"]
  M["Local map update"]
  D["Detected obstacles"]
  S --> V
  V --> G
  G --> O
  O --> C
  C --> D
  V --> R
  R --> M

9. Deep learning on point clouds

Classical methods treat points as geometry. Deep approaches learn directly from point clouds:

  • PointNet (Qi et al., 2017): applies a shared MLP per point, then a global max-pool โ€” permutation-invariant and order-independent. Simple, fast, misses local structure.
  • PointNet++: adds hierarchical grouping with ball-query radius sampling to capture local context. Better accuracy, slower.
  • VoxelNet / PointPillars: voxelise or pillarise the cloud, apply 2D convolutions, use as a detection backbone. PointPillars runs in <10< 10 ms on a GPU โ€” fast enough for 10 Hz LiDAR.
  • Range image CNNs: project the spin-scan onto a cylindrical range image, apply 2D segmentation. Extremely fast; loses 3D structure.

Production stacks (Waymo, Cruise) use ensemble approaches combining pillars-based detection with classical clustering and tracking filters. No single network handles all edge cases โ€” the stack depth is the point.

Check your understanding

The lesson ends with a 5-question quiz. Take it in the player above to see your score.

  1. A LiDAR with 1 cm range precision fires a pulse and detects the return. What physical quantity is measured directly?
    • The phase shift of the continuous-wave laser
    • The round-trip time-of-flight of the laser pulse
    • The Doppler frequency shift of the reflected beam
    • The intensity gradient across the return waveform
  2. ICP scan registration is known to fail when initial alignment is far from ground truth. Why?
    • ICP requires GPU acceleration to find the global optimum.
    • The nearest-neighbour correspondences become incorrect when clouds are far apart, trapping ICP in a local minimum.
    • ICP cannot handle point clouds with more than 10,000 points efficiently.
    • ICP assumes both clouds have the same number of points.
  3. After voxel downsampling at 10 cm resolution, what is stored at each occupied voxel?
    • The raw LiDAR return waveform at the voxel centre.
    • A representative point such as the centroid of all original points inside the voxel.
    • The maximum intensity point in the voxel to preserve strong returns.
    • A probability occupancy value between 0 and 1.
  4. In a featureless corridor, LiDAR odometry using ICP becomes degenerate. What causes this?
    • The LiDAR scan rate drops below the required 10 Hz in symmetric environments.
    • All points are coplanar along one direction, making the information matrix rank-deficient and the pose component normal to the plane unobservable.
    • PointNet cannot process corridor scans because they exceed the maximum point count.
    • RANSAC plane fitting removes the corridor walls as false-positive ground planes.
  5. PointPillars is preferred over PointNet++ for real-time LiDAR detection. Why?
    • PointPillars uses spherical coordinates which match the LiDAR scan geometry better than Cartesian.
    • PointPillars encodes points into vertical column features and applies fast 2D convolutions, achieving sub-10 ms inference on a GPU.
    • PointPillars trains faster because it uses binary cross-entropy instead of focal loss.
    • PointPillars avoids KD-tree lookups by using the raw time-ordered LiDAR stream directly.

Related lessons

Robotics
beginner

Sensors: How Robots Perceive

A robot is only as good as what it can measure. Explore the full sensor toolkit โ€” encoders, IMUs, ultrasonic rangefinders, LiDAR, cameras, and force/torque sensors โ€” and learn the four metrics that determine whether a sensor is fit for purpose: resolution, range, noise, and sampling rate.

10 stepsยท~15 minยทaudio
AI
advanced

Reinforcement Learning in 2026: Where It Ships and Where It Stalls

An honest map of RL in 2026 โ€” the domains where it actually reaches production (LLM post-training, robotics policies, ad bidding, RLHF, reasoning models) and the places where it still cannot reliably cross the lab-to-deployment gap.

12 stepsยท~18 minยทaudio
Robotics
beginner

Closing the Loop: Microcontrollers and Feedback

Open-loop control is a guess; closed-loop control is a conversation. Learn why feedback transforms an unreliable robot into a reliable one, how the read-compute-actuate cycle works, what microcontrollers and single-board computers each do best, and why loop timing is just as critical as the algorithm running inside it.

10 stepsยท~15 minยทaudio
Robotics
beginner

What Is a Robot? Anatomy and the Sense-Plan-Act Loop

Strip any robot to its bones and you find three things: sensors that gather data, a controller that thinks, and actuators that move. Learn how these pieces fit together through the Sense-Plan-Act paradigm, why reactive control sometimes beats planning, and what makes a Roomba and a welding arm both qualify as robots.

10 stepsยท~15 minยทaudio