0
$\begingroup$

Rosanswers logo

I'm currently using ros::shutdown() to bring down a node that I need to kill in c++. I'm fairly certain this is bad as the node fails ungracefully and does not seem to release all of its resources. Is there a better method?


Originally posted by davelkan on ROS Answers with karma: 71 on 2015-11-19

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Likely what you want to do is create a custom SIGINT handler that releases whatever resources are not properly being released. This function will then get called whenever your node receives the SIGINT signal (e.g. when someone presses Ctrl+C) or when you call ros::shutdown(). A simple example is on the roscpp Initialization and Shutdown page. Also check out this question/answer.


Originally posted by jarvisschultz with karma: 9031 on 2015-11-19

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

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