ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

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
1

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

I just noticed this which does what I need

http://wiki.ros.org/roslaunch/API%20U...

edit flag offensive delete link more

Comments

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
3

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

Comments

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
0

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: http://answers.ros.org/question/10493...

edit flag offensive delete link more

Question Tools

1 follower

Stats

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

Seen: 9,520 times

Last updated: Jan 22 '16