Calling launch file from node during runtime
Hi all,
Based on some condition in node, I want to start and stop hector slam . (in parallel)
I had looked at different questions and rosspawn but couldn't figure it out.
if(start_node == true)
{
// start node in parallel
// Here my case is hector SLAM
}
if (stop_node == true)
{
// Stop the node
}
Any suggestions ?
thanks.
Edit ::
I found starting node in another package in python
code from Roslaunch-API Usage. I am looking for similar way in C++ also starting nodes with params and arguments.
import roslaunch
package = 'rqt_gui'
executable = 'rqt_gui'
node = roslaunch.core.Node(package, executable)
launch = roslaunch.scriptapi.ROSLaunch()
launch.start()
process = launch.launch(node)
print process.is_alive()
process.stop()