xiaoqiang tutorial (16) large-scale lidar slam and real-time loop closure test
Large-scale lidar slam and real-time loop closure test
With Google's Cartographer and slamtec's lidar, we can try to create a floor plan for a large building. Take a look at our demo and click to watch the video.
In this demo, Xiaoqiang actually operates in a 5,000-square-meter office building corridor. There are a large number of glass walls on both sides of the corridor. There is a large area of open space in the center of the building. With rplidar's range of only 6 meters, so the following figure The final result is still relatively good (only use lidar, IMU and odometer are not turned on, the large loop path is still closed successfully)
The idea of this article: Because it is a large-scale mapping, wifi network coverage is a problem, so we use the Bluetooth joystick to remotely control the robot movement. During the remote control, the lidar data was recorded through the rosbag. The joystick controlled robot ran a circle within the area and finally play the bag for map creation.
Note: All the following operations are completed on Xiaoqiang host ubuntu
Preparation:
1.Installing rplidar driver
If you are using xiaoqiang system image, then the driver was already installed, you can skip this step.
For the instructions to install rplidar driver, please refer to this post
2.Install PS3 handle driver
If you are using xiaoqiang system image, then the driver was already installed, you can skip this step.
For the instructions to install joystick driver, please refer to this post
3.Install cartographer_ros
Please refer to this installation tutorial
Steps:
1.Open a new window to start rplidar
roslaunch rplidar_ros rplidar.launch
2.Open two windows to start PS3 controller remote control program, press the handle connection key to connect the platform.
First window
sudo bash
rosrun ps3joy ps3joyfake_node.py
The second window
roslaunch turtlebot_teleop ps3fakexiaoqiang_teleop.launch
3.Opens a new window to start the rosbag recording process and starts recording lidar data/scan
rosbag record /scan
4.Use the handle to remotely control the movement of the platform, circle around the building area, and it can also be used for multiple rotations.
5.Bag recording is complete, close the above 1,2,3 window
The newly recorded point bag file is in the home directory of Xiaoqiang, rename it to 1.bag
6.Start platformtographer_ros start bag playback build
roslaunch platformtographer_ros demo_xiaoqiang_rplidar_2d.launch bag_filename:=/home/xiaoqiang/1.bag
7.If everything is normal, you can now see a similar effect in the picture below, waiting for the bag to be played.
8.Save the map, this article ends
rosservice call /finish_trajectory "stem: 'rplidar_test'"