ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

You can write nodes that only produce data when there is at least one subscriber. Two ways to achieve that:

  1. NodeHandle::advertise supports subscription callbacks that are executed whenever a node subscribes or unsubscribes from the topic.

  2. The Publisher object returned by advertise has a method getNumSubscribers.