ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
It is most likely being published, but only once, and too fast after creating the Publisher
. This doesn't leave any time for any potential Subscriber
s to actually notice it, register, prepare to receive the data and then actually receive it.
If you want to give "late joiners" a chance to receive the message -- and you don't publish periodically, or have messages changing contents often, you could try using a latched Publisher
. From wiki/rospy/Overview/Publishers and Subscribers: rospy.Publisher initialization:
There are additional advanced options that allow you to configure the
Publisher
:[..]
latch=False
Enable 'latching' on the connection. When a connection is latched, a reference to the last message published is saved and sent to any future subscribers that connect. This is useful for slow-changing or static data like a map. The message is not copied! If you change the message object after publishing, the change message will be sent to future subscribers.
Note how publishing data "like a map" is given as one of the cases in which this could be useful.
2 | No.2 Revision |
It is most likely being published, but only once, and too fast after creating the Publisher
. This doesn't leave any time for any potential Subscriber
s to actually notice it, register, prepare to receive the data and then actually receive it.
If you want to give "late joiners" a chance to receive the message -- and you don't publish periodically, or have messages changing contents often, you could try using a latched Publisher
. From wiki/rospy/Overview/Publishers and Subscribers: rospy.Publisher initialization:
There are additional advanced options that allow you to configure the
Publisher
:[..]
latch=False
Enable 'latching' on the connection. When a connection is latched, a reference to the last message published is saved and sent to any future subscribers that connect. This is useful for slow-changing or static data like a map. The message is not copied! If you change the message object after publishing, the change message will be sent to future subscribers.
Note how publishing data "like a map" is given as one of the cases in which this could be useful.