Ask Your Question

Publishing PCL *Coefficients

asked 2012-12-27 13:30:54 -0500

ncr7 gravatar image

updated 2012-12-27 13:34:18 -0500

I start the publisher

  pub = nh.advertise<sensor_msgs::PointCloud2> ("projected_inliers", 1);

I run ransac using the cylinder model


pcl::ModelCoefficients::Ptr coefficients2 (new pcl::ModelCoefficients);


seg.segment (*inliers2, *coefficients2);

I print the coefficients fine to the terminal.

std::cerr << "Cylinder coefficients: " << *coefficients2 << std::endl;

pubCyl.publish (*coefficients2);

But I can't seem to publish the coefficients2 successfully. It doesn't throw any errors but when I run rostopic echo /Cylinder_coef it slows my computer down to a stall if I don't end it rather quickly... I'm not sure if this has to do with it being a pointer and it somehow breaks or if I'm missing something else.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-12-28 06:26:45 -0500

ncr7 gravatar image

So figured out a solution. Very simple mistake on my part, the ROS publisher needed a string so I just did the following,

std_msgs::String msg; std::stringstream ss; ss << *coefficients2; = ss.str(); pubCyl.publish(msg);

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-12-27 13:30:54 -0500

Seen: 102 times

Last updated: Dec 28 '12