6. ORB_SLAM2 PCL build map

 

6. ORB_SLAM2 PCL build map6.1, Introduction6.2. Using6.3. Node Resolution6.3.1 Display of calculation diagrams6.3.2. pointcloud_mapping node details6.3.3 TF transformations

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 hardware and software reference configuration are as follows:

 

6.1, 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 a number of state-of-the-art algorithms for filtering, feature estimation, surface reconstruction, alignment, model collocation and segmentation. These algorithms have many applications, such as filtering outliers in noisy data, assembling multiple 3D point clouds, segmenting relevant parts of a scene, extracting key points and computing descriptors of geometric shapes for object recognition, creating and visualizing surfaces of objects using point clouds, etc. PCL has been compiled and configured for Linux, MacOS, Windows, and Android/iOS. iOS platforms. To simplify development, PCL has been split into a series of small, individually compilable code libraries.

 

Basic concepts of the Point Cloud Library and the PCL interface for 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 a C++ point of view, the PCL contains a very important data structure, which is the point cloud. This data structure is designed as a template class that takes the type of the point as a parameter to the template class. The point cloud class is actually a container that contains all the public information needed for the point cloud, regardless of the type of the point. Here are the most important public fields in the point cloud:

header: this field is of type pcl:PCLHeader. It specifies when the point cloud was acquired.

points: this field is of type std::vector<PointT...> and is a container for all the points. pointT in the vector definition corresponds to the template parameter of the class, i.e. the type of the point.

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

height: this field specifies the height of the point cloud when organized as an image, otherwise it is always 1.

is_dense: this field specifies if there are invalid values (infinity or NaN values) in the point cloud.

sensor origin: this field is of type Eigen::Vector4f and defines the bitmap of the sensor according to the translation with respect to the origin.

sensororientation: this field is of type Eigen::Ouaternionf and defines the orientation of the sensor according to its rotation.

 

6.2. Using

Enter the docker container (for steps, see [docker course chapter ----- 5. Enter the docker container of the robot]), and execute the following LAUNCH file in a sub-terminal:

  1. Start the camera
  1. Start orbslam to publish the camera position as well as the color and depth maps, depending on the performance of different masters, the waiting time here is about 10s

image-20230418094624816

  1. Start point cloud construction

When the viewer pops up, move the camera slowly, and when a picture appears, look at the following picture.

image-20230418094841269

To zoom and rotate the coordinate system, see the following chart

Slide the wheel: zoom in and out.

Press and hold the wheel: Pan

Left click on the cursor: Rotate.

Right click on the cursor: zoom in and out.

 

You can open rviz at the same time to view the real-time point cloud construction effect. Considering the CPU and memory overhead during the point cloud construction process, it is recommended to open rviz on the virtual machine side to view it:

image-20230419112209078

 

image-20230418095240459

  1. Slowly move the camera to build the image as shown below, finish building, close [Ctrl+c], and automatically save the pcd point cloud file resultPointCloudFile.pcd with the following path:
  1. View resultPointCloudFile.pcd file

(1) Method 1: Use the pcl_viewer tool

Install the pcl_viewer command:

 

Enter the directory where the pcd file is located and enter the following command to view the pcd point clouds

(2) Method 2: Use vscode's pcd-viewer plugin [recommended].

First install the pcd-viewer plugin in vscode, and then open resultPointCloudFile.pcd to view the pcd point cloud map. Here directly select the Y + direction and the bottom of the RGBA mode can be quickly rotated to the main view of the figure

 

image-20230419113618139

 

 

6.3. Node Resolution

 

6.3.1 Display of calculation diagrams

 

 

 

 

6.3.2. pointcloud_mapping node details

image-20230419121854299

 

6.3.3 TF transformations

image-20230419144328427