Does the launch order of subscriber vs publisher nodes count?

asked 2019-01-11 07:11:37 -0600

Jasmin gravatar image

updated 2019-01-11 10:53:10 -0600

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

edit retag flag offensive close merge delete

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)?

aPonza gravatar image aPonza  ( 2019-01-11 08:25:55 -0600 )edit

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.

Jasmin gravatar image Jasmin  ( 2019-01-11 08:43:43 -0600 )edit

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?

aPonza gravatar image aPonza  ( 2019-01-11 08:52:22 -0600 )edit

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

Jasmin gravatar image Jasmin  ( 2019-01-11 10:52:19 -0600 )edit
1

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.

Jasmin gravatar image Jasmin  ( 2019-01-11 10:52:48 -0600 )edit
1

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.

Jasmin gravatar image Jasmin  ( 2019-01-15 05:27:42 -0600 )edit