Lidar and SLAM
Also available in: Català · Castellano
The problem: drift
A wheeled robot estimates its position by counting wheel turns (odometry). Every small error adds up: drift.
Intuition: walking with your eyes closed while counting steps sends you off course; with your eyes open you compare and correct yourself.
Lidar
It measures distance with light (time of flight) in many directions at once: a scan. It works at night and is accurate. Example: the Go2 carries an L2 4D lidar (360° × 96°, minimum range 0.05 m).
SLAM
Simultaneous Localization And Mapping: it builds the map and locates itself in it at the same time. Aligning each new scan with the map (scan matching, for example ICP) corrects the drift. It’s a chicken-and-egg problem: to map you need to know where you are, and to know that you need the map.
- Occupancy grid: a map of free / occupied / unknown cells.
- Loop closure: recognising a place already visited and correcting the whole map; it’s the moment the map “snaps” into place.
- Real systems: LIO-SAM, LeGO-LOAM.
In the demo
First with wheels only: the error grows. Then turn on SLAM: the map builds up and the position holds. Drive with the arrow keys.
Interactive demo
Related concepts
Ultrasonic distance sensor
It sends a pulse and measures how long the echo takes: d = c · t / 2. The speed of sound depends on temperature, so if you don't compensate for it the reading drifts.
IMU and sensor fusion
The accelerometer knows where down is but gets confused when moving; the gyroscope is smooth but drifts. A complementary filter trusts the gyroscope in the short term and the accelerometer in the long term.
Coordinate frames and transforms
A point only has coordinates relative to a frame (origin + axes). To go from the robot's frame to the world's: p_world = R(θ) · p_robot + t.