Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to make a class with publisher and subscriber which is a member of another class

Let's assume I have class cA, which has a node that subscribe from topic and publisher with a "constant" frequency. Class cA is a mamber of class cB. Where I should put "while(ros::ok())" for publishing purpose? Cose if i put it in constructor it'll bloc constructor of "higher" class (ofc. I can make a function cA::Publish() and run everything further in cB::Publish() or split classes to more nodes and classes, but i am looking for beter solution).

Should I use threads? I have never used them so I don't know if i should. I found this _cant_post_links_http_://

Is there an easy example?

thanks in advance