0
$\begingroup$

Rosanswers logo

Hi all,

Does anyone know is there c++ API that can help to shut down the whole ros instead of a node? What I want to do is I plan to use shell script for automating the simualtion in ros. I use roslaunch command for spawning the environment and drones. And run another c++ file (a node) for controller. However, I do not know how to stop ros when the controling algorithm is finished. If I use ros::shutdown(), I can only shutdown the controller node but the graphic interface is still here. So, does anyone here know any way to shut down the whole ros through c++ code?

Thanks


Originally posted by [email protected] on ROS Answers with karma: 31 on 2017-09-13

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

If you run everything from a single launch file, you can add the required="true" attribute to your controller node, which will cause roslaunch to stop all of the other nodes when your controller node exits.

See http://wiki.ros.org/roslaunch/XML/node for a more detailed description of all of the attributes to the <node> tag and what they do.


Originally posted by ahendrix with karma: 47576 on 2017-09-13

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by [email protected] on 2017-09-13:
Thanks, sir. This is exactly what I need. Appreciate that.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.