cartographer/configuration_files/map_builder.lua¶
Overview¶
Top-level configuration for the MapBuilder. Selects 2D vs 3D SLAM, sets background thread count, and references pose graph configuration.
Configuration¶
include "pose_graph.lua"
MAP_BUILDER = {
use_trajectory_builder_2d = false,
use_trajectory_builder_3d = false,
num_background_threads = 4,
pose_graph = POSE_GRAPH,
collate_by_trajectory = false,
}
Parameters¶
Parameter |
Type |
Default |
Description |
|---|---|---|---|
|
bool |
|
Enable 2D SLAM (lidar + IMU/odometry) |
|
bool |
|
Enable 3D SLAM (3D lidar + IMU/odometry) |
|
int |
|
Threads for scan matching & optimization |
|
table |
|
Global optimization config (from pose_graph.lua) |
|
bool |
|
Collate sensor data per trajectory vs globally |
Usage¶
Exactly one of use_trajectory_builder_2d or use_trajectory_builder_3d must be true.
2D SLAM Example¶
include "trajectory_builder_2d.lua"
include "pose_graph.lua"
MAP_BUILDER = {
use_trajectory_builder_2d = true,
use_trajectory_builder_3d = false,
num_background_threads = 4,
pose_graph = POSE_GRAPH,
collate_by_trajectory = false,
}
3D SLAM Example¶
include "trajectory_builder_3d.lua"
include "pose_graph.lua"
MAP_BUILDER = {
use_trajectory_builder_2d = false,
use_trajectory_builder_3d = true,
num_background_threads = 7,
pose_graph = POSE_GRAPH,
collate_by_trajectory = false,
}
Multi-Session / Multi-Robot¶
For multiple trajectories (multi-session or multi-robot):
MAP_BUILDER = {
use_trajectory_builder_2d = true,
num_background_threads = 8,
pose_graph = POSE_GRAPH,
collate_by_trajectory = true, -- Separate collator per trajectory
}
When collate_by_trajectory = true, each trajectory gets its own sensor collator, allowing different sensor configurations per trajectory.
Thread Count Guidelines¶
Platform |
Recommended |
|---|---|
Desktop (8+ cores) |
4-7 |
Laptop (4 cores) |
2-3 |
Embedded (2 cores) |
1 |
Single-threaded |
0 (synchronous) |
See Also¶
trajectory_builder_2d.lua — 2D local SLAM config
trajectory_builder_3d.lua — 3D local SLAM config
pose_graph.lua — Global optimization config
MapBuilder — Uses this configuration