-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
canTransform() with timeout while unloading nodelet with paused time -> freeze #381
Comments
I don't have a good idea of how to resolve this we don't have a good signaling mechanism to say when to stop waiting. I think that your custom wrapper which interjects the additional check for a nodelet shutdown flag is likely going to be the best approach in the short term. Other approaches might be to force a time update on unload, but I don't think that you can do that without effecting other parts of the system. But a clock publisher that jumped time briefly so that the timeout would clear would work to allow arbitrary nodelets to shutdown without code changes. |
I've created a mixin called class StatefulNodelet
{
public:
virtual ~StatefulNodelet() { this->shutdown(); }
/**
* \brief Similar to ros::ok(). Becomes false when nodelet unload is requested.
* \return Whether it is ok to continue nodelet operations.
*/
bool ok() const { return !this->isUnloading; }
protected:
void shutdown() { this->isUnloading = true; }
private:
bool isUnloading = false;
}; If the user adds this mixin to his/her nodelet implementations, it is then possible to use an adapted TF2 buffer which checks the |
This issue has been mentioned on ROS Discourse. There might be relevant details there: https://discourse.ros.org/t/my-ros2-minimal-examples-difficulties-coming-from-ros1/18705/7 |
PR in nodelet_core created: ros/nodelet_core#116 |
I have a nodelet which periodically calls
canTransform()
with timeout in a separate thread on a TF2 ROS buffer.When I'm replaying a bag file and pause it, the
canTransform()
call (correctly) hangs until I unpause the playback. However, if I want to unload the nodelet while the bag is paused, it never unloads because thecanTransform()
call is still hanged.For nodes, this was already solved in #26 . However, in nodelet case, there is nothing like
ros:ok()
to check for shutdown requests.What can I do to mitigate this behavior?
Until this is resolved, I think I'll write my own helper
Nodelet::canTransform()
doing the waiting loop itself and checking for some unload/stop flag.The text was updated successfully, but these errors were encountered: