0

Rosanswers logo

get error in callback this is caused by the last line ... any ideas what is happening. I am using pcl 1.7.2 and ros indigo under ubuntu 14.04.

 void  cloud_cb (const sensor_msgs::PointCloud2ConstPtr& msg)
{
  pcl::PointCloud<pcl::PointXYZRGBA> cloudxx;
  pcl::fromROSMsg(*msg,cloudxx);  // Convert ros msg cloud to pcl cloud
  CloudConstPtr cloud(&cloudxx);  // this line generates error
}

*** Error in `/home/richard/catkin_ws/devel/lib/testPCD/testPCD': double free or corruption (out): 0x00007ffd908a8c50 ***


Originally posted by rnunziata on ROS Answers with karma: 713 on 2015-06-03

Post score: 0

1 Answers1

0

Rosanswers logo

OK...this code fixed the issue (there maybe other issues) but I do not know why....if someone can explain it would be helpful.

  pcl::PointCloud<pcl::PointXYZRGBA> cloudxx;
  pcl::fromROSMsg(*msg,cloudxx);  // Convert ros msg cloud to pcl cloud
  pcl::PointCloud<pcl::PointXYZRGBA>::Ptr point_cloud_ptr (new pcl::PointCloud<pcl::PointXYZRGBA>(cloudxx));
  CloudConstPtr cloud(point_cloud_ptr);

Originally posted by rnunziata with karma: 713 on 2015-06-03

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by jhlim6 on 2016-02-11:
hi, I have the same error msg. How do you use CloudConstPtr cloud () ? I got CloudConstPtr was not declared when i tried to use it

Comment by jhlim6 on 2016-02-11:
Thanks, I just realized that line 3 is the critical line, not line 4. That solved my problem of double freeing pointers.