ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Unreliable subscribers based on launch order

asked 2016-04-23 13:46:46 -0500

Cerin gravatar image

How do you ensure your node subscribes to a topic? I'm finding launch order effects if a node is able to successfully subscribe.

For example, say node A publishes /A/topic, and node B consumes it.

I found that if I launch A, then B...B never receives any messages from A even though I can see A's messages with rostopic echo /A/topic. If I kill A and restart it, or launch it after B, then B receives the messages.

Is this a bug in ROS or am I misunderstanding how ROS messages work? I would expect a node to subscribe and receive messages on a topic regardless of when it was launched relative to the publisher. As long as both nodes are running, the launch order shouldn't matter.

The docs say launch order shouldn't matter, but this doesn't seem to be the case. Why is this?

This even seems to effect rostopic echo. If you call it after the publisher, it can receive messages, but if you kill and restart the publisher, rostopic echo shows nothing until it too is restarted.

I've found this is causing some very obscure and difficult to diagnose bugs. The only workaround I've found is to kill every single node in my system and restart...which seems hacky and inefficient.

edit retag flag offensive close merge delete


Do you have a dedicated terminal window running a ROS core, or are you relying on roslaunch to bring up a core?

robustify gravatar image robustify  ( 2016-04-23 20:15:29 -0500 )edit

I'm using roslaunch.

Cerin gravatar image Cerin  ( 2016-04-23 21:04:29 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-04-23 23:56:53 -0500

robustify gravatar image

When the ROS core goes down, any running nodes with topic subscribers or publishers will have those topic connections terminated. They also will not automatically reconnect when a new core comes up, which is probably why you have to restart to the get the topics working again.

Therefore, I think if you always leave a terminal window/tab running a ROS core, your problems will go away. Another benefit of this is that any parameters that are set will continue to exist after stopping the launch file.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-04-23 13:46:46 -0500

Seen: 269 times

Last updated: Apr 23 '16