Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I use the following code for this...

1) Include the following:

#include <pcl_ros/point_cloud.h>

2) Set up your publisher:

typedef pcl::PointCloud<pcl::PointXYZ> PCLCloud;
ros::Publisher output_pub_ = node_.advertise<PCLCloud> (output_topic_name.c_str(), 100);

3) Publish your cloud:

pcl::PointCloud<pcl::PointXYZ> my_cloud;

NOTE: When you attempt to publish the cloud, you must publish it as a pcl::PointCloud<pcl::pointxyz>::Ptr (that's the purpose of the makeShared() function.