I have written a node that is modeled after point_cloud_converter to convert
between two related types. Depending on the sequence in which I start my
nodes, some of the message callbacks get called or are ignored.
I have attached a (different but simple) python node that shows the problem.
If I run: python cyclic.py in:=in1
followed by: python cyclic.py out:=in1 in:=out
then both the callbacks get called.
However, when I reverse the order in which I launch the nodes:
python cyclic.py out:=in1 in:=out
followed by: python cyclic.py in:=in1
the callback in only the second node is called.
What I am doing incorrectly? Is there some handshaking code that I am not
using?
Advait
import roslib; roslib.load_manifest('rospy_tutorials')
import rospy
from std_msgs.msg import String
def callback(data):
rospy.loginfo('I heard %s', data.data)
if __name__ == '__main__':
p1 = rospy.Publisher('out', String)
rospy.Subscriber('in', String, callback)
rospy.init_node('cyclic_node', anonymous = True)
r = rospy.Rate(10)
while not rospy.is_shutdown():
s = 'hello world %s'%rospy.get_time()
# rospy.loginfo(s)
p1.publish(s)
r.sleep()