ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If getMessageValue or readBuffer have a never ending loop, the program will never pass the call to .join(), because there it waits for the threads to finish. If this is the case, the easiest solution might be to call .detach() instead of .join().

However, if the two thread functions are just message callbacks, you should indeed use the AsyncSpinner.

specifically how to assign a method to a thread spun by it

You do not have to manually assign a method here, this is done by registering the callbacks when subscribing to a topic. The AsyncSpinner then lets the number of threads you specified execute those callbacks. Surely you already saw the Wiki entry on callbacks, but it really explains how to do it.