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 -0600

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 -0600

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 imagelucasw ( 2016-01-20 17:33:19 -0600 )edit

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

nickw gravatar imagenickw ( 2016-01-21 14:27:21 -0600 )edit
3

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

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 imagemalharjajoo ( 2018-04-01 19:27:42 -0600 )edit
0

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

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

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

Stats

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

Seen: 4,861 times

Last updated: Jan 22 '16