Robotics From Zero
Module: See The World

LiDAR and Point Clouds

How LiDAR works, the difference between 2D and 3D LiDAR, point cloud structure, and what range and intensity tell you.

10 min read

LiDAR and Point Clouds

LiDAR (Light Detection and Ranging) is the "radar for robots." It shoots laser beams at the world and measures how long they take to bounce back. The result: direct distance measurements — no guessing, no calibration headaches, just raw 3D geometry.

How LiDAR Works

The core principle:

  1. Emit a laser pulse toward a target
  2. Wait for the reflection to return
  3. Measure the time (usually nanoseconds)
  4. Calculate distance using the speed of light:
distance = (speed_of_light * time) / 2

(Divided by 2 because the light travels to the target and back.)

Since light moves at ~300,000 km/s, even nanosecond precision gives millimeter-accurate measurements.

Note

LiDAR is an active sensor — it emits its own light. Cameras are passive — they rely on ambient light. This means LiDAR works perfectly in total darkness, but struggles with transparent surfaces (glass, water) that don't reflect lasers well.

2D vs. 3D LiDAR

2D LiDAR scanning — laser spins in a single horizontal plane, emitting beams and measuring distances at each angle
A 2D LiDAR spins in one plane, measuring distance at each angle to build a radial scan of the environment.

2D LiDAR (Laser Scanners)

  • Spins in a single plane (usually horizontal)
  • Outputs a 1D array of distances — one per angle
  • Common range: 270° coverage, 0.25° angular resolution (~1080 points per scan)
  • Used for: indoor navigation, obstacle avoidance, 2D mapping
2D LiDAR Scan Structure
# A single 2D scan
scan = {
  "angle_min": -2.356,       # radians (-135°)
  "angle_max": 2.356,        # radians (135°)
  "angle_increment": 0.0044, # radians (~0.25°)
  "ranges": [
    3.2,  # distance at -135°
    3.1,  # distance at -134.75°
    2.9,  # distance at -134.5°
    # ... 1080 total measurements
  ],
  "intensities": [
    50,   # reflection strength (0-255)
    48,
    52,
    # ... corresponding to each range
  ]
}

3D LiDAR (Spinning/Solid-State)

  • Multiple laser beams in different vertical angles
  • Outputs a 2D array or point cloud — (x, y, z) coordinates
  • Common configurations: 16, 32, 64, or 128 beams
  • Used for: 3D mapping, autonomous driving, aerial surveying
3D Point Cloud Structure
# A 3D point cloud
point_cloud = {
  "width": 1024,    # points per horizontal scan line
  "height": 64,     # number of vertical beams
  "points": [
    {"x": 2.5, "y": 0.3, "z": 0.1, "intensity": 120},
    {"x": 2.4, "y": 0.3, "z": 0.0, "intensity": 115},
    # ... (1024 * 64 = 65,536 points per scan)
  ]
}
 
# Total data per scan: ~1-2 MB (depending on encoding)
# At 10 Hz, that's 10-20 MB/sec

Point Clouds: The Data Structure

Point cloud visualization — 3D scatter of colored points representing surfaces of objects in a scene
A point cloud is a set of 3D points — each with position, intensity, and optionally color — representing the scanned environment.

A point cloud is just a collection of 3D points. Each point has:

  • Position: (x, y, z) in meters (or whatever unit)
  • Intensity: How much laser light reflected (0-255 or 0-65535)
  • Optional: color (if fused with camera), timestamp, beam ID

Organized vs. Unorganized

  • Organized: Points form a grid (like image pixels) — fast to index by row/column
  • Unorganized: Points in a flat list — more flexible but slower to query
Tip

Think of an organized point cloud as a "depth image" — each pixel stores (x, y, z) instead of (r, g, b). This makes it easy to find neighboring points, which is critical for surface normal estimation and segmentation.

Range and Intensity

Range (Distance)

  • Maximum range: 10m (indoor LiDAR) to 200m+ (automotive LiDAR)
  • Invalid readings: Returned as inf, NaN, or a special value (often 0 or max_range + 1)
  • Failure cases: Transparent objects, very dark/absorbing surfaces, max range exceeded

Intensity (Reflectivity)

LiDAR intensity values — bright reflective surfaces return high intensity, dark surfaces return low intensity
Intensity measures how much laser light reflects back. Bright surfaces and retroreflectors show high values; dark or angled surfaces show low values.

Measures how much laser light bounces back. High intensity means:

  • Bright/reflective surfaces (white walls, metal, retroreflectors)
  • Close objects (more photons return)

Low intensity means:

  • Dark/absorbing surfaces (black rubber, asphalt)
  • Far objects (signal weakens with distance)
  • Glancing angles (laser hits at a steep angle, less reflection)
Filtering Point Clouds
# Remove invalid points
valid_points = [p for p in points if 0.1 < p.z < 50.0]
 
# Remove low-confidence points (weak reflections)
confident_points = [p for p in valid_points if p.intensity > 30]
 
# Remove ground plane (assume z < 0.1 is floor)
non_ground = [p for p in confident_points if p.z > 0.1]
 
# Now you have clean data for obstacle detection
Scan to occupancy grid — LiDAR scan points converted into a 2D occupancy grid for navigation
LiDAR scans can be converted into occupancy grids — marking cells as free, occupied, or unknown — for navigation and mapping.

Common LiDAR Use Cases

ApplicationLiDAR TypeWhy
Indoor navigation2D (single plane)Cheap, fast, perfect for flat environments
Outdoor mapping3D (64+ beams)Captures terrain, trees, buildings
Warehouse robots2DPallets and obstacles are mostly at one height
Self-driving cars3D (128 beams)Need to see pedestrians, cars, road geometry
Drones3D (lightweight)Terrain mapping, collision avoidance

What's Next?

LiDAR gives us 3D points, but cameras give us rich visual information. The next lesson explores depth perception — how we can get 3D distance data from cameras alone, and when to choose LiDAR vs. vision-based depth.

Got questions? Join the community

Discuss this lesson, get help, and connect with other learners on r/softwarerobotics.

Join r/softwarerobotics

Frequently Asked Questions

How does LiDAR work on robots?

LiDAR (Light Detection and Ranging) works by emitting laser pulses and measuring the time it takes for each pulse to bounce back from a surface. The round-trip time is converted to a distance measurement. By rapidly scanning the laser across the environment, LiDAR builds a detailed map of distances in all directions, producing either a 2D scan line or a 3D point cloud.

What is the difference between 2D and 3D LiDAR?

2D LiDAR scans a single horizontal plane, producing a flat ring of distance measurements — ideal for obstacle avoidance and indoor navigation. 3D LiDAR uses multiple laser beams at different vertical angles (or a rotating mechanism) to scan the full environment, producing a dense 3D point cloud. 3D LiDAR is more expensive but essential for outdoor autonomous driving and complex 3D mapping.

How much does a robot LiDAR sensor cost?

Prices range widely based on capability. Budget 2D LiDARs like the RPLidar A1 cost around $100 to $200 and are suitable for hobbyist robots. Mid-range 2D LiDARs (Hokuyo, SICK) cost $1,000 to $5,000 for industrial use. 3D LiDARs range from $500 for solid-state units to $10,000 or more for high-end mechanical spinning units used in autonomous vehicles.

Further Reading

Related Lessons

Discussion

Sign in to join the discussion.