6. cartographer building algorithm6.1. Introduction6.2 Usage6.2.1 Pre-use Configuration6.2.2 Specific use6.3. Node resolution6.3.1. Displaying a computational graph6.3.2. cartographer_node node details6.3.3 TF transformations
Cartographer:https://google-cartographer.readthedocs.io/en/latest/
Cartographer ROS2:https://github.com/ros2/cartographer_ros
The operating environment and hardware and software reference configuration are as follows:
Cartographer is a Google open source ROS system support for 2D and 3D SLAM (simultaneous localization and mapping) library . Based on the graph optimization (multi-threaded back-end optimization , cere constructed problem optimization) approach to building mapping algorithms . Data from multiple sensors (e.g., LIDAR, IMU, and camera) can be combined to synchronously compute the sensor's location and map the sensor's surroundings.
The cartographer source code consists of three main parts: cartographer, cartographer_ros, and ceres-solver (back-end optimization).
cartographer uses the mainstream SLAM framework, which is a three-stage approach of feature extraction, closed-loop detection, and back-end optimization. A submap subgraph is composed of a certain number of LaserScan, and a series of submap subgraphs constitute a global map. The short time process of constructing a submap with LaserScan has a small cumulative error, but the long time process of constructing a global map with a submap has a large cumulative error, so it is necessary to utilize closed-loop detection to correct the position of these submaps, and the basic unit of the closed-loop detection is the submap, and the closed-loop detection adopts the scan_match strategy. The focus of cartographer is the creation of submap subgraphs fusing multi-sensor data (odometry, IMU, LaserScan, etc.) and the implementation of the scan_match strategy for closed-loop detection.
cartographer_ros runs under ROS and can accept various sensor data in the form of ROS messages, and after
processed and then published as messages for debugging and visualization.
Note: Since ROSMASTER series robots are divided into multiple robots as well as multiple devices, the factory system has been configured with routines for multiple devices, but since it is not possible to automatically recognize the products, you need to manually set the machine type and radar model.
After entering the container: according to the model of the trolley, the type of radar and the type of camera make the following changes:
xxxxxxxxxx
root@ubuntu:/# cd
root@ubuntu:~# vim .bashrc
When the changes are complete, save and exit vim, then execute:
xxxxxxxxxx
root@ubuntu:~# source .bashrc
--------------------------------------------------------
ROS_DOMAIN_ID: 12
my_robot_type: x3 | my_lidar: a1 | my_camera: astraplus
--------------------------------------------------------
root@ubuntu:~#
You can see the current model of the modified cart, the type of radar and the type of camera
Note: When building a map, the slower the better the result (note that if you rotate slower), too fast, the effect will be very poor.
First of all, in the host [that is, the car on the jetson] in the need to do port binding operation [see the port binding tutorial chapter], where the main use of radar and serial port two devices;
Then check whether the radar and serial devices are in the port binding state: in the host [i.e., on the cart's jetson], refer to the following command to view the successful binding is the following state:
If it shows that the radar or serial device is not bound, you can plug and unplug the USB cable to check again.
Enter the docker container, see [docker course in ----- 5, enter the docker container of the robot], sub-terminal execution of the following LAUNCH file:
xxxxxxxxxx
ros2 launch yahboomcar_nav map_cartographer_launch.py
xxxxxxxxxx
ros2 launch yahboomcar_nav display_map_launch.py
Or use the remote control [slowly moving cart] to start building the map, until a complete map is built!
xxxxxxxxxx
ros2 run yahboomcar_ctrl yahboom_keyboard
xxxxxxxxxx
ros2 launch yahboomcar_nav save_map_launch.py
The save path is as follows:
xxxxxxxxxx
/root/yahboomcar_ros2_ws/yahboomcar_ws/src/yahboomcar_nav/maps/
One pgm image, one yaml file yahboomcar.yaml
xxxxxxxxxx
image: /root/yahboomcar_ros2_ws/yahboomcar_ws/src/yahboomcar_nav/maps/yahboomcar.pgm
mode: trinary
resolution: 0.05
origin: [-10, -10, 0]
negate: 0
occupied_thresh: 0.65
free_thresh: 0.25
Parameter parsing:
xxxxxxxxxx
rqt_graph
xxxxxxxxxx
ros2 run tf2_tools view_frames.py