Roscore force unregister of node that died
Hi!
I believe I'm running into a situation in a multi machine setup.
Setup
- Machine running rosmaster
- Second machine that's properly setup to recognize the machine running roscore
What I believe I'm observing sometimes is that if I forcibly kill the second machine (for example, disconnect the power), since the ros::shutdown() is not called the roscore still thinks that the node is there and lists it.
Is there any way I can force roscore to kill the topic that is connected to the node that doesn't exist anymore?
Since I'm using anonymous node names (and I have to do it in my case) is that if I forcibly reset my slave computer I will end up with a rosnode list showing two topics, one of which is not connected to anything.
Any tips how to handle it neatly would be highly appreciated!
Asked by msadowski on 2018-09-18 13:23:58 UTC
Answers
After thinking about it for some time and doing some experiments I decided unregistering a node is a bad idea in my case (it seems you can create quite a lot of trouble if a node is not available because for example the network is down for a second).
What I found to be a great alternative without a brute force approach is node_alive package that allows me to keep track of nodes that are see as alive. Then I can use this information to keep track of 'pingable' nodes and use them accordingly in my setup.
Asked by msadowski on 2018-10-04 02:37:16 UTC
Comments
rosmaster doesn't have any timeout for nodes if they crash, so it will keep remembering them until a new node starts with the same name. I'm pretty sure this isn't a new issue, but I can't find a bug report for it.
Asked by ahendrix on 2018-09-18 14:16:52 UTC
Related Q&As: #q9521 and #q285530.
Asked by gvdhoorn on 2018-09-18 15:23:07 UTC
rosnode cleanup
should do the trick.Asked by Choco93 on 2018-09-19 01:21:37 UTC
Thanks for the helpful comments! I figured a better approach than force unregistering the node. Instead in my case it's sufficient to use node_alive and keep track of alive nodes
Asked by msadowski on 2018-10-04 02:27:20 UTC
Wondering how this compares to bond (at least in C++).
Asked by gvdhoorn on 2018-10-04 02:31:37 UTC