ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This seems to work for me:

pcl::PointCloud<pcl::PointXYZ>::Ptr final(new pcl::PointCloud<pcl::PointXYZ>);
...
*do something*
....
sensor_msgs::PointCloud2 output;
pcl::PCLPointCloud2 tmp_cloud;
pcl::toPCLPointCloud2(*final, tmp_cloud);
pcl_conversions::fromPCL(tmp_cloud, output);
icp_pub.publish(output);

This seems to work for me:is what I usually do:

pcl::PointCloud<pcl::PointXYZ>::Ptr final(new pcl::PointCloud<pcl::PointXYZ>);
...
*do something*
....
sensor_msgs::PointCloud2 output;
pcl::PCLPointCloud2 tmp_cloud;
pcl::toPCLPointCloud2(*final, tmp_cloud);
pcl_conversions::fromPCL(tmp_cloud, output);
icp_pub.publish(output);