This code is a fork from LeGO-LOAM-SR to migrate LeGO-LOAM algorithm to ROS2 Humble. Some syntax difference for ROS Humble is modified.
This code does not modify and/or improve the original LeGO-LOAM algorithm.
LeGO-LOAM contains code for a lightweight and ground optimized lidar odometry and mapping (LeGO-LOAM) system for ROS compatible UGVs. The system takes in point cloud from a Velodyne VLP-16 Lidar (palced horizontal) and it outputs 6D pose estimation in real-time. A demonstration of the system can be found here -> https://www.youtube.com/watch?v=O3tz_ftHV48
- ROS2 (tested with humble)
- gtsam (Georgia Tech Smoothing and Mapping library)
git clone https://github.com/borglab/gtsam cd gtsam && git checkout 4.2a9 mkdir build && cd build # For Ubuntu 22.04, add -DGTSAM_USE_SYSTEM_EIGEN=ON cmake .. -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF \ -DGTSAM_BUILD_TESTS=OFF \ -DGTSAM_WITH_TBB=OFF \ -DGTSAM_BUILD_WITH_MARCH_NATIVE=OFF make -j$(nproc) sudo make install
You can use the following commands to download and compile the package.
cd ~/dev_ws/src
git clone https://github.com/theinge9/LeGO-LOAM-SR.git
cd ..
colcon build
LeGO-LOAM is speficifally optimized for a horizontally placed lidar on a ground vehicle. It assumes there is always a ground plane in the scan.
The package performs segmentation before feature extraction.
Lidar odometry performs two-step Levenberg Marquardt optimization to get 6D transformation.
To customize the behavior of the algorithm or to use a lidar different from VLP-16, edit the file config/loam_config.yaml.
One important thing to keep in mind is that our current implementation for range image projection is only suitable for sensors that have evenly distributed channels. If you want to use our algorithm with Velodyne VLP-32c or HDL-64e, you need to write your own implementation for such projection.
If the point cloud is not projected properly, you will lose many points and performance.
The IMU has been remove from the original LeGO-LOAM code.
System can be started using the following command:
ros2 launch lego_loam_sr run.launch.py
Some sample bags can be downloaded from here.
To use rosbags from ROS1, you need to use a bridge between ROS1 and ROS2.
Play rosbag using ROS1:
source /opt/ros/melodic/setup.bash
roscore &
rosbag play *.bag --clock --topic /velodyne_points
Create the bridge in another terminal:
source /opt/ros/melodic/setup.bash
source /opt/ros/dashing/setup.bash
export ROS_MASTER_URI=http://localhost:11311
ros2 run ros1_bridge dynamic_bridge
Finally, run ROS2 code:
source /opt/ros/dashing/setup.bash
source ~/dev_ws/install/setup.bash
ros2 launch lego_loam_sr run.launch.py
This dataset, Stevens data-set, is captured using a Velodyne VLP-16, which is mounted on an UGV - Clearpath Jackal, on Stevens Institute of Technology campus. The VLP-16 rotation rate is set to 10Hz. This data-set features over 20K scans and many loop-closures.
Thank you for citing our LeGO-LOAM paper if you use any of this code:
@inproceedings{legoloam2018,
title={LeGO-LOAM: Lightweight and Ground-Optimized Lidar Odometry and Mapping on Variable Terrain},
author={Tixiao Shan and Brendan Englot},
booktitle={IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS)},
pages={4758-4765},
year={2018},
organization={IEEE}
}