slamplay

luigifreda更新放缓

一套用 C++ 上手和实验 SLAM 的工具集,涵盖特征匹配、因子图优化、回环检测与三维可视化,方便快速搭建和调试视觉 SLAM 原型。

slamplay is a collection of powerful tools to start playing and experimenting with SLAM in C++

暂无版本451star43fork同步于 2026-11-07 07:32 UTC

怎么上手

由 README 提炼,执行前请确认
./install_dependencies.sh
./install_local_opencv.sh
./build.sh
硬件要求按 README 说明

README 未给出具体显存或内存要求;DL 部分可选 CUDA、cuDNN、TensorRT GPU 支持,测试配置见 GPU_support.md;CPU 可跑非 DL 示例,Ubuntu 20.04/22.04/24.04 已测试。

需要 CUDA
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

把 g2o、gtsam、Ceres、OpenCV、TensorRT 等 SLAM 依赖整合进单一 CMake 框架的 C++ 实验工具集

一套用 C++ 上手和实验 SLAM 的工具集,涵盖特征匹配、因子图优化、回环检测与三维可视化,方便快速搭建和调试视觉 SLAM 原型。

核心能力

  • 用统一 CMake 框架集成 g2o、gtsam、Ceres、se-sync 等后端
  • 内置 SuperPoint、SuperGlue、HFNet、Depth-Anything、SAM 等 DL 前端示例
  • 提供 KITTI、EuRoC 视觉 SLAM 与 LiDAR-惯性 SLAM 端到端管线
  • 自带最小 ROS1 兼容子集,读 .bag 无需安装系统 ROS
  • 含 Eigen 教程、回环检测、可视化与性能分析示例

容易踩的坑

