/Livox-Mapping

An all-in-one and ready-to-use LiDAR-inertial odometry system for Livox LiDAR

Primary LanguageC++BSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Livox-Mapping

This repository implements an all-in-one and ready-to-use LiDAR-inertial odometry system for Livox LiDAR. The system is developed based on the open-source odometry framework LIO-Livox to get the odometry information in our front-end part. Besides, we have added more constraints and features to enhance the mapping performance.

At the same time, we provide you one simple lidar-map based localization module in Livox-Localization.

Livox_Mapping

1. Features

We only describe the new features added to our baseline framework LIO-Livox. For the amazing features developed by LIO-Livox, please check their own repository.

1.1 Loop Closure Detection

In the LCD part, we use the ScanContext to perform the loop closure detection and then add the loop closure constrains to the optimization solver. With the LCD module, we are able to close the gap and compensate the accumulated translation error of the scan matching in large environments.

with Loop Closure without Loop Closure
with_sc without_sc

1.2 Ground Constrain

To avoid the drifting alongside the Z-axis, the general problem occurred in LOAM (LiDAR Odometry and Mapping) algorithms, we add the the ground constraints ( the plane detection is done by LIO-Livox) to the optimization solver as hdl_graph_slam.

with Ground Constrain without Ground Constrain
with_ground wo_ground

1.3 Map Merging from Multiple Rosbags

In practice, we usually collect environment data in multiple times, thus we need one functionality to fuse the map information from multiple rosbags. In this implementation, we use GPS information (optionally) to convert LiDAR scans collected in different time into one coordinate system and then use ScanContext and ICP to find fine matching result. At the same time, we maintain one lifelong optimization vector in our backend to store the previous key-frames. Through this approach, we are able to connect scans in different collections.

bags

1.4 GPS Factor

We also offer the GPS factor to aid the mapping process. This is only one optional choice. Without the GPS information, the whole system could also work.

1.5 Compatible with Mapping Editor interactive_slam

interactive_slam is an open-source 3D LiDAR-based mapping framework. We add one functionality to output the mapping result in the format compatible with interactive_slam, by this, you can easily edit your mapping result and get one more accurate LiDAR map. At the same time, if you have one camera alongside the Livox, we also offer one dummy moving objects removal function with aid of mmdection and easy LiDAR points projection.

Represented in interactive_slam Moving Object Removal
interact_slam image-20211223215338497

2. Prerequisites

2.1 Dependencies for baseline

Our framework is developed based on the open-source framework LIO-Livox for odometry part, ScanContext for loop closure part and interactive_slam for map-editing part (if you need), so technically, please refer to these repos for detailed information.

2.2 General Dependencies

2.3 Docker

For one quick and convenient test, we are offering you a Docker Image with DockerHub.

Please check the DockerHub Link for more information.

  • Pull the docker image.
docker pull siyuanhuang95/livox_slam:release
  • Execute the docker run command. You can use -v to bind the docker to your local machine as you wish.
docker run --gpus all -it -p 3316:22 --device=/dev/dri --group-add video --volume=/tmp/.X11-unix:/tmp/.X11-unix  --env="DISPLAY=$DISPLAY" siyuanhuang95/livox_slam:release /bin/bash
  • To allow the RVIZ in Docker to run in the host PC. In the local mashine:
xhost +

3. Build

  • Clone the repository and catkin_make
cd ~/catkin_ws/src
git clone https://github.com/PJLab-ADG/Livox-Mapping.git
cd ..
catkin_make
  • Remember to source the livox_ros_driver before build (follow livox_ros_driver)

4. Run

4.1 Dataset Requirements

Before running the mapping functionality, please make sure the sensor data are published to the correct rostopic.

  • Livox LiDAR: /livox/lidar
  • IMU: /livox/imu
  • GPS: /localization/navstate_info

4.2 Run Mapping Function

  • In one terminal, launch the mapping thread
# If you don't have the GPS data
cd ~/catkin_ws
source devel/setup.bash
roslaunch livox_mapping livox_mapping.launch save_path:="PATH_TO_SAVE_SLAM_POSE_RESULT"
# If you have the GPS data
cd ~/catkin_ws
source devel/setup.bash
roslaunch livox_mapping livox_mapping.launch useRTK:="true" save_path:="PATH_TO_SAVE_SLAM_POSE_RESULT"
  • In another terminal, launch the odometry thread
cd ~/catkin_ws
source devel/setup.bash
roslaunch livox_odometry livox_odometry.launch save_path:="PATH_TO_SAVE_ODOM_RESULT_in_txt"
  • In another terminal, play the rosbag
rosbag play YOUR_ROSBAG.bag

4.3 Multiple Bags Merge

If you have more rosbags collected in one same area, you can restart odometry thread at the end of the first odometry thread run and play the next package.

  • In the terminal for odometry thread, use Ctrl+C to shut down the old odometry thread.
  • In the terminal for odometry thread, use the command below to start one new odometry thread
roslaunch livox_odometry livox_odometry.launch save_path:="PATH_TO_SAVE_ODOM_RESULT_in_txt"
  • Play one new rosbag.

5. Datasets

For the ease of usage, we are providing several test rosbags collected in one industrial park located in Shanghai. Please be aware that all codes and datasets included in this repository are for academic research purposes only. Other usages are NOT encouraged, and it is at your own risk. If You have any concerns including privacy, please contact us by sending an e-mail to huangsiyuan@pjlab.org.cn

The dataset can be downloaded through the Baidu Netdisk with:

Link:https://pan.baidu.com/s/17ElBOWiFVr68975FtXY8ZA 
Password:pjop

6. Acknowledgments

Thanks for the authors of LIO-Livox, ScanContextFast-LIO-SLAM and interactive_slam.

Contact