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

In your case, you could either:

  • Use the single-threaded model and spawn threads in the onInit method. For example, the camera1394 driver follows this approach: https://github.com/ros-drivers/camera1394/blob/master/src/nodes/nodelet.cpp

  • Use the multi-threaded model and let your callbacks be distributed among the available threads in the nodelet manager threadpool. For example: https://bitbucket.org/hidof/curriculum/src/9f3a8f0e5c25afe9720916c55e465164b526f595/tutorial_series/src/big_data_nodelets.cpp?at=default

Both approaches are fine, though with the first one you will be responsible for managing the thread you spawn, whereas with the second one it's all handled by the nodelet manager threadpool