Possible for a node to "refresh" information with rosmaster?
The basic scenario I would like to avoid
- Start roscore
- Start node A subscribing to topic B
- Kill roscore and restart roscore
- Start node B publishing topic B Result: Node A has not registered its subscription to topic B with the new roscore instance, and so no connection will be made with node B and node A will not get messages on topic B
Running into this problem when I have diagnostic nodes (e.g., rqt_plot) which I have to restart everytime I kill a roslaunch file. The not-so-great solution is to just spawn roscore in the background and hope that it never dies for any reason.
Is there a way to get a node to periodically refresh it's connection with rosmaster so that it rosmaster restarted it would (eventually) get the pub/sub information from that node and could make the proper connections?
Asked by zqpm on 2017-06-13 09:48:39 UTC
Answers
The main responsibility of ros core is to maintain a list of connection between nodes. If a node is registered to a dead roscore, new node will not be able to find it. However, the already existing connected topics will stay functional. I personally have created a systemd service for roscore. You can make the systemd service to restart roscore automatically if it dies. Personally I never seen roscore crash. I believe it is not possible for a node to "refresh" with the new roscore.
Asked by hank880907 on 2023-07-05 01:51:46 UTC
Comments
Why do you want to kill the roscore? I normally run it in a tmux-session so that is also does not need it's own terminal window.
Asked by NEngelhard on 2017-06-14 02:06:36 UTC
I don't, but shit happens. To quote: The not-so-great solution is to just spawn roscore in the background and hope that it never dies for any reason
Asked by zqpm on 2017-06-14 07:45:10 UTC
I've never seen the roscore crash. That's why I wonder why you want to protect yourself against it.
Asked by NEngelhard on 2017-06-14 08:04:08 UTC
Consider yourself lucky then.
Asked by zqpm on 2017-06-14 08:56:16 UTC