[ros-users] Missing messages on startup
Mike Purvis
mpurvis at clearpathrobotics.com
Wed Jun 2 00:39:14 UTC 2010
Hey everyone,
I'm experiencing a curious issue with regards to a node which sends a
message on startup. The following works:
pub = rospy.Publisher("/clearpath/announce", Announce, latch=False)
rospy.init_node('controller')
pub.publish(action="rollcall")
However, if I initialize the node first before setting up the publisher, the
message send silently fails. No error, but the message never arrives, and
rostopic shows no activity:
rospy.init_node('controller')
pub = rospy.Publisher("/clearpath/announce", Announce, latch=False)
pub.publish(action="rollcall")
But, when I insert some delays, it works again!
rospy.init_node('controller')
rospy.sleep(0.5)
pub = rospy.Publisher("/clearpath/announce", Announce, latch=False)
rospy.sleep(0.5)
pub.publish(action="rollcall")
I assume that there's some initialization going on in a background thread;
is this a known/documented behavious? Is there some better way to handle it
than just these delays?
Thanks,
Mike Purvis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/ros-users/attachments/20100601/ff6c4357/attachment-0002.html>
More information about the ros-users
mailing list