How to exit a terminal automatically after ROS is killed?
I have a keyboard teleoperation node launched as follows:
<node pkg="my_package" type="teleoperation.py" name="teleoperation" output="screen"
launch-prefix="gnome-terminal --command" />
This all functions fine but when I kill the ROS process (Ctrl + C
on the main ROS terminal) the keyboard teleoperation terminal stays open. My question is how do I make this exit/close when I kill the ROS process? In iterative development and functionality checking I'm ending up with loads of terminals still open from previous times I've run the launch file.
Terminal management is not something which is part of the
roslaunch
domain model (as far as it has one), so there is also no support for it.Any 'solution' will most likely be a trick.
Well, in Kinetic there a trick. You can launch the node using terminator.
it launches in another terminal and when the main terminal receives the `Ctrl + C, terminator kill the second terminal.
Note: As for anyone wanting to use this trick with newer versions of ROS (Melodic for instance), since terminator is being reimplemented with the new graphics of new Ubuntu versions, there a bug that prevent terminator for being launched when using the node launch parameter.