Welcome to ROSMASTER R2 repository
7. ORB_SLAM2 Octomap mapping
7、ORB_ SLAM2 Octomap mapping
7、ORB_ SLAM2 Octomap mapping7.1、brief introduction7.2 、Camera based octomap mapping7.3、Based on orbslam and pointcloud_ Octomap mapping for mapping7.4、Node resolution7.3.1、Display Calculation Chart7.3.2、Details of each node7.3.3、TF transformation
Octomap official website:http://octomap.github.io/
Octomap source code:https://github.com/OctoMap/octomap
octomap wiki:http://wiki.ros.org/octomap
octomap_server:http://wiki.ros.org/octomap_server
The operating environment and reference configurations for software and hardware are as follows:
Reference model: ROSMASTER X3
Robot hardware configuration: Arm series main control, Silan A1 LiDAR, AstraPro Plus depth camera
Robot system: Ubuntu (version not required)+Docker (version 20.10.21 and above)
PC virtual machine: Ubuntu (20.04)+ROS2 (Foxy)
Usage scenario: Use on a relatively clean 2D plane
7.1、brief introduction
Octomap is a 3D map creation tool based on Octree, which can display complete 3D graphics including accessible areas and unmapped areas, and sensor data based on occupancy grid can be fused and updated in multiple measurements; Maps can provide multiple resolutions, data can be compressed, and storage is compact In fact, the code for octomap mainly consists of two modules: the 3D map creation tool octomap and the visualization tool octovis. Compared to point clouds, it can save a lot of space. The map created by octomap is roughly like this: (different resolutions from left to right)

7.2 、Camera based octomap mapping
Note: The commands or locations mentioned below are all those in the Docker container unless otherwise specified.
Enter the Docker container, refer to【Docker Course -5. Entering the Robot Docker Container】, and execute the following launch file on the terminal:
xxxxxxxxxx#Raspberry Pi 5 master user~/run_docker.sh#Orin master user~/ros2_orbslam2.shHere, take orin master as an example and modify the corresponding car model

1、 Start camera code
ros2 launch astra_camera astro_pro_plus.launch.xml
2、Start octomap_ Server mapping
xxxxxxxxxxros2 launch yahboomcar_slam camera_octomap_launch.py
3、Enable rviz in Docker or Virtual Machine [Recommended] :
xxxxxxxxxxros2 launch yahboomcar_slam display_octomap_launch.py
4、Using a remote control or keyboard to control the node to slowly move the machine to create a map, losing keyframes may cause the map to fail.

7.3、Based on orbslam and pointcloud_ Octomap mapping for mapping
Enter the Docker container, refer to【Docker Course -5. Entering the Docker Container for Robot】, and execute the following launch file on each terminal:
1、 Start camera code
xxxxxxxxxxros2 launch astra_camera astro_pro_plus.launch.xml
2、Launch orbslam to release camera pose, color and depth maps. Depending on the performance of different controllers, the waiting time here is approximately within 10 seconds
xxxxxxxxxxros2 launch yahboomcar_slam orbslam_base_launch.py

3、 Start octomap_ Server mapping
xxxxxxxxxxros2 launch yahboomcar_slam orbslam_pcl_octomap_launch.py
4、Enable rviz in Docker or Virtual Machine [Recommended]:
xxxxxxxxxxros2 launch yahboomcar_slam display_octomap_launch.py
5、Using a remote control or keyboard to control the node to slowly move the machine to create a map, losing keyframes may cause the map to fail.

7.4、Node resolution
7.3.1、Display Calculation Chart
xxxxxxxxxxrqt_graph

7.3.2、Details of each node
7.3.3、TF transformation
xxxxxxxxxxros2 run tf2_tools view_frames.py
