Today I started writing a series of articles about google cartographer. There are many such articles on the Internet. This series of articles mainly records the key parts and places that are easy to step on.
cartographer is a complete laser SLAM open source project, which belongs to graph slam, which includes a complete front-end odometer and back-end map optimization. It can not only locate and build maps at the same time, but also perform independent global positioning based on prior maps.
It is worth studying and learning: (1) A beautiful slam implementation project, learning its module architecture, code architecture, interfaces, etc. (2) Learning google code style, as a template for C++ programming specifications
table of Contents
1. It is recommended to look at the official website information, which is already very detailed
2. Global positioning based on a priori map
1. It is recommended to look at the official website information, which is already very detailed
Native version:
https://google-cartographer.readthedocs.io/en/latest/
ros integrated version:
https://google-cartographer-ros.readthedocs.io/en/latest/index.html
Source code:
https://github.com/cartographer-project/cartographer_ros
paper:
W. Hess, D. Kohler, H. Rapp, and D. Andor, Real-Time Loop Closure in 2D LIDAR SLAM, in Robotics and Automation (ICRA), 2016 IEEE International Conference on. IEEE, 2016. pp. 1271–1278.
Two, installation
My environment: ubuntu 18.04 (64 bits), ROS melodic
Compile and install with source code.
Step 1: Install dependencies. Refer to https://google-cartographer.readthedocs.io/en/latest/ to install some dependencies first
My computer only installs the following partial dependencies, and the rest are not installed (maybe the corresponding dependencies have been installed during the previous configuration)
Step 2: Continue to install dependencies. Refer to https://google-cartographer-ros.readthedocs.io/en/latest/index.html to install other dependencies
Step 3: Attention! Create a ROS project directory and download the source code. When proceeding to the step of downloading the source code, you need to log in to your github account on the web page, otherwise it will prompt that the URL cannot be connected!
wstool merge -t src https://raw.githubusercontent.com/cartographer-project/cartographer_ros/master/cartographer_ros.rosinstall
Step 4: Source code compilation.
After executing catkin_make_isolated --install --use-ninja, the installation is successful.
Step 5: Attention! Configure the source. Since it is compiled in the isolated way, so source in this way in ~/.bashrc, add the phrase source /home/your ubuntu username/cartographer/ devel_isolated /setup.bash
At this point, the source code installation is completed, and you can download the official website data set and run it below.
Three, source file structure
The source code result after installation is as follows: includes native code and ros integration part
Fourth, run the data set
1. Map building
Refer to https://google-cartographer-ros.readthedocs.io/en/latest/demos.html to download the 2d backpack data set (490M, download very fast)
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag
roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=${HOME}/Downloads/cartographer_paper_deutsches_museum.bag
The data set lasts about 30 minutes. The map built is large enough, and the effect is as follows, which is quite amazing. (0,9) Similar data indicates loop closure
Mapping based on 3D lidar: 3D point cloud is projected to 2D occupancy grid map
The data set has 9.8G
wget -P ~/Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/with_intensities/b3-2016-04-05-14-14-00.bag
roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=${HOME}/Downloads/b3-2016-04-05-14-14-00.bag
Two vlp-16s are used, horizontal and vertical
From the side view, you can see that the constructed map is not on the same level
2. Global positioning based on a priori map
Refer to https://google-cartographer-ros.readthedocs.io/en/latest/demos.html , the following is the positioning based on 2D data set
Step 1: Build a priori map first, the size is about 100m*100m
Step 2: Global real-time positioning based on a priori map
There is no match at the initial moment, and it will match after a few seconds. The position and trajectory have been corrected.
Matching errors occurred during exercise, but can be corrected quickly