ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I also face the same issue, when i publish the message, the subscriber always missed the first message. The reason was already answered by @wim and it was correct.
To solve this issue, i used sleep() method with some milliseconds after publisher creation. So, meanwhile the publisher will make connection with all waiting subscribers. Then, you can start publishing message, and subscriber will receive all messages.
pub = rospy.Publisher('counter',Int32,queue_size=10)
rate = rospy.Rate(2)
rate.sleep() #sleep for 500ms
counter = 1;
while not rospy.is_shutdown(): pub.publish(counter) counter += 1 rate.sleep()
2 | No.2 Revision |
I also face the same issue, when i publish the message, the subscriber always missed the first message. The reason was already answered by @wim and it was correct.
To solve this issue, i used sleep() method with some milliseconds after publisher creation. So, meanwhile the publisher will make connection with all waiting subscribers. Then, you can start publishing message, and subscriber will receive all messages.
pub =