6. cartographer building algorithm

 

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:

6.1. Introduction

 

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).

image-20230420170956628

 

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.

 

6.2 Usage

6.2.1 Pre-use Configuration

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:

9e93005c-1684146808579-1

When the changes are complete, save and exit vim, then execute:

You can see the current model of the modified cart, the type of radar and the type of camera

6.2.2 Specific use

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:

image-20230421151543423

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:

  1. Launch build map
  1. Start rviz to display the map, this step is recommended to be executed in a virtual machine, virtual machines need to be configured to multi-machine communication

image-20230420173657374

  1. Start the keyboard control node, this step is recommended to perform in the virtual machine, virtual machine needs to be configured for multi-machine communication

Or use the remote control [slowly moving cart] to start building the map, until a complete map is built!

 

image-20230420173816269

 

 

  1. The map is saved with the following path:

The save path is as follows:

image-20230420161956140

One pgm image, one yaml file yahboomcar.yaml

Parameter parsing:

 

 

6.3. Node resolution

 

6.3.1. Displaying a computational graph

 

 

 

 

 

6.3.2. cartographer_node node details

image-20230420174247512

image-20230420174327717

6.3.3 TF transformations

image-20230420174517180