Ask Your Question

is it possible to run and quit launch files from code inside a node?

asked 2015-02-15 06:55:03 -0500

Is there a way to run a launch file from code inside a node, and to stop one that has launched (as you would in a terminal window)

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2015-08-27 02:55:25 -0500

I just noticed this which does what I need

edit flag offensive delete link more


Could you actually run a launch file, or just one node like the example shows? (or is there an equivalent of rosrun roslaunch roslaunch args...?) Can you post example code?

lucasw gravatar image lucasw  ( 2016-01-20 17:33:19 -0500 )edit

I didn't try - I managed to do what I needed as an initial test launching and quiting individual nodes

nickw gravatar image nickw  ( 2016-01-21 14:27:21 -0500 )edit

answered 2015-02-15 09:18:00 -0500

Tom Moore gravatar image

I don't know if there's a ROS-prescribed way to run a launch file from within another ROS node. As for stopping all the nodes within a launch file, one way to do it is mark at least one of the nodes as required, e.g.,

<node pkg="rosbag" type="play" name="rosbagplay" args="test.bag" required="true"/>

If I put this in a launch file, then when rosbag exited after the bag file was done playing, all the nodes in that launch file would stop as well.

edit flag offensive delete link more


Is it possible to shut down other (from which the given node is not being launched) launch files too ?

malharjajoo gravatar image malharjajoo  ( 2018-04-01 19:27:42 -0500 )edit

answered 2016-01-22 11:48:43 -0500

lucasw gravatar image

I've put my method into the answer of this similar question, though it is possibly prone to breaking if and when roslaunch internals are altered:

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-02-15 06:55:03 -0500

Seen: 7,109 times

Last updated: Jan 22 '16