ros2 / rmw_zenoh

RMW for ROS 2 using Zenoh as the middleware
Apache License 2.0
142 stars 29 forks source link

Revisit how and when to start the Zenoh router #231

Open clalancette opened 3 days ago

clalancette commented 3 days ago

There are a couple of different things we can do here:

  1. Assume that the router is already running. This is what we currently do. This has the benefit of being relatively easy to do for rmw_zenoh_cpp. It is also nice if the user wants to run zenohd on their own, through systemd or another management system. However, this means that things don't "just work" out-of-the-box, like they do with the DDS RMWs. This essentially gets us back to a system that looks similar to ROS 1 with the roscore.
  2. Attempt to contact the router, and launch one if we cannot contact it. This has the benefit of "just working" for those who don't know anything about the system. However, implementing this is fraught with peril. While we certainly could come up with a fork/exec pattern on Linux, launching it on Windows is going to be harder. Also, managing the lifetime of that separate zenohd process is unclear. Should it go away when the node that launched it goes away? When the last local user goes away? What system is responsible for killing it off (since it may be the case that the thing that launched it has gone away by this time)? What about race conditions between multiple nodes starting up at the same time and trying to create multiple zenohd routers?
Timple commented 3 days ago

I like the auto launch idea. Not having to start the master is one of the few things that did not get more complicated after the migration 😄

Although we don't want to end up with a situation like the ros2-daemon. It starts by itself (ok), but the configuration might be outdated (nok). Leading to tutorials to always kill it just in case...

Regarding cleanup: a self destruct if no clients are connected (for 5s) perhaps?