首次运行 TensorRT 示例会把 onnx 转 engine,耗时较长;DL 模型需额外执行 ./install_dl_models.sh 下载权重;TensorFlow C++ API 需手动跑 install_tensorflow_cc.sh;g2o 可能链接到系统库导致崩溃,需设 LD_LIBRARY_PATH 或启用 RPATH;gtsam/g2o 与 -march=native 混用可能退出时 double free。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    slamplay

    Author: Luigi Freda

    slamplay is a collection of tools to start playing and experimenting with SLAM in C++. It installs and wires up, in a single CMake framework, some of the most important

    • back-end frameworks (g2o, gtsam, ceres, se-sync, etc.),
    • front-end tools (OpenCV, PCL, lidar/IMU processing, etc.),
    • algebra and geometry libs (eigen, sophus, cholmod, etc.),
    • viz tools (pangolin, imgui, rerun, etc.),
    • loop-closure frameworks (DBoW2, DBoW3, iBoW, etc.),
    • deep learning tools (TensorRT, tensorflow_cc, libtorch, onnxruntime, etc.),

    along with commented examples to get started quickly.

    I created slamplay for a computer vision class I taught. I started developing it for fun, during my free time, taking inspiration from some repos available on the web.

    Repository layout

    FolderRole
    algebra_geometryEigen / geometry tutorials and examples
    backendg2o, gtsam, ceres, se-sync examples
    configYAML configs (vslam/, lio_slam/)
    coreShared libraries: DL models, ad/ lidar–IMU stack
    dataDatasets and sample assets
    dense_mappingDense / surfel mapping examples
    docsExtra documentation
    frontendVision and sensor front-end examples (*)
    full_slamEnd-to-end SLAM: vslam/, lio_slam/, apps
    ioI/O utilities
    loop_closurePlace-recognition examples
    rosROS-compat modules (no system ROS required)
    resultsDefault output for mapping runs
    scriptsHelper scripts
    semanticsSemantic segmentation (*)
    utilsMisc utilities
    vizVisualization tools

    (*) C++ tools based on TensorRT, tensorflow_cc, onnxruntime — e.g. SuperPoint, SuperGlue, Depth-Anything, HFNet, Segment-Anything (SAM).

    Visual SLAM building blocks live under core/ (features, features_dl, depth_dl, …) with VO and geometry examples (camera_model, stereo_vision, motion estimation, triangulation, direct method, …) in frontend/. The stereo SLAM pipeline is in full_slam/vslam/ (frontend, backend, visual odometry, map).

    LiDAR-inertial building blocks live under core/ad/ (laser_2d, laser_3d, imu, pointcloud, nav, …) with LIO variants (lio_iekf, lio_preinteg, NDT, LOAM-like) in core/ad/laser_3d/. The mapping pipeline is in full_slam/lio_slam/ (frontend, loop closure, pose-graph optimization, localization fusion).


    How to start

    Tested on Ubuntu 20.04, 22.04, and 24.04.

    • Install basic dependencies: $ ./install_dependencies.sh
    • Install OpenCV locally: $ ./install_local_opencv.sh
    • Build: $ ./build.sh

    This takes a while. When the build finishes, enter build/ and run the examples. See Full SLAM for the main end-to-end apps.

    No system ROS install is required. Examples that read .bag files use a minimal ROS1-compatible C++ subset vendored in thirdparty/ros/ (librosbag.a and message headers). There is no catkin workspace and no dependency on a distro ROS package. Optional ROS-compat helpers live under ros/. See thirdparty/ros/README.md for scope and limitations.

    Configuration

    config.sh defines your working environment and is sourced automatically by the install/build scripts.

    To skip the local OpenCV install, set OpenCV_DIR in config.sh. This is not recommended: mixed dependency versions can cause undefined behaviour and you may lose features.

    Install data

    To run examples with the default input data, download the provided images and videos (deployed under data/):

    $ ./install_data.sh

    Deep learning (DL)

    Install DL models

    To use the DL models, download weights and related data:

    $ ./install_dl_models.sh

    GPU support with CUDA, cuDNN, TensorRT

    See these tested configurations for the CUDA ecosystem.

    Install tensorflow C++ API

    For the TensorFlow C++ API (e.g. HFNet):

    $ ./install_tensorflow_cc.sh

    See tensorflow_cc for details. This step is long, so you must run install_tensorflow_cc.sh manually.


    Docker

    For containerized use, see rosdocker (images with or without CUDA).


    Full SLAM

    End-to-end pipelines live under full_slam/. Config files are in the top-level config/ folder (compiled into apps as CONFIG_DIR).

    Visual SLAM (vSLAM)

    1. Edit config/vslam/kitti.yaml or config/vslam/euroc.yaml
    2. Run:
      cd build/full_slam/apps/vslam
      ./run_vslam_kitti_stereo   # or ./run_vslam_euroc_stereo
      

    Library and apps: full_slam/vslam/, full_slam/apps/vslam/.

    VSLAM datasets

    LiDAR-inertial SLAM (LIO)

    Offline mapping pipeline (frontend → optimization → loop closure → re-optimization).

    1. Edit config/lio_slam/mapping.yaml (bag path, dataset-specific lio_yaml, output under results/)
    2. Pick a sensor preset in config/lio_slam/ (velodyne.yaml, avia.yaml, velodyne_nclt.yaml, …)
    3. Run the full pipeline:
      cd build/full_slam/apps/lio_slam
      ./run_lio_mapping
      

    Step-wise apps (same config): run_lio_step_frontend, run_lio_step_optimization, run_lio_step_loop_closure, run_fusion_offline.
    Utilities: dump_lio_map, split_lio_map.

    Related front-end demos in frontend/laser_3d/ (implementations in core/ad/laser_3d/):

    • Standalone LIO: test_3d_lio_iekf, test_3d_lio_preinteg, test_3d_lio_loosely_coupled
    • LiDAR odometry: test_3d_ndt_lo, test_3d_ndt_lo_inc, test_3d_loam_odom

    LIO examples use the same config/lio_slam/ presets (--bag_path, --dataset_type, --config):

    cd build/frontend/laser_3d
    ./test_3d_lio_iekf --bag_path=... --dataset_type=NCLT
    

    or

    ./test_3d_lio_preinteg --bag_path=... --dataset_type=NCLT
    

    LIO datasets

    Download the datasets by using this link.


    Eigen Tutorials

    See the ascii quick reference.


    Front-end

    Notes on selected front-end features.

    Features DL (Deep Learning)

    In frontend/features_dl (and core/features_dl):

    • SuperPoint and SuperGlue (TensorRT)
    • HFNet (TensorRT and TensorFlow)

    Warning: The first TensorRT run converts each onnx model to an engine and can take a while.

    Depth DL

    In frontend/depth_dl (and core/depth_dl):

    Warning: Same engine-build delay on first run.

    Tensorflow C++ API

    As above: $ ./install_tensorflow_cc.sh — see tensorflow_cc. See also GPU_support.md.


    Back-end

    Notes on selected back-end frameworks.

    GTSAM examples

    Installed tag 4.2a9

    Documentation

    Known issues To avoid double free or corruption on exit with gtsam, disable -march=native for gtsam-related targets (remove it from folder-level compile flags). See:

    Ceres examples

    Installed tag 2.1.0

    Documentation

    g2o examples

    Installed tag 20230223_git. Examples.

    Issues:


    IO

    Notes on I/O utilities.

    chrono

    https://www.modernescpp.com/index.php/the-three-clocks

    Differences amongst the three clocks?

    • std::chrono::system_clock: Wall-clock time; to_time_t / from_time_t for calendar dates.
    • std::chrono::steady_clock: Monotonic; preferred for durations and timeouts.
    • std::chrono::high_resolution_clock: Highest resolution; may alias system_clock or steady_clock.

    The standard does not fix accuracy, epoch, or range. system_clock is usually UNIX epoch (1970); steady_clock is often time since boot.

    Layman terms: system_clock is a watch (what time is it?). steady_clock is a stopwatch (how long did the lap take?).


    Profiling

    Tracy

    Installed by build.sh. Repo: https://github.com/wolfpld/tracy — docs.

    • Include profiler/profiler_tracy.h in files you want to profile.
    • Set USE_TRACY=1 in config.sh so TRACY_ENABLE is defined project-wide.
    • Add ZoneScoped at the start of functions to profile.
    • Run ./thirdparty/tracy/tracy-profiler, connect, then run your app.
    • Use the Tracy UI statistics view for results.

    Credits


    License

    slamplay is released under GPLv3. Modified third-party libraries retain their own licenses; where none is stated, GPLv3 applies.