/kitware_slam

Primary LanguageC++Apache License 2.0Apache-2.0

SLAM in LidarView

SLAM in ROS

LiDAR SLAM

Introduction and contents

This repo contains LiDAR-only visual SLAM developped by Kitware, as well as ROS and ParaView wrappings for easier use.

It has been successfully tested on data from several common LiDAR sensors:

  • Velodyne (VLP-16, VLP-32c, HDL-32, HDL-64, VLS-128)
  • Ouster (OS0/1/2-32/64/128)
  • RoboSense (RS-LiDAR-16 RS-LiDAR-32)
  • Hesai (PandarXT16, PandarXT32, Pandar128)

Have a look at our SLAM demo video!

This codebase is under active development. If you're interested by new features, new sensors' support or any project that could be using this SLAM, do not hesitate to contact us at kitware@kitware.com.

Repo contents :

  • slam_lib/ : core LidarSlam library containing SLAM algorithm and other utilities.
  • Superbuild/ : Dependencies installer.
  • ros_wrapping/ : ROS packages to enable SLAM use on a ROS system.
  • paraview_wrapping/ : ParaView plugin to enable SLAM use with ParaView/LidarView.
  • ci/ : continuous integration files to automatically build and check LidarSlam lib.
  • CMakeLists.txt : CMakeLists used to call to build core LidarSlam lib and paraview_wrapping.

Core SLAM lib

Dependencies

Dependencies are listed in the table below along with the version used during development and testing. Minimum required versions have not been determined yet.

Dependency Minimum tested Version
Eigen3 3.3.4
Ceres 1.13.0
PCL 1.8
nanoflann 1.3.0
g2o* 1.0.0 (master)
OpenMP* 2.0
OpenCV* 4.2

(*) optional dependencies :

  • If G2O is not available (or disabled), LidarSlam lib will still be compiled, but without pose graph optimization features.
  • If OpenMP is available, it is possible to use multi-threading to run some SLAM steps in parallel and achieve higher processing speed.
  • If OpenCV is not available (or disabled), LidarSlam lib will still be compiled, but without camera integration.

/!\ Warning Make sure to compile/install G2O with the same Ceres version as the one used in the SLAM compilation. To do so, disable the feature G2O_USE_VENDORED_CERES during G2O compilation and link against the right version of Ceres.

Installation

The LidarSlam lib has been tested on Linux, Windows and OS X.

First, got to your workspace directory and clone the SLAM repository.

git clone https://gitlab.kitware.com/keu-computervision/slam.git src

With system dependencies

To build only LidarSlam lib using your system dependencies, run :

mkdir build
cd build
cmake ../src -DCMAKE_BUILD_TYPE=Release
cmake --build . -j

With local dependencies

You can link to the local libraries you have installed adding cmake flags. Notably with Ceres and G2O:

cmake ../src -DCMAKE_BUILD_TYPE=Release -DCeres_DIR=path/to/CeresConfig.cmake -Dg2o_DIR=path/to/g2oConfig.cmake

With Superbuild

  1. Install the superbuild:

In your workspace, run :

mkdir SB-build
cd SB-build
cmake ../src/Superbuild -DCMAKE_BUILD_TYPE=Release
cmake --build . -j

WARNING: Boost is required to compile the superbuild.

NOTE: you can decide which dependencies to build with the superbuild using the options WITH_XX. For example, to not compile PCL :

cmake ../src/Superbuild -DWITH_PCL=OFF -DCMAKE_BUILD_TYPE=Release
  1. Build the slam library linking to the superbuild dependencies

In your workspace, run :

mkdir build
cd build
cmake ../src -DSUPERBUILD_INSTALL_DIR=absolute/path/to/workspace/SB-build/install -DCMAKE_BUILD_TYPE=Release
cmake --build . -j

ROS wrapping

The ROS wrapping has been tested on Linux only.

Dependencies

Ensure all LidarSlam dependencies are respected. Specific ROS packages dependencies are listed in the table below along with the version used during development and testing.

