setup problem for a publisher/subscriber running on different PCs
Hi,
I am really a ROS and Baxter beginner, and I am experiencing strange behaviour of the ROS communication layer that I do not understand. Consider two trivial scripts, a publisher and a subscriber:
publisher.py:
import rospy
from std_msgs.msg import String
pub = rospy.Publisher('foo', String)
rospy.init_node('publisher_test')
r = rospy.Rate(10)
while not rospy.is_shutdown():
pub.publish("hello world")
r.sleep()
subscriber.py:
import rospy
from std_msgs.msg import String
def callback(data):
rospy.loginfo("I heard %s",data.data)
rospy.init_node('subscriber_test')
rospy.Subscriber("foo", String, callback)
rospy.spin()
The ROS_MASTER is running in the Baxter internal PC.
I have 4 different shell opened: two shells in my PC, both configured launching the script baxter.sh, and two SSH shells - both configured launching the script baxter.sh. I have done 4 different experiment:
If I launch both the publisher and the subscriber from my PC, no problem arises.
If I launch both the publisher and the subscriber from the Baxter PC, no problem arises.
If I launch the publisher in from my PC and the subscriber from Baxter PC, no problem arises.
If I launch the publisher in the Baxter internal PC and the subscrber in my PC, the subscriber does not receive any message. If I launch "rostopic echo /foo" from my PC, it does not print anything. However, if I launch "/robot/joint_states" from my PC, no problem arises.
The PC and the baxter are direct connected with a twisted cable.
Some ideas?
Many thanks,
Sincerely Nicola