ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You can write nodes that only produce data when there is at least one subscriber. Two ways to achieve that:
NodeHandle::advertise supports subscription callbacks that are executed whenever a node subscribes or unsubscribes from the topic.
The Publisher object returned by advertise has a method getNumSubscribers.