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

Publishers should be constructed and kept alive for the runtime of the program. The issue you are seeing is not so much the latency of ROS, but more the fact that it takes some time to setup the connection to other nodes. Once that's happened messages should arrive quickly.

The publish() call itself doesn't guarantee that messages are delivered anywhere. They will only be sent to connected nodes. Between the three lines of code this won't have happened yet, so it's sent to nowhere.