Skip to content

Telios/3dslam_comparison

Repository files navigation

3D SLAM comparison between different solutions

Introduction

This repository contains different 3D SLAM solutions. The goal of this project was to compare different solutions with each other and find the best front-end LiDAR odometry system to use with LAMP, a multi-robot back-end SLAM system with pose graph optimization developed by the NeBula team.

The following front-end LiDAR odometry systems solutions were tested:

Installation

This project was only tested with Ubuntu 18.04 and ROS Melodic. No guarantee it works for other versions.

Pull the repository with all it's submodules:

git clone --recurse-submodules https://github.com/Telios/3dslam_comparison.git

Install ROS melodic

Cmake version used: 3.27.7 See instructions for installation on Ubuntu 18.04 (Dont do step 2 !!)

Extra installation steps for some submodules

FASTER-LIO

See details at original repository.

Install the following libraries (could be that they are already installed, but just to be sure):

sudo apt install libpcl-dev libgoogle-glog-dev libeigen3-dev libpcl-dev libyaml-cpp-dev python-catkin-tools python-pip

Upgrade your g++ and gcc compilers to 9.0:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-9 g++-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 9
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 9

Test if the correct version is installed:

gcc --version
g++ --version

See here for more details about update-alternatives.

Problems with Ubuntu 18.04: Tbb library outdated, proposed solution on github repo does not work (atleast for me). Thus download the newer version of libtbb with:

  1. Add the Ubuntu repository that contains the latest version 2019~U8-1, run the following command in terminal:
echo "deb http://old-releases.ubuntu.com/ubuntu eoan main universe" | sudo tee -a /etc/apt/sources.list""
  1. Update the repositories:
sudo apt update
  1. Install the latest version of libtbb:
sudo apt install libtbb-dev

I recommend removing the added repository afterwards:

sudo sed -i '/old-releases/d' /etc/apt/sources.list

For more information about the tbb installation see here.

DLO and DLIO

See deatils at DLO original repository and DLIO original repository

Install the following libraries (could be that they are already installed, but just to be sure):

sudo apt install libomp-dev libpcl-dev libeigen3-dev python3-catkin-tools

LAMP

See deatils at original repository.

In the root folder of the repository run:

cd LAMP/src/LAMP

Install the following pip packages in this order:

python -m pip install pytest-runner future
python -m pip install torch==1.4.0
python -m pip install -r requirements.txt

Datasets

To compare the different algorithms a dataset is needed. We recorded different rosbags with an Ouster OS-128 and a Velodyne VLP-16 LiDAR. The rosbags can be downloaded from this link The datasets contain either simple loops on one floor or a multi-story building. We used the quadruped Spot from Boston Dynamics to record the data.

Make a directory in the root folder to install the datasets:

mkdir rosbags

Then copy the downloaded rosbags into the rosbags folder.

Usage

For easy building and running the system we use tmux and tmuxp. Install them with:

sudo apt install tmux tmuxp

In the folder tmuxp_configs/ you can see the different configurations for the different algorithms. To run the system with a specific configuration run:

tmuxp load tmuxp_configs/<config_name>.yml

This will open a new tmux session with all the terminals needed to run the system. I recommend to use an alias to stop all the processes and close the tmux session. Add the following line to your .bashrc file:

alias kt='tmux kill-session'

Then you can stop the system by typing kt in the terminal. Don't forget to source ~/.bashrc after editing it. Alternatively you can also reopen the terminal.

Building the system

The git submodules locus_ws contains two different branches. The master branch contains code used for datasets that are marked with velodyne. The ouster branch is used for datasets marked with ouster. To switch between the branches run:

cd locus_ws && git checkout <branch_name>

You'll have to rebuild the system after switching branches.

To build the system run the following command in the 3dslam_comparison folder:

tmuxp load tmuxp_configs/build_all.yml

This should open a new tmux session with all the terminals needed to build the system. This could take a while.

Running the system

Before running the system make sure you have a results folder with in the root directory with the following structure:

results
├── pointclouds
├── profiler_results

