Robotics StackExchange | Archived questions

Does the launch order of subscriber vs publisher nodes count?

Hi,

I'm getting some trouble with my ROS system. I have one publisher node (Pub_B) and two subscriber nodes (Sub_A, and Sub_C) communicating with Pub_B via the same topic /my_topic. The launch order is Sub_A -> Pub_B -> Sub_C

At the beginning Sub_A can receive the messages of Pub_B normally but Sub_C or any other subscriber launched after the publisher even rostopic echo don't receive anything.

When killing and re-running the Pub_B node, Sub_C receive its messages but Sub_A no longer do.

When checking the rqt_graph and running rostopic info /my_topic, the connections does appear correctly. even though the communication is not working as expected.

I did believe that the launch order does not count till this unexpected issue. I need to know the possible causes of a similar behaviour.

Your help would be appreciated and please feel free to ask for more details if needed.

Jasmine

Asked by Jasmin on 2019-01-11 08:11:37 UTC

Comments

Are you launching as in using a launch file? There is no order in launch files. Have you tried sleeping with the publisher until the desired amount of subscribers is connected (e.g. #16595)?

Asked by aPonza on 2019-01-11 09:25:55 UTC

I'm using rosrun to start the nodes, any problem with that? I didn't try to add a sleep after the publisher creation, thank you for pointing that out, I'll try it and give you an update.

Asked by Jasmin on 2019-01-11 09:43:43 UTC

No problem with rosrun, but after reading more carefully (also Pub_A should be Pub_B probably) I think sleeping won't solve it, seems like a different issue. Could you post a minimal working example?

Asked by aPonza on 2019-01-11 09:52:22 UTC

You're right , I have one publisher which is Pub_B.

Asked by Jasmin on 2019-01-11 11:52:19 UTC

The nodes I'm working on are complicated, so many subscribers and publishers and lots of work going on. I'll make three minimal nodes, run them in the same way and see, if the same scenario is reproduced then I'll share these examples.

Asked by Jasmin on 2019-01-11 11:52:48 UTC

I've created three minimal nodes, (in my case they are python nodes and Sub_C is on a remote machine) but everything worked normally. I'll try to dig deeper.

Asked by Jasmin on 2019-01-15 06:27:42 UTC

Answers