ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The subscriptions don't block the control flow in main()
, so you don't need to put them in threads. All that they do is to register the callback with the callback manager (which will not fire then until you run spin()
). So, the following should work
int main() {
// These will not block.
subscribe to topic X with callback X_callback
subscribe to topic Y with callback Y_callback
[other stuff]
spin();
}