ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Please use the search: subscribing takes time. Setting up connections between publishers and subscribers takes time. If you don't allow for this setup, published msgs are lost (ie: no one is listening).
If you don't want to lose any messages, then bare publish-subscribe in ROS 1 is not what you should use. Services or actions might be more suitable.
Alternatively: consider using ros::Publisher::getNumSubscribers() and waiting for at least a single subscriber before publishing anything.