6、Data conversion and point cloud

6.1、scan to image

Start up lidar

image-20210903144710184

image-20210903144809419

Create subscribers and publishers

Process the data in the callback function [self.laserCallback()] and publish it

6.2、ROS and PCD

Introduce several tools running on several ROS nodes. Their role is to convert between format point cloud or package and point cloud data (PCD file format).

Start the Astra camera

Point cloud display: rviz (start the rviz command, select the corresponding topic, modify the parameters, and present different effects); pcl_visualization tool.

(1)pointcloud_to_pcd

Save the ROS point cloud message in the specified PCD file.

(2)convert_pcd_to_image

Load a PCD file and publish it as a ROS image message five times per second.

(3)convert_pointcloud_to_image

Subscribe to a topic of ROS point cloud and publish it with image information.

(4)pcd_to_pointcloud

Load a PCD file and publish one or more times as a ROS point cloud message.

(5)bag_to_pcd

rosbag recording

Order: rosbag record topic1 [topic2 topic3 ...]

bag_to_pcd

Read a package file and save the ROS point cloud message in the specified PCD file. This requires a bag file.

6.3、PCL 3D point cloud.

6.3.1、Start up

Release point cloud, the launch file contains the launch of rviz. So I can clearly see a cloud of dots flashing in the middle of rviz.

image-20210903152536091

Another way to start, this way you need to manually start [rviz], and add the component [PointCloud2] to select the topic [/color_cloud].

Code path: ~/transbot_ws/src/transbot_visual/src/pub_pointCloud.cpp

6.2.3、Point cloud visualization

Start up command

image-20210903153621551

【Ctrl】+【-】

【Shift】+【+】

【Alt】+【-】

【Alt】+【+】

 

Code path: ~/transbot_ws/src/transbot_visual/src/pcl_visualize.cpp