A hands-on deployment workspace for running and comparing LiDAR-Inertial and Visual-Inertial SLAM packages on ROS 2 Humble, packaged in a reproducible Docker environment. Everything the algorithms need (ROS 2, Ceres, GTSAM, PCL, the Livox driver and the EVO evaluation toolkit) is baked into a single image, so no SLAM dependencies have to be installed on the host.
The README documents how to build and run each of the bundled pipelines, one section per package: Fast-LIMO, FAST-LIO, LeGO-LOAM and VINS-Fusion.
- About
- Included packages
- Prerequisites
- Clone the repository
- Build the Docker image
- Start the container
- Build the SLAM packages
- Launch the sensors or play a rosbag
- Run a SLAM package
- Host ↔ container communication
- Troubleshooting
The workspace bundles several SLAM implementations as git submodules and provides a single Docker image that contains all of their build and runtime dependencies. The pattern is deliberate:
-
The Docker image provides the environment : Ubuntu 22.04, ROS 2 Humble and the heavy native dependencies (Ceres, GTSAM, PCL, Livox driver, EVO).
-
The cloned repository provides the source : The SLAM packages, which are bind-mounted into the container and compiled there with
colcon.
Because the source lives on the host and is mounted into the container, you can edit code with your normal editor and simply rebuild inside the container.
| Package | Type | ROS 2 package(s) | Run instructions |
|---|---|---|---|
| fast_LIMO | LiDAR-Inertial Odometry & Mapping | fast_limo |
Fast-LIMO |
| FAST_LIO_ROS2 | LiDAR-Inertial Odometry | fast_lio |
FAST-LIO |
| LeGO-LOAM-ROS2 | LiDAR Odometry & Mapping | lego_loam_sr |
LeGO-LOAM |
| VINS-Fusion-ROS2 | Visual-Inertial Odometry | vins, loop_fusion, global_fusion, camera_models |
VINS-Fusion |
slam-tutorial-practical/
├── slam_deployment/
│ ├── build_docker.sh # builds the Docker image
│ ├── start.sh # starts the container (first terminal)
│ ├── attach.sh # opens another terminal in the running container
│ ├── Dockerfile # ROS 2 Humble + all SLAM dependencies + EVO
│ ├── requirements.txt # Python deps for EVO (trajectory evaluation)
│ ├── .devcontainer/ # VS Code Dev Container definition
│ ├── fast_LIMO/ # submodule (branch: ros2-humble)
│ ├── FAST_LIO_ROS2/ # submodule
│ ├── LeGO-LOAM-ROS2/ # submodule
│ └── VINS-Fusion-ROS2/ # submodule
└── callibration/ # sensor calibration workspaces (Kalibr, LiDAR-IMU)
Installed on the host machine:
-
git:sudo apt install git -
An X server for GUI tools such as RViz (already present on most Linux desktops)
You do not need to install ROS 2 or any SLAM dependency on the host, those live inside the image.
Clone the projects. --recursive also fetches the SLAM packages, which are git submodules:
git clone --recursive https://github.com/SaxionMechatronics/slam-tutorial-practical
cd slam-tutorial-practicalIf you already cloned without --recursive, fetch the submodules afterwards (on the host):
git submodule update --init --recursive
Fetch only the package(s) you need. git submodule update --init accepts explicit submodule paths, so you can pull just one algorithm and leave the rest as empty folders:
# only Fast-LIMO git submodule update --init --recursive slam_deployment/fast_LIMO # a subset : list several paths git submodule update --init --recursive slam_deployment/fast_LIMO slam_deployment/VINS-Fusion-ROS2
| Package | Submodule path |
|---|---|
| fast_LIMO | slam_deployment/fast_LIMO |
| FAST_LIO_ROS2 | slam_deployment/FAST_LIO_ROS2 |
| LeGO-LOAM-ROS2 | slam_deployment/LeGO-LOAM-ROS2 |
| VINS-Fusion-ROS2 | slam_deployment/VINS-Fusion-ROS2 |
Run
git submodule statusto see which are initialised.
From the repository root:
./slam_deployment/build_docker.sh
This builds the image slam-tutorial from slam_deployment/Dockerfile. Extra arguments are passed to docker build, e.g. ./slam_deployment/build_docker.sh --no-cache for a clean rebuild.
The first build takes a while (it compiles Ceres and GTSAM from source). Later builds are cached.
./slam_deployment/start.sh
This is your first terminal, and it is now a shell inside the container at /root/ws. The script:
- allows the container to open GUI windows (
xhost +local:), for RViz; - mounts
slam_deployment/at/root/ws/src, so code edits on the host show up immediately; - mounts the host's
~/rosbagsfolder at/root/bags(created if missing); - runs with
--net=hostand--ipc=host, so ROS 2 nodes on the host and in the container see each other; - keeps
build/,install/andlog/in Docker volumes, so you only build the packages once, not on every start; - names the container
slam_deployment.
| Option / variable | Effect |
|---|---|
--gpu |
pass the NVIDIA GPU through (needs the NVIDIA Container Toolkit) |
BAG_DIR=/path/to/bags |
mount a different host bag folder at /root/bags |
ROS_DOMAIN_ID=<n> |
forwarded into the container if set on the host |
# example: GPU on, bags from an external drive BAG_DIR=/media/$USER/data/rosbags ./slam_deployment/start.sh --gpu
The container is removed when you exit this first terminal (--rm); the built packages stay in the Docker volumes.
Most steps below need several terminals (sensors or rosbag in one, SLAM in another, RViz in a third). Open each extra terminal on the host and run:
./slam_deployment/attach.sh
This runs docker exec -it slam_deployment bash. Every container shell already sources ROS 2 and, once it is built, the workspace (/root/ws/install/setup.bash). Running start.sh again while the container is up does the same thing.
The repository also ships a Dev Container definition under slam_deployment/.devcontainer/.
- Install the Dev Containers extension in VS Code.
- Open the
slam_deploymentfolder in VS Code. - Run Dev Containers: Reopen in Container from the command palette.
VS Code builds the image, mounts the workspace at
/root/ws/srcand~/rosbagsat/root/bags, and runs the initialcolcon buildautomatically via the container'spostCreateCommand.
Inside the container, build the whole workspace once:
cd /root/ws colcon build --symlink-install source install/setup.bash
To (re)build just one package after editing it, use --packages-select, then re-source:
colcon build --symlink-install --packages-select fast_limo
source /root/ws/install/setup.bashTerminals opened after a build source the workspace automatically. Terminals that were already open need
source /root/ws/install/setup.bash.
Every SLAM package needs LiDAR and/or camera data plus IMU data. Either bring up the real sensors, or play the tutorial rosbag.
Start your sensor drivers, on the host or inside the container, so they publish the LiDAR, IMU and camera topics. Then check from a container terminal that the data arrives:
ros2 topic list ros2 topic hz /ouster/points
Each SLAM package subscribes to fixed topic names from its config file (see Run a SLAM package); edit those to match your sensors.
Download the rosbag here: Example Rosbags
The container plays both rosbag formats, SQLite (.db3) and MCAP (.mcap); ros2 bag play detects the format from the bag's metadata.yaml.
-
Unpack the downloaded bag folder into
~/rosbagson the host (or the folder you pass asBAG_DIRtostart.sh). It then appears inside the container under/root/bags/<bag_folder>. -
Start the SLAM package first (see Run a SLAM package).
-
In another container terminal (
./slam_deployment/attach.sh), go into the bag folder and play it (Tab completes the long folder name):cd /root/bags/<bag_folder> ros2 bag play . --clock --qos-profile-overrides-path qos/play_overrides.yaml
.is the bag folder itself (the one withmetadata.yaml), so the same command works for.db3and.mcapbags. Keep--clock: the SLAM nodes run on the bag's time (use_sim_time).
Note: always launch the SLAM algorithm first and start the bag after it, otherwise the algorithm misses the start of the recording, which it needs to initialise.
If you see
Ignoring a topic '/ublox_rover_node/navpvt', reason: package 'ublox_msgs' not found, your image predates the GNSS message packages (ublox_msgs,nmea_msgs,rtcm_msgs). Rebuild it with./slam_deployment/build_docker.shand restart the container.
The tutorial bag was recorded with the Zenoh middleware. Its
qos/play_overrides.yamlfile makes the played topics visible to normal ROS 2 nodes; without it only/tfshows up. For a bag without that file, drop the--qos-profile-overrides-pathoption.
Instead of the QoS override file, you can play the bag on the same middleware it was recorded with. Then every ROS 2 process (the SLAM node, RViz and ros2 bag play) must use Zenoh and talk through a running Zenoh router.
In every container terminal, select the Zenoh middleware:
export RMW_IMPLEMENTATION=rmw_zenoh_cppIn one of those terminals, start the Zenoh router and leave it running:
ros2 run rmw_zenoh_cpp rmw_zenohd
Then, in the other terminals, start the SLAM package and play the bag (without the override file) as usual.
RMW_IMPLEMENTATIONonly affects the shell it is exported in, so set it in every terminal. Mixing a Zenoh terminal with a Fast DDS terminal does not work: they cannot see each other.
All commands below run inside the container, with the workspace built (step 4). Use one terminal for the SLAM package and another for the sensors or the rosbag (step 5). Start the SLAM package first, then the data, so the beginning of the recording isn't missed.
Upstream project: fetty31/fast_LIMO algorithm details, full parameter reference and datasets.
Package fast_limo. The default config fast_LIMO/config/params.yaml already matches the tutorial rosbag: it subscribes to /ouster/points and /ouster/imu with sensor_type: 0 (Ouster).
# terminal 1 : the SLAM node (+ RViz) ros2 launch fast_limo fast_limo.launch.py rviz:=True # terminal 2 : the rosbag (LiDAR + IMU are all Fast-LIMO needs) cd /root/bags/<bag_folder> ros2 bag play . --clock --qos-profile-overrides-path qos/play_overrides.yaml \ --topics /ouster/points /ouster/imu
Calibration: Fast-LIMO estimates the IMU biases and gravity during the first 3 s (
calibration.time), so the sensor must stand still at the start of the data. For other sensors, settopics.input,sensor_typeand the LiDAR/IMUextrinsicsinparams.yaml, then rebuild (colcon build --symlink-install --packages-select fast_limo).
Upstream project: hku-mars/FAST_LIO algorithm details, full parameter reference and datasets.
Package fast_lio. Sensor configs live in FAST_LIO_ROS2/config/ : avia.yaml, horizon.yaml, mid360.yaml, ouster64.yaml, ouster128.yaml, velodyne.yaml. Pick the one for your LiDAR and edit its lid_topic / imu_topic to match your data.
# live : subscribe to a running sensor or an externally played bag (RViz on by default) ros2 launch fast_lio mapping_rviz.launch.py config_file:=ouster64.yaml # bag : launch the node and play a bag together ros2 launch fast_lio mapping_bag.launch.py \ bag_folder:=/root/bags/<your_bag> \ config_file:=ouster64.yaml \ use_sim_time:=true
config_filedefaults toouster128.yaml;rviz:=falsedisables the RViz window.
Upstream project: RobustFieldAutonomyLab/LeGO-LOAM algorithm details and the original paper.
Package lego_loam_sr. The launch file sets up the required TF tree, opens RViz, and plays the bag itself, so bag_folder is mandatory. Its input point cloud is remapped from /rslidar_points to /ouster/points (edit the remappings in run.launch.py for a different topic).
ros2 launch lego_loam_sr run.launch.py bag_folder:=/root/bags/<your_bag>
config_filedefaults toloam_config_corridor.yaml(also available:loam_config.yaml), override withconfig_file:=<path>. Play only the LiDAR topic from your bag, replaying the bag's/tfinterferes with LeGO-LOAM's own transforms.
Upstream project: HKUST-Aerial-Robotics/VINS-Fusion algorithm details, supported sensors and datasets.
Packages vins, loop_fusion, global_fusion, camera_models. Camera/IMU configs live in VINS-Fusion-ROS2/config/ (e.g. euroc/, kitti_odom/, kitti_raw/, realsense_d435i/, mynteye/). Both launch files take a config:= (full path to the config YAML) and a bag_folder:= argument, and play the bag themselves.
# VIO + RViz ros2 launch vins vins_rviz.launch.py \ config:=/root/ws/src/VINS-Fusion-ROS2/config/euroc/euroc_stereo_imu_config.yaml \ bag_folder:=/root/bags/<your_bag> # VIO + loop closure (adds the loop_fusion node) + RViz ros2 launch vins vins_lc_rviz.launch.py \ config:=/root/ws/src/VINS-Fusion-ROS2/config/euroc/euroc_stereo_imu_config.yaml \ bag_folder:=/root/bags/<your_bag>
To run the estimator by itself without a bag, use the node directly :
ros2 run vins vins_node <path_to_config.yaml>. GPU acceleration can be toggled inside the chosen config file.
-
packages not found: The workspace has not been built or sourced. Runcolcon build --symlink-installin/root/ws, thensource /root/ws/install/setup.bash. -
Empty submodule folders : The submodules were not initialised on the host. Run
git submodule update --init --recursivein the repository root and restart the container. -
Only
/tfappears while the bag plays : The bag was played without--qos-profile-overrides-path qos/play_overrides.yaml. See Option B: Play a rosbag. -
can't open '/qos/play_overrides.yaml': The path starts with/(or uses an unset variable such as$BAG), so it points to the container root. Run the command from inside the bag folder with the relative pathqos/play_overrides.yaml. -
ros2 topic listis empty / nodes don't discover each other : First restart the discovery daemon, which caches results and can go stale after a network change:ros2 daemon stop(it restarts on the next command). Then confirmROS_DOMAIN_IDandRMW_IMPLEMENTATIONmatch in every terminal and the container runs with--net=host. Do not add--hostnameto thedocker runcommand: with--net=hostthe custom hostname is missing from/etc/hosts, which breaks discovery. -
RViz / GUI window does not appear : Run
xhost +local:on the host (start.shdoes this) and make sureDISPLAYis forwarded. -
Start from a clean build /
rm: cannot remove 'build': Device or resource busy:build/,install/andlog/are Docker volumes mounted bystart.sh, so the folders themselves can't be deleted from inside the container. Delete their contents instead, then rebuild:cd /root/ws && rm -rf build/* install/* log/* colcon build --symlink-install