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:
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.
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:
xxxxxxxxxx
ros2 launch astra_camera astro_pro_plus.launch.xml
xxxxxxxxxx
ros2 launch yahboomcar_slam orbslam_base_launch.py
xxxxxxxxxx
ros2 launch yahboomcar_slam orbslam_pcl_map_launch.py
When the viewer pops up, move the camera slowly, and when a picture appears, look at the following picture.
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:
xxxxxxxxxx
ros2 launch yahboomcar_slam display_pcl_launch.py
xxxxxxxxxx
/root/yahboomcar_ros2_ws/yahboomcar_ws/src/yahboomcar_slam/pcl/resultPointCloudFile.pcd
(1) Method 1: Use the pcl_viewer tool
Install the pcl_viewer command:
xxxxxxxxxx
sudo apt-get install pcl-tools
Enter the directory where the pcd file is located and enter the following command to view the pcd point clouds
xxxxxxxxxx
pcl_viewer resultPointCloudFile.pcd
(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
xxxxxxxxxx
rqt_graph
xxxxxxxxxx
ros2 run tf2_tools view_frames.py