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

Properly Bring Down Active Node?

asked 2015-11-19 12:18:30 -0600

davelkan gravatar image

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-11-19 13:13:05 -0600

updated 2015-11-19 13:14:02 -0600

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.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-11-19 12:18:30 -0600

Seen: 735 times

Last updated: Nov 19 '15