Dependency Tested Versions Install (sudo apt-get install <pkg>)
ROS melodic, noetic ros-melodic-desktop-full and tutorial
gps_common 0.3.0 ros-$ROS_DISTRO-gps-common
geodesy 0.5.3 ros-$ROS_DISTRO-geodesy

For Velodyne usage, please note that the ROS Velodyne driver with minimum version 1.6 is needed. Be careful, this ROS Velodyne driver 1.6 is not backward-compatible with previous versions. If you're running on Ubuntu 20 / ROS Noetic, you can install the new Velodyne driver using the command sudo apt install ros-noetic-velodyne ros-noetic-velodyne-pcl. If running on previous versions of Ubuntu/ROS (18/Melodic and below), you need to compile this driver from source : just clone the git repo in your catkin worskpace sources, it will be automatically built with next catkin_make or catkin build.

For Ouster usage, the driver can be found in this git repo

Installation

Clone this git repo directly into your catkin directory, and run catkin_make -DCMAKE_BUILD_TYPE=RelWithDebInfo or catkin_make -DCMAKE_BUILD_TYPE=Release (to turn on optimizations, highly recommended when using Eigen). The same can be done with catkin build. It will automatically build LidarSlam lib before ROS packages.

NOTE : The superbuild can also be used here setting the SUPERBUILD_INSTALL_DIR variable.

WARNING : Be sure to use the same PCL library dependency for ROS basic tools and slam library to avoid compilation errors and/or segfaults.

Live usage

For Velodyne :

roslaunch lidar_slam slam_velodyne.launch use_sim_time:=false
roslaunch lidar_slam slam_velodyne.launch use_sim_time:=false gps:=true   # if GPS/SLAM calibration has to be run

For Ouster :

roslaunch lidar_slam slam_ouster.launch replay:=false
roslaunch lidar_slam slam_ouster.launch replay:=false gps:=true   # if GPS/SLAM calibration has to be run

See ros_wrapping/lidar_slam/README.md for more details.

ParaView wrapping

The LidarSlamPlugin Paraview wrapping has been tested on Linux, Windows and OS X.

Dependencies

Ensure all LidarSlam dependencies are respected. Specific dependencies are listed in the table below along with the version used during development and testing.

Dependency Tested Version
ParaView 5.4, 5.6 and 5.9

Be careful to use and link to the same libraries as ParaView/LidarView's (especially with VTK, Eigen, PCL, Ceres, nanoflann, etc.). Otherwise, if different flags or modules were enabled, some troubles may arise at build time, or it could lead to version mismatch and segfault at runtime.

For example, if PCL is built with pcl_visualization module, it must link to the same VTK than the one used by ParaView.

Installation

To build LidarSlam lib and this ParaView plugin LidarSlamPlugin, just cd to this repo root dir and run :

mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DSLAM_PARAVIEW_PLUGIN:BOOL=ON
cmake --build . -j

Set XX_DIR variables to the same path dependencies of ParaView/LidarView when they exist (Eigen, Ceres, nanoflann, etc...).

Usage

  • Open ParaView
  • Tools tab > Manage Plugins > Load New
  • Browse to the <install>/lib/ dir and select libLidarSlamPlugin.so or LidarSlamPlugin.dll
  • Load LiDAR frames and LiDAR calibration to use
  • Select the frames in the Pipeline Browser, instantiate a SLAM filter, and apply it.

Currently, all features are not available in ParaView plugin. Features such as GPS/LiDAR calibration, pose graph optimization or temporal logging are only supported in ROS wrapping. However, ParaView plugin is useful to play with SLAM, interactively try out parameters, visualize and export results.

Use SLAM in LidarView

This LidarSlamPlugin is natively included in LidarView. For more detailed information on how to enable and use SLAM filter in LidarView, see paraview_wrapping/Plugin/doc/How_to_SLAM_with_LidarView.md.

Pre-built binaries of LidarView with this SLAM plugin are available for download here.