[ros-users] pointcloud to pointcloud2 conversion

Martin, L kollaps2001 at hotmail.com
Tue Oct 19 00:07:32 UTC 2010


Hi,

I am sure it is probably a silly question to ask... but I can't get
pointcloud to pointcloud2 conversion to work.

To this is basically what I want to do:


  void scanCallback (const sensor_msgs::PointCloudConstPtr &cloud)
  {
	  sensor_msgs::PointCloud2 cloud2;
	  pcl::toROSMsg(*cloud, cloud2);

	   pcl::io::savePCDFile("test.pcd", cloud2, false);
  }


in words, I simply want to write the incoming pointcloud to a file. However
as (to my understanding) the pointcloud needs to be in the pointcloud2
format, did I try to convert it. Which however fails:


error: no matching function for call to ‘toROSMsg(const
sensor_msgs::PointCloud_<std::allocator<void> >&,
sensor_msgs::PointCloud2&)’


I have tried many things... but can't get it to work... so since I believe
it is only a small issue did I figure I just ask .

Or is there maybe a different way of saving it to a file? 

Many thanks in advance!

-- 
View this message in context: http://ros-users.122217.n3.nabble.com/pointcloud-to-pointcloud2-conversion-tp1729261p1729261.html
Sent from the ROS-Users mailing list archive at Nabble.com.



More information about the ros-users mailing list