[ros-users] pointcloud to pointcloud2 conversion

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: ros-users
Subject: [ros-users] pointcloud to pointcloud2 conversion

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.