zm0612 / funny_lidar_slam

A real-time multifunctional Lidar SLAM package.
BSD 3-Clause "New" or "Revised" License
100 stars 14 forks source link

Funny-Lidar-SLAM

a

Demo video: bilibili

1.Introduction

A real-time multifunctional Lidar SLAM package. It has dual functions of Mapping and Localization. Supports multiple types of IMUs(6-axis and 9-axis) and Lidars(Velodyne, Livox Avia, Livox Mid 360, RoboSense, Ouster, etc). Supports various types of frontends, such as LOAM, NDT, ICP, etc. Supports multiple fusion methods, such as Kalman filter, optimization method, etc. Support multiple LoopClosure methods. The overall accuracy and efficiency are close to the current state-of-the-art methods.

Features Details
IMU Types 6-axis, 9-axis.
Lidar Types Solid State Lidar(Mid-360, Avia, etc),
Mechanical Lidar(Velodyne, Robosense, Ouster, etc),
etc.
Registration Methods Loam Series,
Optimized-ICP,
Incremental-NDT,
even customizable via plug-in.
LoopClosure Methods
(only Mapping mode)
Euclidean distance based,
Feature based.
Fusion Methods Loose Coupling,
Kalman Filter,
Optimization.

2.Prerequisites

2.1 Ubuntu and ROS

Ubuntu >= 20.04 && ROS Noetic && C++17 Compiler

For Ubuntu 20.04 or higher. After installing ROS, most of the dependent libraries have been installed, including the PCL/Eigen/CMake/etc.

2.2 glog && gflag && gtest

sudo apt-get install libgoogle-glog-dev libgflags-dev libgtest-dev

2.3 g2o

sudo apt install libeigen3-dev libspdlog-dev libsuitesparse-dev qtdeclarative5-dev qt5-qmake libqglviewer-dev-qt5 # g2o requirements

git clone https://github.com/RainerKuemmerle/g2o.git
cd g2o
mkdir build
cd build
cmake ..
make -j
sudo make install

3.How to Build?

3.1 Build from source (Recommend)

mkdir -p funny_lidar_slam_ws/src
cd funny_lidar_slam_ws/src
git clone https://github.com/zm0612/funny_lidar_slam.git
cd ../
catkin_make -j
source devel/setup.bash

3.2 Build in Docker

If you want to use docker conatiner to run Funny Lidar SLAM, please install the docker on you machine. Follow Docker Installation.

3.2.1 Download project code to any path

git clone https://github.com/zm0612/funny_lidar_slam.git

3.2.2 Build Docker image and create the container

cd funny_lidar_slam
docker build -f Dockerfile -t funny_lidar_slam:v0 .
cd docker
sudo chmod +x run.sh
bash run.sh

Tips:

4.How to run Mapping?

Funny-Lidar-SLAM is a multi-functional Lidar SLAM package. You can freely choose the Lidar model, 6-axis or 9-axis IMU , and registration method. To help you get started quickly, here I provide some of my examples on some open source datasets. Of course you can also try other combinations.

4.1 For Velodyne HDL-32E

cd funny_lidar_slam_ws
source devel/setup.bash
roslaunch funny_lidar_slam mapping_M2DGR.launch

rosbag play street_02.bag # Play one of the sets of data
cd funny_lidar_slam_ws
source devel/setup.bash
roslaunch funny_lidar_slam mapping_nclt.launch

rosbag play 20130110.bag # Play one of the sets of data

4.2 For Velodyne HDL-16E

The test dataset comes from: LIO-SAM dataset. You can also get part of the dataset from Baidu Pan for testing.

cd funny_lidar_slam_ws
source devel/setup.bash
roslaunch funny_lidar_slam mapping_lio_sam.launch

rosbag play walking_dataset.bag # Play one of the sets of data

4.3 For Livox Mid-360

You can download the Livox Mid-360 data from: Baidu Pan

cd funny_lidar_slam_ws
source devel/setup.bash
roslaunch funny_lidar_slam mapping_mid360.launch

rosbag play mid_360.bag # Play one of the sets of data

Note: If your Mid-360 format is livox_ros_driver2/CustomMsg, you can use 4.4 For Livox Avia to run.

4.4 For Livox Avia

You can download the Livox Avia data from: Baidu Pan.

cd funny_lidar_slam_ws
source devel/setup.bash
roslaunch funny_lidar_slam mapping_livox_avia.launch

rosbag play avia.bag  # Play one of the sets of data

Note: If your Livox Avia format is sensor_msgs/PointCloud2, you can use 4.3 For Livox Mid-360 to run.

4.5 For custom Lidar model (Only supports rotating mechanical Lidar)

You can download the data from: Baidu Pan

cd funny_lidar_slam_ws
source devel/setup.bash
roslaunch funny_lidar_slam mapping_turing.launch

rosbag play our.bag # Play one of the sets of data

4.6 Save PointCloud Map

cd funny_lidar_slam_ws
source devel/setup.bash
rosservice call /funny_lidar_slam/save_map "map_path: '' split_map: false"

Note: map_path: is the path where the map is stored. If map_path is empty, the default path funny_lidar_slam/data is used for saving. If you want to save the map to a specific path, set map_path. For example: "map_path: '/home/xx/xxx.pcd'" split_map: Whether to divide the map into blocks.

5.How to run Localization?

5.1 Prepare pointcloud map

Copy your pointcloud map to the funny_lidar_slam/data directory and change its name to map.pcd. If you don’t have a pointcloud map, you can generate one according to Section 4.

5.2 Run Localization

roslaunch funny_lidar_slam localization_mid_360.launch
roslaunch funny_lidar_slam localization_nclt.launch
roslaunch funny_lidar_slam localization_turing.launch

Note: Other Lidar models can be configured by referring to the above examples.

5.3 Set the initial pose

After running the Localization program, you need to play the bag and set the initial pose.

The localization program does not have a global relocalization function, so the initial position and orientation need to be set manually. For convenience, I use the 2D Pose Estimate plugin in RVIZ to set the initial pose. If the initial pose effect is not good, you can try to use 2D Pose Estimate multiple times to set the pose.

6.Some Tips