Subscriber not connecting if nodes are launched simultaneously

asked 2020-01-24 23:26:07 -0500

Hi all, I've been using ROS and python for quite a while now but I'm still learning and this is my first question.

I have a bit of an odd problem here - I think. I am launching two nodes that both subscribe and publish. Node one reads a sensor message and publishes an array. Node two subscribes to the array, does some processing, and outputs a cost map.

Now - if I launch both these nodes in a launch file then the subscriber in node two doesn't connect - the associated callback is never called and node two doesn't publish anything.

However, if I run both nodes from the terminal using rosrun then they both work fine, and if i put time.sleep(2) at the start of node two and launch them from the launch file then they also work fine. It seems that something is going wrong when they start simultaneously.

Any ideas much appreciated

Thanks

Kevin

edit retag flag offensive close merge delete

Comments

It will probably help if you could reduce your code to the bare minimum that still exhibits the problem you encounter and then post it here. There are many ways in which things may go wrong, but without seeing the code, it's almost impossible to know which may be the exact cause of your problem.

gvdhoorn gravatar image gvdhoorn  ( 2020-01-25 03:54:51 -0500 )edit