@qumu 参考之前的问题,需要做一下转换才能发布

如何在ROS2的环境下使用Pcl_ros以及pcl 功能包 中说:

#include "pcl_conversions/pcl_conversions.h"

pcl::PointCloudpcl::PointXYZRGB::Ptr cloud;
sensor_msgs::msg::PointCloud2 msg;

pcl::toROSMsg(*cloud, msg);
cloud_publisher->publish(msg);