Re: [ros-users] pointcloud to pointcloud2 conversion

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Radu Bogdan Rusu
Date:  
To: Martin, L
CC: Point Cloud Library \(PCL\) mailing list, User discussions
Subject: Re: [ros-users] pointcloud to pointcloud2 conversion
Martin,

What you are doing seems to be correct, but:

* did you include the correct header file?
* do you have a correct pcl dependency in your manifest.xml?

Cheers,
Radu.


On 10/18/2010 05:07 PM, Martin, L 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!
>