This is a framework of lidar mapping and localization with strong extensibility. Mapping and matching are separate parts of the framework. Mapping contains data pretreat, front end, back end, loop closing and viewer. Matching contains data pretreat and map matching. The characteristic of this framework is that most of it's modules can be replaced very easily with the help of polymorphism in c++. For example, you can replace ndt with icp in the front end, or replace g2o with gtsam in the back end without change code in the flow. Therefor, it is a good framework for research.
Modifier: Qian Ren
Ubuntu 64-bit 16.04. ROS Kinetic.
sudo apt-get install ros-kinetic-desktop-full
To avoid version problems, we provide the setup file of g2o in the setup_file directory. Install it follow the readme in G2O Installation
sudo apt-get install libpcl-all
sudo pip install -U numpy
sudo pip install kitti2bag
Clone the repository and catkin_make:
cd ~/catkin_ws/src
git clone https://github.com/Little-Potato-1990/lidar_localization
cd ../
catkin_make
source ~/catkin_ws/devel/setup.bash
Download KITTI raw_data dataset to DATASET_PATH.
For example “2011_10_03_drive_0027_sync.zip” and “2011_10_03_calib.zip”(the calibration file is necessary), unzip the files and put them according to this
then run
cd DATASET_PATH
kitti2bag -t 2011_10_03 -r 0027 raw_synced
then we will get kitti_2011_10_03_drive_0027_synced.bag in the directory.
run
roslaunch lidar_localization mapping.launch
rosbag play kitti_2011_10_03_drive_0027_synced.bag
then mapping begin
when the saw mapping is over in rviz, run
rosservice call /optimize_map
then the full cloud map will display in rviz.
to save map to pcd file, run
rosservice call /save_map
then "map.pcd" and "filtered_map.pcd" will be saved in the directory "lidar_localization/slam_data/map"
input the path of "filtered_map.pcd" in "config/matching/matching.yaml" with the param "map_path",run
roslaunch lidar_localization matching.launch
rosbag play kitti_2011_10_03_drive_0027_synced.bag
the modules of the mapping part is separate, we can replace anyone of them. For example, the front end module can be replaced with A-LOAM, when you have compile the project of A-LOAM, you can run
roslaunch lidar_localization mapping_with_aloam.launch
in this project. Further more, you can replace it with any other lidar odom.
the pointcloud registration is NDT in the frong end, if you want use ICP, you can add another child class of the virtual base class named "PointCloudInterface". Follow this method, you can add many other algorithms in the directory "lidar_localization/models".