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
Are you
launch
ing 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)?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.No problem with rosrun, but after reading more carefully (also
Pub_A
should bePub_B
probably) I think sleeping won't solve it, seems like a different issue. Could you post a minimal working example?You're right , I have one publisher which is
Pub_B
.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.
I've created three minimal nodes, (in my case they are
python
nodes andSub_C
is on a remote machine) but everything worked normally. I'll try to dig deeper.