How to clone a PointCloud in a subscriber callback
Dear all, I am using Indigo, coming from Groovy and Hydro, I found it difficult to understand the internals of pcl_ros and pcl_conversions packages.
My problem is the following: I have a subscription callback like this: void RosHandler::xtionCloudCallback(const sensor_msgs::PointCloud2::ConstPtr& msg); or, for me it's the same, like this: void RosHandler::xtionCloudCallback(const pcl::PointCloud<pcl::pointxyzrgb>::ConstPtr& msg);
the first question is: is this pcl::PointCloud<pcl::pointxyzrgb> the same as in pcl? if it is the same, how can I clone the data, in such a way that I can use them without bothering of what ROS is doing meanwhile (i.e., in another thread)?
What I did in Groovy (and it worked) was to manually copy the message field by field (and cloning "data"), but it does not work anymore (and, indeed, I was not sure it was safe to do that in that way).
EDIT: when I say "it does not work" I mean that it segfault when I delete the new (cloned) cloud, so this means the ownership of the cloud was not (entirely?) mine EDIT2: the problem is not only I cannot delete the cloud, of course, but also that I cannot read it (it has been deleted by someone else)