ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
@Philip is right. The publisher need some time to connect to the subscribers. Your finite loop is just to short for that. I'm not sure what you expect from you condition case in the infinite loop as that is never true.
The proper solution to your problem is to use pub.getNumSubscribers()
and wait until that is > 0
. Then publish.