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

ROS msgs not received if publisher starts after subscriber

asked 2011-06-06 01:47:39 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hello,

We have many ROS nodes doing a fairly standard use of the publisher/subscriber mechanism as explained in the documentation. It is clear from ROS documentation that both the publishers and the subscribers can be started at any order and ROS will connect them.

In our case, we only receive messages in the subscriber if the publisher was launched first. And even if we do so, restarting the publisher will lead to the subscriber not receiving messages any more unless we also restart the subscriber.

As far as I understand from ROS documentation, this is unexpected. Where could I start for to troubleshoot this problem?

Thanks in advanced.

edit retag flag offensive close merge delete

Comments

Could you post a minimal example that reproduces this behavior?
bhaskara gravatar image bhaskara  ( 2011-06-06 07:16:02 -0500 )edit
are you using messages on a topic or services? I second bhaskara that if you give example it will be easier for people to help you. It sounds like it is possible that you have a logic bug, rather than a bug in the ROS communication infrastructure.
Dimitar Simeonov gravatar image Dimitar Simeonov  ( 2011-06-06 07:24:40 -0500 )edit
Could it be a networking issue? Do your nodes run on different hosts? Is the local host name set correctly, i.e. can you ping it? You could try setting the environment variable ROS_IP to your local IP address.
Lorenz gravatar image Lorenz  ( 2011-06-06 08:26:19 -0500 )edit

4 Answers

Sort by ยป oldest newest most voted
2

answered 2011-06-07 03:59:19 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hello all,

As Lorenz suggested defining the ROS_IP solved my problem. I had different network interfaces (wlan0, eth0, etc) and I had to explicitly tell ROS which one to use. This is clearly explained in http://www.ros.org/wiki/ROS/EnvironmentVariables : "This setting is only needed in situations where you have multiple addresses for a computer and need to force ROS to a particular one. "

Problem solved. Thanks for your quick support.

Daniel.

edit flag offensive delete link more
3

answered 2011-06-06 12:59:19 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

This is a complete guess, but I'm guessing that you are using roslaunch to bring up your test cases. If so are you running roscore seperately? Because if you are not, when you "stop" the first roslaunch which you started it will take down the roscore which was started for you. After that all connected nodes will continue to communicate, but cannot reconnect. And the next launch will bring up the roscore with for you again, since it was not detected. But only nodes launched after the roscore will be able to connect with each other.

So if this is your case, run roscore seperately. Or make sure the first roslaunch you bring up stays up for the duration of your testing.

edit flag offensive delete link more
1

answered 2011-06-07 03:44:44 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hello again,

Thanks for the quick answers and comments. I will provide more information to each of them:

tfoote, I am indeed running the roscore separately as you suggest. Your guess could have explained perfectly what we are experiencing, but it must be something else. Thanks a lot.

Dimitar Simeonov, sorry I didn't clarify it but I meant messages on topics.
bhaskara, we have this behaviour in pretty much all our nodes with different source code combinations. Unfortunately I don't have access to the source code today, so I will post it tomorrow. Thanks.

Lorenz, yes, my nodes mainly run on different nodes. All the network setup seems correct to my but I am actually not setting the ROS_IP (I thought it was enough to set ROS_MASTER_UI). I will definitely try and report here. Thanks.

edit flag offensive delete link more
0

answered 2014-04-07 03:27:20 -0500

TinGoose gravatar image

Has bumbed to similar problem while using rosbag on hydro. All subscribing nodes cease to resubscribe, even 'rostopic echo ...'.

edit flag offensive delete link more

Comments

@TinGoose please open a new question. Yours is different if it's not resolved by the above answer. This question is resolved and will generally not be looked at by most users.

tfoote gravatar image tfoote  ( 2014-04-07 11:03:34 -0500 )edit

Question Tools

Stats

Asked: 2011-06-06 01:47:39 -0500

Seen: 3,700 times

Last updated: Apr 07 '14