SLAM และการนำทางในพื้นที่ไม่มี GNSS
Visual/LiDAR SLAM, loop closure and evaluation
Overview: how does a drone know where it is without GNSS?
GNSS is unavailable in many places where drones need to work: inside warehouses, under bridges, in tunnels and mines, or wherever signals are jammed. Without another position source, the estimator relies on the IMU alone and the position estimate drifts away within seconds. The aircraft can no longer hold position or fly automatic missions.
The answer is SLAM (simultaneous localization and mapping): building a map and locating yourself in it at the same time. It is a chicken-and-egg problem. With a map you could localise; with a known position you could map. SLAM solves both together. The survey by Cadena and colleagues (2016) gives a thorough account of the field and its open problems.
Odometry: estimating motion step by step
Odometry estimates how far you moved between two instants and adds the steps up into a trajectory. Drones use several kinds:
- Optical flow with a rangefinder: a downward camera measures how fast the image moves, and multiplying by height gives speed. An image rate of 0.5 rad/s at 2 m height is about 1 m/s. It needs a textured floor and enough light.
- Visual odometry (VO) tracks features across consecutive images. With a single camera it cannot recover scale: the shape of the path is known, but not its length in metres.
- Visual-inertial odometry (VIO) combines a camera with the IMU. The IMU supplies scale and bridges motion blur. VINS-Mono and OpenVINS are open examples.
- LiDAR odometry aligns successive point clouds. It copes with darkness but can be confused by long corridors whose walls look the same throughout.
Every method drifts, because small errors in each step accumulate. A good system may drift by less than one percent of distance travelled, but on a long flight the error still keeps growing.
Graph-based SLAM and loop closure
Modern SLAM systems have two parts. The front-end processes sensor data: it finds features, matches them between images or scans, and detects when a place is revisited. The back-end solves an optimisation problem that makes all poses as consistent with the data as possible.
Graph-based SLAM, as described by Grisetti and colleagues (2010), stores each vehicle pose as a node and each measured relationship, such as "moved 1 m and turned 10°", as an edge with its own uncertainty. It then adjusts all nodes to minimise disagreement with the edges.
Loop closure happens when the system recognises a place it has seen before. It adds an edge stating that two nodes are the same place, and the error accumulated around the loop is spread back over every node. ORB-SLAM3 is an open library that works with monocular, stereo and visual-inertial set-ups and includes place recognition for loop closure. A false loop closure is worse than none, however, because it drags the whole map out of shape.
Visual versus LiDAR SLAM
| Aspect | Visual / visual-inertial | LiDAR |
|---|---|---|
| Weight and cost | Cameras are light and cheap | Heavier and more expensive |
| Lighting | Needs light and texture | Works in the dark |
| Difficult surfaces | Plain walls, glass, glare | Repetitive corridors, glass, dust or smoke |
| Computation | High, for image processing | High, for point-cloud matching |
On a drone, SLAM or VIO output is usually passed to the flight controller as an external vision position, which the EKF fuses with the IMU. PX4 accepts it over MAVLink or ROS 2, and it must be enabled in the EKF2 parameters. The usual mistakes are mismatched coordinate frames and uncompensated latency.
Evaluating SLAM
The most common measure is absolute trajectory error (ATE), from the benchmark of Sturm and colleagues (2012): the RMSE of distances between estimated and reference positions. Relative pose error (RPE) measures error in short segments of motion and so reflects drift. Zhang and Scaramuzza (2018) stress that the two trajectories must be aligned into a common frame first, and the alignment method must always be reported, because different methods give different numbers. Indoor reference positions can come from a motion-capture system or from surveyed checkpoints.
Worked example: closing a loop in a warehouse
Example: loop-closure error and ATE
Assume an inspection drone flies a 120 m loop around the racks and returns to its start. VIO reports the end point at (1.2, −0.9) m from the start, although they should coincide. Values are assumed.
- Error size: √(1.2² + 0.9²) = 1.5 m, or 1.5/120 = 1.25% of distance travelled.
- Simple distance-based correction: the node at 48 m along the loop sits at 48/120 = 0.4 of the way round, so it moves back by 0.4 × (1.2, −0.9) = (0.48, −0.36) m. Real systems optimise the graph using each edge's uncertainty; the distance rule only illustrates the idea.
- ATE: if, after loop closure and alignment, the errors at four checkpoints are 0.1, 0.2, 0.2 and 0.4 m, then ATE = √((0.01 + 0.04 + 0.04 + 0.16)/4) = √0.0625 = 0.25 m. The plain mean is 0.225 m; RMSE weights large errors more heavily.
A report must state distance travelled, alignment method and reference source. Without them, a figure of 0.25 m cannot be compared with anyone else's.
Common pitfalls
- Using a single camera without an IMU or range sensor and assuming the scale is known.
- Trusting visual SLAM in low light, beside plain walls or glass, without checking.
- Accepting a loop closure matched to the wrong place, which warps the entire map.
- Feeding SLAM position to the flight controller without checking frames, heading and latency.
- Running VIO without camera-IMU calibration (intrinsics, relative pose and time offset).
- Reporting ATE without the alignment method, or judging from a nice-looking plot instead of numbers.
- First tests at speed near obstacles instead of slowly inside a netted area.
Continue in the lessons
- UAT 322 Module 3: Obstacle avoidance and mapping: SLAM principles and trajectory evaluation with ATE.
- UAT 366 Module 2: SLAM and sensor fusion: graph SLAM, loop closure and error distribution.
Key references
- Cadena, C., Carlone, L., Carrillo, H., Latif, Y., Scaramuzza, D., Neira, J., Reid, I., & Leonard, J. J. (2016). Past, present, and future of simultaneous localization and mapping: Toward the robust-perception age. IEEE Transactions on Robotics, 32(6), 1309–1332. link
- Campos, C., Elvira, R., Gómez Rodríguez, J. J., Montiel, J. M. M., & Tardós, J. D. (2021). ORB-SLAM3: An accurate open-source library for visual, visual–inertial, and multimap SLAM. IEEE Transactions on Robotics, 37(6), 1874–1890. link
- Grisetti, G., Kümmerle, R., Stachniss, C., & Burgard, W. (2010). A tutorial on graph-based SLAM. IEEE Intelligent Transportation Systems Magazine, 2(4), 31–43. link
- Sturm, J., Engelhard, N., Endres, F., Burgard, W., & Cremers, D. (2012). A benchmark for the evaluation of RGB-D SLAM systems. In 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems (pp. 573–580). link
- Zhang, Z., & Scaramuzza, D. (2018). A tutorial on quantitative trajectory evaluation for visual(-inertial) odometry. In 2018 IEEE/RSJ International Conference on Intelligent Robots and Systems (pp. 7244–7251). link
- PX4 Autopilot. Using vision or motion capture systems for position estimation. PX4 guide (main). link