Every configuration records the CPU and RAM utilization of the system. The results are stored in the profiler_results folder. The pointclouds are stored in the pointclouds folder.

To run a specific algorithm run the following command in the 3dslam_comparison folder:

tmuxp load tmuxp_configs/<config_name>.yml

This should open a new tmux session with all the terminals needed to run the system. There are different environment variables in the yaml files that can be set to change the behaviour of the system. The following variables are available, depending on the config file:

  • ROBOT_NAMESPACE: The namespace of the robot.
  • BASE_NAMESPACE: the namespace of the base station for LAMP.
  • ROSBAG: The name of the rosbag to use.
  • ROSBAG_FOLDER: The folder where the rosbags are stored.
  • POINTCLOUD_TOPIC: The topic of the pointclouds in the rosbag.
  • IMU_TOPIC: The topic of the IMU in the rosbag.
  • RVIZ_FILE: The name of the rviz file to use.
  • RESULTS_FOLDER: The folder where the results are stored.
  • ODOMETRY_TOPIC: The topic of the odometry messages (used for LAMP).
  • BAG_DURATION: The duration of the rosbag in seconds.

Visualizing the results

Profiler

After you have run the system you can visualize the profiling results with the following command from the root directory:

cd results/profiler_results && python ../../scripts/plotter.py

This script will plot and save the CPU and RAM utilization of the system. The plots are stored in the results/profiler_results folder.

Pointclouds

To visualize the pointclouds you can use the pcd_viewer from the PCL library. Install it with:

sudo apt install pcl-tools

Then you can visualize the pointclouds with:

pcl_viewer results/pointclouds/<pointcloud_name>.pcd

Alternatively and more convenient you can use the software CompareCloud

Results

Profiler results

The CPU load and RAM allocation were measured with the python tool psutil. The following images show the CPU load and RAM utilization of the different algorithms. Both are shown with boxplots provided by matplotlib. CPU load RAM utilization

Front-End LiDAR odometry

CPU load front end RAM utilization front end

Pointclouds

To evaluate the different algorithms we used the software CloudCompare. First a ground truth pointcloud was generated with the Riegl Laser Scanner VZ-400i

Riegl Scanner VZ-400i The Riegl Laser Scanner VZ-400i. Riegl pointlcoud registration Registration of the scans.

Each pointcloud generated by the different algorithms were filtered through a statistical outlier removal filter with a mean of 6 and a standard deviation of 1.0.

Then the ground truth pointcloud was registered with the filtered pointcloud. The registration was done with the Iterative Closest Point (ICP) algorithm provided by CloudCompare. After that the C2C (cloud to cloud) distance was computed. For each point in the ground truth pointcloud the closest point in the filtered pointcloud was searched. Thus each point gets a distance value. Depening on the distance value the point is colored. The color scale is shown in the following image: CloudCompare results

This image show the results of the g4_ouster.bag. Spot was going from the ground floor to the 4th floor and took one loop on the 4th floor. Points with distances >2 were discarded to better show the color scale.

C2C distances

Conclusion

The goal of this project was to find out what combination of front-end LiDAR odometry algorithms and LAMP will best fit with our robotics system (Spot). The PGO (pose graph optimization) of LAMP is in most cases beneficial for the overall map quality. However the computational overhead of the PGO is quite high. Thus the back-end will have to run on a different system which is connected to Spot. Only the front-end LiDAR odometry system will run on Spot.

Considering the profiling and C2C distances results, DLO and FAST-LIO are the best candidates for the front-end LiDAR odometry system. Both algorithms have a low computational overhead and produce good results. The C2C distances are quite low and the pointclouds are well aligned. Even though DLIO was performing quite well in the C2C distances, the RAM allocation was quite high. Furthermore it was not possible to pair DLIO with LAMP. Future work could be to investigate why DLIO is not working with LAMP and perhaps try to find a way to pair them.

DLO

DLO running on the g4_ouster.bag dataset.

FAST-LIO

FAST-LIO running on the g4_ouster.bag dataset.

About

Comparison of various 3D SLAM algorithms for Spot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages