0
$\begingroup$

Rosanswers logo

Is there any possible way to specify the order that the nodes initiated by a launch file are killed when the launch file as a whole is killed? I have a launch file that starts several nodes for the control of our robot. One of these is a node that takes care of the low level control of the robot. It is important that this node is the last one to be killed when shutting down the robot. From what I can tell, when a launch file is killed, the nodes are killed in a random order. Is there a way to make sure that this node is killed last? I know I can fix this by just having two separate launch files: one that launches this low level node and one that launches the rest and then make sure they are killed in the right order. I just was hoping there may be a way where I could do this all in one file to make it simpler to use. Thanks!


Originally posted by vsherrod on ROS Answers with karma: 36 on 2017-01-13

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I know it has been a while, but I did end up finding a working (but not ideal) solution for my problem. As the other's mentioned, there is not a guaranteed way to enforce a shutdown order when killing a launch file. However, I was able to find a solution that worked for our needs. For any node that we needed killed before the low level controller, it was launched with the output='screen' and the launch-prefix="xterm-e" as shown in the example below.

<node name="pressure_commander" pkg='louie_control' type='control_to_pressure.py' output='screen' launch-prefix="xterm -e"/>

This makes an individual terminal for each of these nodes. You can kill these nodes individually with ctrl-c in its respective terminal. This way you can regulate the order that the nodes are killed. The disadvantage is that you have to individually kill each of these nodes. However, you do get the advantage of still being able to start them in one launch file.


Originally posted by vsherrod with karma: 36 on 2017-11-08

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.