Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I don't think you need to call nh.subscribe("/camera/depth/points", 5, subCallback); from inside the while loop. That just re-subscribes to the topic over and over again. I'm not sure what kind of noise that creates in ROS's backend, but I'm guessing it's unnecessary at best.

Also, why are you publishing in the while? Why not publish directly from inside your callback if the point cloud message fits your criteria?

To stop your main thread from exiting, I think all you need is ros::spin();