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

After you create a ros publisher, it will take some time before the connections to all the subscribers are created. So when you publish a message right after you create the publisher, the message will not reach the subscribers. In your example, this is exactly what happens, when you create a new publisher in the first callback, and immediately publish a message. The second time you publish a message form the same callback, the connections are established and the messages will reach the subscribers.