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

Spin doesn't take significant time to start up what you're observing is the discovery and time required to establish connections. It's a race condition between creating your publisher, starting it publishing and making the connection to the subscriber. Spin doesn't necessarily have the state to know about whether there's a connection at the other end. And if you publish without any subscribers the message will be dropped.

If you want to have deterministic startup like this where you're coordinating the startup of publishers and subscribers to establish connections before starting to communicate please see the Lifecycle Nodes design and documentation