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

Start a launch file via cpp

asked 2020-01-08 14:38:37 -0500

jere gravatar image

Hey guys,

is there a way to start a launch file via c++ in a node?

In my case, I have an Actionserver (actionlib) and want to be able to start a few other nodes as a goal. But since these other nodes that I want to start on demand are changed pretty often, I want to store them in a separate file and I thought, a launch file should do the trick.

Any ideas?

edit retag flag offensive close merge delete


It would seem harsh, but I'm almost inclined to close your post. Reason: there are many Q&As about this exact topic and quite a few of them include usable code.

Could I ask you to first try using Google to search for older Q&As? Append to your query. That should return quite some results.

gvdhoorn gravatar image gvdhoorn  ( 2020-01-09 01:52:54 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-01-15 01:32:19 -0500

harumo11 gravatar image

Could you try following code?

#include <cstdlib>
std::system("roslaunch your_package your_node");

std::system allow you to pass its arguments to terminal.

edit flag offensive delete link more


It worked for me. I've got the same question. Thank you.

Lennart gravatar image Lennart  ( 2020-04-28 08:41:13 -0500 )edit

Question Tools

1 follower


Asked: 2020-01-08 14:36:55 -0500

Seen: 947 times

Last updated: Jan 15 '20