[ros-users] Copypcl::PointCloud<pcl::PointXYZ> to another p…

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: ros-users
Subject: [ros-users] Copypcl::PointCloud<pcl::PointXYZ> to another pcl::PointCloud<pcl::PointXYZ>

Hi!!!

I have pcl::PointCloud<pcl::PointXYZ> as a result of transforming a sensor_msgs::PointCloud2 with the pcl::fromROSMsg(*msglaser, laser_ready) function.
Although my idea is modify that Point cloud, because I want to add some points, I want to do an interpolation. So I want to copy some points directly, I mean in the same order but between others I want to add some points.
Therefore I want to know how to copy in order points from a pcl::PointCloud<pcl::PointXYZ> to another.
I have tried to do that working the point cloud as an array and doing this:

laser_finish.points.push_back(laser_ready.points[it] ( where laser_finish and laser_ready are pcl::PointCloud<pcl::PointXYZ>)

But I have always this error:

control: /home/robot/src/ros/stacks/point_cloud_perception/pcl/include/pcl/ros/conversions.h:176: void pcl::toROSMsg(const pcl::PointCloud<PointT>&, sensor_msgs::PointCloud2&) [with PointT = pcl::PointXYZ]: Assertion `cloud.points.size () == cloud.width * cloud.height' failed.
server: /home/robot/src/ros/stacks/point_cloud_perception/pcl/include/pcl/ros/conversions.h:176: void pcl::toROSMsg(const pcl::PointCloud<PointT>&, sensor_msgs::PointCloud2&) [with PointT = pcl::PointXYZ]: Assertion `cloud.points.size () == cloud.width * cloud.height' failed.

The thing is that I have looked into the pcl function, but I didn't find nothing that suites with this operation. I would appreciate information,
Thanks in advanced.

Nicolas