Hi,

The method to do that conversion is available in the sensor_msgs package.  Documented at  http://www.ros.org/doc/api/sensor_msgs/html/namespacesensor__msgs.html#ab3bdbe5a82173d3483899c776e6ccbab

Tully

On Mon, Oct 18, 2010 at 5:07 PM, Martin, L <kollaps2001@hotmail.com> wrote:

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.
_______________________________________________
ros-users mailing list
ros-users@code.ros.org
https://code.ros.org/mailman/listinfo/ros-users



--
Tully Foote
Systems Engineer
Willow Garage, Inc.
tfoote@willowgarage.com
(650) 475-2827