Hi,
You can write the pointclouds in the call back function like below. Here
pcl::PointCloud<pcl::PointXYZRGB> PC;
void callback(const sensor_msgs::PointCloud2::ConstPtr& msg)
{
cout<<"Writing the file..."<<endl;
pcl::fromROSMsg(*msg, PC);
pcl::io::savePCDFileASCII(path, PC);
cout<<"Saved "<<PC.points.size()<<" data points "<<path<<endl;
}
But this will re-write the file at the same rate at which the pointclouds are published in ros. So you may have to exit it manually.
Hope it helps!!
Karthik
You may have to follow the tutorial for including the files and having a start off on this issues. If the package is already created then you have to edit the manifest.xml file to include the dependencies of the pcl_ros as mentioned in the tutorial.
Pls, always edit your question for further clarifications, do not post new answers.
Let me know any if you are facing any other issues.
Karthik
Originally posted by karthik with karma: 2831 on 2012-01-30
This answer was NOT ACCEPTED on the original site
Post score: 2