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

As @gvdhoorn said, pub/sub is an asynchronous communication system.

To be sure your publisher send one message before closing, you can add a line to wait for a subscriber to subscribe to your topic.

You can do that using r_arm_comand_publisher.getNumSubscribers() which send the number of subscribers currently connected to your topic.