ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

rostopic publishing strange behavior with remote rosmaster

asked 2015-07-21 22:48:14 -0600

Arowana gravatar image

updated 2015-07-22 22:18:57 -0600

I have a very strange and annoying problem. I followed the documentation setup http://wiki.ros.org/ROS/NetworkSetup to use a remote rosmaster. I can see the topic list, ssh from both computers...

But I have this problem :

node_A is on the computer 1 where roscore is running.
node_B is on the remote computer 2.

node_B listens to a topic published /info by node_A.

If I launch node_B then node_A, the callback in node_B which get the message from /info is never called.

If I run node_A first, node_B will work as expected.

I noticed that if I do rostopic echo /info in both computers then run node_A. I will see data on computer 1 but not on computer 2.

I did all they asked to check in the documentation so I have no idea where my configuration can be wrong.

Here is the code for the subscriber :

#!/usr/bin/env python
import rospy
from std_msgs.msg import Float32MultiArray

def array_callback(array):
    print "Received errors"
    print array.data[0], array.data[1]

rospy.init_node('erros_printer')
rospy.Subscriber("errors", Float32MultiArray, array_callback)

rospy.spin()

And the publisher :

#!/usr/bin/env python
import rospy
rospy.init_node('errors_sender')
pub = rospy.Publisher("errors", Float32MultiArray)

array = Float32MultiArray()
array.data.append("ok")
array.data.append("hello")

while True:
    pub.publish(array)
edit retag flag offensive close merge delete

Comments

Seems less of Configuration issue and more of subscriber publisher problem. Can you give more information on the code for them ?

dementor gravatar image dementor  ( 2015-07-22 03:44:32 -0600 )edit

I edited my question with a simplified version of my subscriber and publisher nodes

Arowana gravatar image Arowana  ( 2015-07-22 22:18:29 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-07-23 03:15:10 -0600

ahendrix gravatar image

I suspect your name resolution between hosts is not set up properly.

In particular, I suspect the hostname advertised by computer 2 does not resolve on computer 1.

To confirm this, you can start the nodes on both computers (order doesn't matter), and then try to run rosnode ping /node_B on computer 1.

edit flag offensive delete link more

Comments

I did rosnode ping errors_printer

I get : rosnode: node is [/errors_printer] pinging /errors_printer with a timeout of 3.0s ERROR: connection refused to [ http://192.168.1.147:58366/ ]

Arowana gravatar image Arowana  ( 2015-07-23 21:18:09 -0600 )edit

/node_B is visible doing rostopic list on both computers.

Arowana gravatar image Arowana  ( 2015-07-24 00:48:44 -0600 )edit
1

"Connection refused" suggests that the node isn't listening, that it has crashed, or maybe you have a firewall set up which is blocking connections?

ahendrix gravatar image ahendrix  ( 2015-08-08 16:29:09 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-07-21 22:48:14 -0600

Seen: 505 times

Last updated: Jul 23 '15