Wait until nodes launched from code are ready

asked 2020-07-24 03:53:28 -0600

Mermy gravatar image

Hi all,

My question is quite simple. I have a node that launches other nodes using process API. I can not use rosspawn, since I need to launch them with arguments. After that, my node has to wait until the created nodes have started to be sure that they are ready. Nowadays, I basically have one function that checks the nodes against 'roslist' and my node is blocked there until all of them are ready. I am guessing, is there any better way to do this?

edit retag flag offensive close merge delete

Comments

I do not understand why roslaunch is not suitable here, can you be more precisse of what is your set up/requirements?

Weasfas gravatar image Weasfas  ( 2020-07-24 13:17:10 -0600 )edit

Thanks for your comment. I use roslaunch. My problem is that the node that actually calls roslaunch to launch other nodes, it has to wait some time until they are ready. I am guessing which is the best way to do that.

Mermy gravatar image Mermy  ( 2020-07-27 02:23:16 -0600 )edit
1

I mean if you use roslaunch you do not need to call the launch file from any node, You just generate a launch file including the other launch files in the order you want and each launch file will be launched in that order. If you want to wait between launch files you can implement a bash script in which you call roslaunch your_package your_file.launch and then exucutes a sleep X between commands.

Weasfas gravatar image Weasfas  ( 2020-07-27 11:22:43 -0600 )edit

Ok, I get your point. I was guessing precisely if I can avoid sleeps, but sleeps in a bash file are much better than in the middle of the code, so it is an important improvement. Thanks!

Mermy gravatar image Mermy  ( 2020-07-28 03:48:58 -0600 )edit