ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Some publishers are written the way that if there are no subscribers, then they do not publish and also avoid unneeded processing. To my knowledge, Kinect node works this way. It does not compute point clouds from the depth images coming from the sensor unless there are subscribers on the "points" topic. Therefore if you just need to get a point cloud once in a while, subscribing and ignoring messages will incur a lot of superfluous computations.
What may be useful in such cases is ros::topic::waitForMessage(). It waits for a single message to arrive on a topic, possibly with a timeout.