11.RTAB-Map 3D mapping navigation

 

rtabmap official website: http://introlab.github.io/rtabmap/

rtabmap ros-foxy:https://github.com/introlab/rtabmap/tree/foxy-devel

 

 

1. Introduction

rtabmap is a RGB-D image-based SLAM method that uses a bag-of-words-based global Bayesian loop closure detector to build maps in real-time in large-scale environments.

The features of rtabmap include:

 

2. Configuration before use

Note: Since the Muto series robots are equipped with multiple radar devices, the factory system has been configured with routines for multiple devices. However, since the product cannot be automatically recognized, the radar model needs to be manually set.

After entering the container: Make the following modifications according to the lidar type:

image-20230810180121094

After the modification is completed, save and exit vim, and then execute:

You can see the current modified radar type.

 

Note: The depth camera needs to be connected directly to the Muto main control, not to the USB-HUB. This can improve the transmission efficiency of the depth camera and improve the mapping and navigation effects. Otherwise, mapping and navigation may become impossible

 

3. Map construction

Note: When building a map, the slower the speed, the better the effect (note that the rotation speed should be slower). If the speed is too fast, the effect will be poor.

First, the port binding operation needs to be done on the host machine [that is, Muto's jetson] [see the port binding tutorial chapter]. The three devices of radar, serial port and camera are mainly used here;

Then check whether the radar and serial port device are in the port binding state: on the host machine [that is, the jetson of the car], refer to the following command to execute the check. The successful binding is as follows:

Check whether the camera is in port binding state

image-20230621171529181

If it shows that the lidar, serial port, and camera devices are not bound, you can plug and unplug the USB cable to check again.

 

Enter the docker container and execute the following launch file in a terminal:

  1. Start Astra camera
  1. Start mapping
  1. Start the lidar odometer
  1. Start rviz to display the map. It is recommended to perform this step in [Virtual Machine]. Multi-machine communication needs to be configured in the virtual machine.

image-20230621162945020

 

  1. Start the keyboard control node. It is recommended to perform this step in [Virtual Machine]. Multi-machine communication needs to be configured in the virtual machine.

Or use the remote control [Slowly Move Muto] to start mapping until a complete map is created

image-20230621163801080

 

 

  1. Map saving

When the map construction is completed, directly [ctrl+c] exit the map construction node, and the system will automatically save the map. The default saving path of the map [~/.ros/rtabmap.db]

 

4. Navigation

Enter the docker container and execute in a terminal:

 

4.1. Start the camera

 

4.2. Start rviz to display the map [Start on the virtual machine side]

Multi-machine communication is configured in the Ubuntu virtual machine and docker container. It is recommended to start it in the virtual machine in this step: to maintain time synchronization and reduce resource consumption, because if you use vnc, it is very dependent on the network and may cause navigation failure.

[Note that you must first start the node that displays the map, and then start the navigation node in step 3.This is because the navigation2 terminal map topic is only published once. If you start the navigation node first and then start the rviz display, you may not be able to subscribe to the map topic published only once, resulting in the map not being displayed]

image-20230621174839441

 

4.3. Display rtabmap_viz [Virtual machine side startup]

rtabmap_viz is the visual interface of RTAB-Map. It is an encapsulation of the RTAB-Map GUI graphics library. It is similar to rviz but has options for RTAB-Map. It can subscribe to different topics, such as odom, rgb/image, depth/image, scan, etc., to display the SLAM process and results, and at the same time load the 3D map into rviz. It is recommended to start this step in a virtual machine.

Note that the map will not be displayed after this step is started. You need to wait for the next navigation node to be started before it will be displayed.

image-20230621175513233

 

4.4. Start navigation node

Navigation can be divided into single-point navigation and multi-point navigation, which will be introduced below.

 

Enter the docker container and execute in a terminal:

  1. Start the chassis and load the map
  1. Start the navigation node
  1. Click [2D Pose Estimate] on rviz, then compare Muto’s pose and mark an initial pose for Muto on the map;

image-20230621175842191

The display after marking is as follows:image-20230621175731389

 

  1. Compare the overlap between the lidar scanning point and the obstacle, and set the initial pose for Muto multiple times until the radar scanning point and the obstacle roughly overlap;

 

4.5. Single-point navigation

After the initial pose is set, you can click [2D Goal Pose] to set a navigation target point, and Muto will start single-point navigation;

image-20230621180010957

image-20230621180238347

 

4.6. Multi-point navigation

  1. After the initial pose is set, you can click [Panels] in the upper left corner of rviz --- select [Navigation 2], and the [Navigation 2] panel will be displayed.

 

  1. Click [Waypoint mode] in the picture above, then click [Navigation2 Goal] on rviz to mark a target point on the map. Click [Navigation2 Goal] again to mark the second goal point on the map, and the cycle continues , you can mark multiple target points at one time;

image-20230621180955746

 

  1. After marking multiple target points, click [Start Navigation] to start multi-point navigation. After multi-point navigation is completed, Muto will stay at the pose of the last target point;

 

  1. It may appear during the navigation process. This is due to the navigation2 itself in the ros-foxy version. The subsequent ros2 version has been fixed.

image-20230421152009718

 

  1. rviz may exit during the navigation process. This may be caused by insufficient resources. You can turn off the display of rtabmap_viz on the virtual machine side after the navigation node is started to fully display the 3D map.

 

 

5. Node analysis

 

5.1. Display calculation graph

 

/rgbd_sync

image-20230621182357851

/rtabmap

image-20230621182433949

image-20230621182529855

image-20230621182550423

/rtabmap_viz

image-20230621182627882

/bt_navigator

image-20230421143315502

/controller_server

image-20230421143540368

/global_costmap/global_costmap

image-20230421143606354

/local_costmap/local_costmap

image-20230421143651486

/planner_server

image-20230421143734845

/recoveries_server

image-20230421143753659

/waypoint_follower

image-20230421143822640

 

 

5.3. TF transformation

image-20230810183808651