6、ORB_ SLAM2 PCL mapping

 

PCL official website address:http://pointclouds.org

pcl_ros wiki:https://wiki.ros.org/pcl_ros

pcl_ros github:https://github.com/ros-perception/perception_pcl

 

The operating environment and reference configurations for software and hardware are as follows:

 

6.1、brief introduction

PCL (The Point Cloud Library) is a large open source project for 2D/3D image and point cloud processing. The PCL framework consists of many advanced algorithms, including filtering, feature estimation, Surface reconstruction, registration, model merging and segmentation, etc. These algorithms have many applications, such as filtering Outlier in noise data, splicing multiple groups of 3D point clouds, segmenting relevant parts of the scene, extracting key points and Computational geometry descriptors of geometric shapes to identify objects, using point clouds to create and visualize object surfaces, and so on. PCL has been successfully compiled and configured on platforms such as Linux, MacOS, Windows, and Android/iOS. To simplify development, PCL is divided into a series of small Codebase that can be compiled separately.

 

Basic concepts of PCL interfaces for point cloud libraries and ROS:

Point cloud library: provides a set of data structures and algorithms for processing 3D data;

ROS's PCL interface: Provides a set of messages and conversion functions between messages and PCL data structures.

From the perspective of C++, PCL contains a very important data structure, which is point clouds. This data structure is designed as a template class, which takes the type of point as a parameter of the template class. The point cloud class is actually a container that contains all the common information required by the point cloud, regardless of the type of point. The following are the most important public fields in the point cloud:

header:This field is of type pcl: PCLHeader. The acquisition time of the point cloud was specified.

points:This field is of type std:: vector<PointT...>, which is a container for storing all points. The PointT in the vector definition corresponds to the template parameter of the class, which is the type of the point.

width:This field specifies the width of the point cloud when organized into an image, otherwise it contains the number of points in the cloud.

height:This field specifies the height at which the point cloud is organized into an image, otherwise it will always be 1.

is_dense:This field specifies whether there are invalid values (infinite or NaN values) in the point cloud.

sensor origin:This field is of type Eigen:: Vector4f and defines the pose obtained by the sensor based on its translation relative to the origin.

sensororientation:This field is of type Eigen:: Ouarternionf and defines the pose obtained by sensor rotation.

 

6.2、Using Tutorials

Note: The commands or locations mentioned below are all those in the Docker container unless otherwise specified.

 

Enter the Docker container (please refer to 【the Docker course section -5. Enter the Docker container of the robot】), and execute the following launch file on different terminals:

Here, take orin master as an example and modify the corresponding car model

2025-03-15_16-04-23

1、 Launch Camera

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

image-20230418094624816

3、 Start point cloud mapping

After opening, a 【 viewer 】 window will pop up, and slowly move the camera. When an image appears, as shown in the following figure:

image-20230418094841269

Need to scale and rotate the coordinate system, as shown in the following figure

Sliding roller: retraction and retraction

Hold down the scroll wheel: pan

Left mouse button: Rotate

Right mouse button: Zoom in and out

 

You can simultaneously open rviz to view the real-time point cloud mapping effect. Considering the high CPU and memory costs during the point cloud mapping process, it is recommended to use the virtual machine to enable rviz to view:

image-20230419112209078

 

image-20230418095240459

4、Slowly move the camera to create the image as shown below. After creating, press [Ctrl+c]to close and save the PCD point cloud file resultPointCloudFile.pcd. The path is as follows:

 

5、View the resultPointCloudFile.pcd file

(1)Method 1:Using PCL_ Viewer tool

Install PCL_ Viewer command:

Enter the directory where the PCD component is located and enter the following command to view the PCD point cloud map.

 

(2)Method 2:Using the PCD viewer plugin for vscode [recommended]

First install the pcd viewer plugin in vscode, and then open resultPointCloudFile.pcd to view the pcd point cloud image. Directly selecting the Y+direction and RGBA mode at the bottom here can quickly rotate the image to the main view .image-20230419113618139

 

 

6.3、Node resolution

 

6.3.1、Display Calculation Chart

 

 

 

 

6.3.2、Pointcloud_ Mapping node details

image-20230419121854299

 

6.3.3、TF transformation

image-20230419144328427