How do I use pcl::toROSMsg() ?
I have a variable world
of type const pcl::kinfuLS::WorldModel<pcl::PointXYZI>::PointCloudPtr
and I would like to get it into a variable cloud
of type sensor_msgs::PointCloud2
.
I am trying to use pcl::toROSMsg
for this:
pcl::toROSMsg(world,cloud);
But I get the following error message:
pcl/gpu/kinfu_large_scale/src/kinfu.cpp:234:30: error: no matching function for call to ‘toROSMsg(const PointCloudPtr&, sensor_msgs::PointCloud2&)’
pcl/gpu/kinfu_large_scale/src/kinfu.cpp:234:30: note: candidates are:
pcl/common/include/pcl/ros/conversions.h:237:3: note: template<class PointT> void pcl::toROSMsg(const pcl::PointCloud<PointT>&, sensor_msgs::PointCloud2&)
pcl/common/include/pcl/ros/conversions.h:275:3: note: template<class CloudT> void pcl::toROSMsg(const CloudT&, sensor_msgs::Image&)
pcl/common/include/pcl/ros/conversions.h:308:3: note: void pcl::toROSMsg(const sensor_msgs::PointCloud2&, sensor_msgs::Image&)
pcl/common/include/pcl/ros/conversions.h:308:3: note: no known conversion for argument 1 from ‘const PointCloudPtr {aka const boost::shared_ptr<pcl::PointCloud<pcl::PointXYZI> >}’ to ‘const sensor_msgs::PointCloud2&’
How do I convert between these two data types?