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