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

How to run launch file in c++ program

asked 2022-10-03 04:21:51 -0600

ROS_Practicer gravatar image

How to run launch file in c++ program

edit retag flag offensive close merge delete

Comments

1

I feel really uncomfortable while reading this question. Because I think it is not the right way to run a launch file. Launch files are designed to run nodes (C++/python). Anyways, I found a similar question #q341272

ravijoshi gravatar image ravijoshi  ( 2022-10-03 04:36:44 -0600 )edit

@ravijoshi I think you should make your comment the answer.

@ROS_Practicer If you try this, you're also going to have to make sure that the setup.bash environment variables are all set properly.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-10-03 10:32:14 -0600 )edit

@Mike Scheutzow Thanks for your supervision always. The answer has been added.

ravijoshi gravatar image ravijoshi  ( 2022-10-04 00:55:57 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-10-04 00:54:57 -0600

ravijoshi gravatar image

I feel really uncomfortable while reading this question. Because I think it is not the right way to run a launch file. Launch files are designed to run nodes (C++/python). Anyways, I found a similar question #q341272

Below is the answer:

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

Finally, as @Mike Scheutzow said that ROS environment variables must be set up correctly before running the above code. Therefore, please source the setup.bash

edit flag offensive delete link more

Question Tools

Stats

Asked: 2022-10-03 04:21:51 -0600

Seen: 136 times

Last updated: Oct 04 '22