Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

ros::spin() is an infinite loop; it continues until your process is killed, and it's the reason that your constructor is hanging; this happens regardless of whether you have any active subscribers or callbacks.

If this is inside of an object, you can repeatedly call ros::SpinOnce() until the member variable that counts frames has reached the appropriate value. (This works because ros::SpinOnce() does not block forever)