What difference between ros::shutdown() and ros::requestShutdown() ?
When I have to use ros::shutdown()
and when I have to use ros::requestShutdown()
?
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
When I have to use ros::shutdown()
and when I have to use ros::requestShutdown()
?
From the documentation:
void ros::requestShutdown ( )
Request that the node shut itself down from within a ROS thread. This method signals a ROS thread to call shutdown().
void ros::shutdown( )
Disconnects everything and unregisters from the master. It is generally not necessary to call this function, as the node will automatically shutdown when all NodeHandles destruct. However, if you want to break out of a spin() loop explicitly, this function allows that.
From the definition:
the
requestShutdown()
just sets a global bool (g_shutdown_requested
) to true, which is later processed in thecheckForShutdown()
method which runs from within a mutex inside a PollManager. The point is to prevent from deadlocking with another thread that's already in the middle of shutdown()
Asked: 2020-02-13 05:41:07 -0500
Seen: 762 times
Last updated: Feb 13 '20
Subscriber and Publisher node at once in cpp
how does second term of advertise
How do I test the ROS version in C++ code?
Getting all parameter names using C++
Are there any other signal interrupts with roscpp besides the default ctrl+c sigint handler
Is it possible to avoid busy-waiting in a spinner? [closed]
Can I "overload" topic names in ROS? (Different versions by datatype)