UGV Beast PI ROS2 5. 3D mapping based on depth camera
| ||
5. 3D Mapping Based on Depth Camera
This tutorial will show you how to use the RTAB-Map algorithm to perform 3D mapping based on LiDAR and depth camera. We provide two visualization methods for mapping. Before starting the mapping node, by default you have completed the main program and remotely connected to the Docker container according to the content in Chapter 1 UGV Rover PI ROS2 1. Preparation.
5.1 Visualizing in RTAB-Map
RTAB-Map (Real-Time Appearance-Based Mapping) is an open source algorithm for Simultaneous Localization and Mapping (SLAM), which is widely used in robot navigation, autonomous vehicles, drones and other fields. It uses data from visual and lidar sensors to build an environment map and perform positioning. It is a SLAM method based on loop closure detection.
Start the visualization node of RTAB-Map:
ros2 launch ugv_slam rtabmap_rgbd.launch.py use_rviz:=false
In a new Docker container terminal, run either joystick control or keyboard control node:
#Joystick control (make sure the joystick receiver is plugged into Raspberry Pi) ros2 launch ugv_tools teleop_twist_joy.launch.py #Keyboard control (keep the running keyboard control node active) ros2 run ugv_tools keyboard_ctrl
In this way, you can control the movement of the chassis to realize the mapping of the surrounding environment. After the mapping is completed, press Ctrl+C to exit the mapping node, and the system will automatically save the map. The default saving path of the map is ~/.ros/rtabmap.db.
5.2 Visualizing in RViz
Start the visualization node of RTAB-Map:
ros2 launch ugv_slam rtabmap_rgbd.launch.py use_rviz:=true
In a new Docker container terminal, run either the joystick control or keyboard control node:
#Joystick control (make sure the joystick receiver is plugged into Raspberry Pi) ros2 launch ugv_tools teleop_twist_joy.launch.py #Keyboard control (keep the running keyboard control node active) ros2 run ugv_tools keyboard_ctrl
In this way, you can control the movement of the chassis to realize the mapping of the surrounding environment. After the mapping is completed, press Ctrl+C to exit the mapping node, and the system will automatically save the map. The default saving path of the map is ~/.ros/rtabmap.db.