How to run launch file in c++ program
How to run launch file in c++ program
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
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
Asked: 2022-10-03 04:21:51 -0600
Seen: 136 times
Last updated: Oct 04 '22
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 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 Thanks for your supervision always. The answer has been added.