0
$\begingroup$

Rosanswers logo

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.


Originally posted by ncr7 on ROS Answers with karma: 325 on 2012-12-27

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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; msg.data = ss.str(); pubCyl.publish(msg);


Originally posted by ncr7 with karma: 325 on 2012-12-28

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.