Robotics StackExchange | Archived questions

copy a pointcloud but just copy a part of points data

I want to copy a pointcloud to do transformpointCloud, but the data from pointcloud is too much, so I want to pickup one every 25 data.

pcl::PointCloud<pcl::PointXYZ>::Ptr simpleCloud(new pcl::PointCloud<pcl::PointXYZ>);
int cloudsize = (int)ceil((outputCloud1 -> width) * (outputCloud1 -> height)*1.0/25.0);
simpleCloud ->width =outputCloud1->width;
simpleCloud ->height =outputCloud1->height;
simpleCloud ->is_dense =outputCloud1->is_dense;
//simpleCloud ->sensor_origin_ =outputCloud1->sensor_origin_;
//simpleCloud ->sensor_orientation_ =outputCloud1->sensor_orientation_;
for(int i=0; i<cloudsize;i++)
   {

      simpleCloud ->points[i] = outputCloud1 -> points[i*25];

    }  

Then everytime I launch this code, node died. Does anybody give me suggestions? Thanks very much.

I find solution in answer

Asked by crazymumu on 2015-04-24 17:52:38 UTC

Comments

Have you tried running your node in a debugger?

Asked by ahendrix on 2015-04-24 21:14:56 UTC

could you tell me how to run the node in a debugger

Asked by crazymumu on 2015-04-24 22:37:09 UTC

rosrun --prefix 'gdb --args' my_package my_node (you can use this for valgrind and other tools, too)

Asked by ahendrix on 2015-04-24 22:55:48 UTC

i do like you said, it just said "no debugging symbols found", could you explain a little bit more, or there are some examples? IseeGDB Tutorial,but coudn't undstand. Thanks for your time

Asked by crazymumu on 2015-04-24 23:27:09 UTC

You need to build you nodes in debug mode in order to have debug symbols. When you run catkin_make, add -DCMAKE_BUILD_TYPE=Debug

Asked by ahendrix on 2015-04-25 01:40:30 UTC

thanks so much.

Asked by crazymumu on 2015-04-25 12:27:57 UTC

Answers