Ask Your Question

Revision history [back]

I use pcl_ros instead of pcl_conversions. It defines a very handy fromROSMsg function:

#include <pcl_ros/transforms.h>

sensor_msgs::PointCloud2 rosCloud;
pcl::PointCloud<pcl::PointXYZRGB>::Ptr pclCloud (new pcl::PointCloud<pcl::PointXYZRGB>); // creates a shared pointer
pcl::fromROSMsg(rosCloud, *pclCloud);

It also converts back:

pcl::toROSMsg(*pclCloud, rosCloud);