ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I suspect this may be a problem of the timing of publishing and setting up the listeners.
A listener object takes a short period of time to attach to a topic before it will start receiving messages. in Node1 you are publishing on the topic chatter1
then then subscribing to the topic for the expected reply c
. It is possible that the subscriber is not set up in time for it to catch the reply sent by Node2.
I recommend moving the line rospy.Subscriber('c', String, callback2)
before the publish commands and adding a 1 second delay after it to make sure it's setup before you publish the test messages.
Let us know if this fixes your problem.