Skip to content
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

Update documentation to install binaries and connect to multiple hosts #443

Merged
merged 12 commits into from
Feb 6, 2025
44 changes: 28 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ For information about the Design please visit [design](docs/design.md) page.

> Note: See available distro branches, eg. `jazzy`, for supported ROS 2 distributions.

## Setup
## Installation
Options for installing `rmw_zenoh`
PaulBouchier marked this conversation as resolved.
Show resolved Hide resolved

Build `rmw_zenoh_cpp`
### Binary Packages
PaulBouchier marked this conversation as resolved.
Show resolved Hide resolved
Binary packages are available for Tier-1 operating systems. Install `ros-<DISTRO>-rmw-zenoh-cpp`. Replace
`<DISTRO>` with the ROS distro into which the packages should be installed.
PaulBouchier marked this conversation as resolved.
Show resolved Hide resolved

### Building rmw_zenoh_cpp from source
PaulBouchier marked this conversation as resolved.
Show resolved Hide resolved

>Note: By default, we vendor and compile `zenoh-cpp` with a subset of `zenoh` features.
The `ZENOHC_CARGO_FLAGS` CMake argument may be overwritten with other features included if required.
Expand All @@ -32,22 +37,13 @@ source /opt/ros/<DISTRO>/setup.bash
colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
```

## Test

Make sure to source the built workspace using the commands below prior to running any other commands.
```bash
cd ~/ws_rmw_zenoh
source install/setup.bash
```

### Start the Zenoh router
> Note: Manually launching Zenoh router won't be necessary in the future.
```bash
# terminal 1
ros2 run rmw_zenoh_cpp rmw_zenohd
```

> Note: Without the Zenoh router, nodes will not be able to discover each other since multicast discovery is disabled by default in the node's session config. Instead, nodes will receive discovery information about other peers via the Zenoh router's gossip functionality. See more information on the session configs [below](#configuration).
## Test

### Terminate ROS 2 daemon started with another RMW
```bash
Expand All @@ -57,6 +53,15 @@ Without this step, ROS 2 CLI commands (e.g. `ros2 node list`) may
not work properly since they would query ROS graph information from the ROS 2 daemon that
may have been started with different a RMW.

### Start the Zenoh router
> Note: Manually launching Zenoh router won't be necessary in the future.
```bash
# terminal 1
ros2 run rmw_zenoh_cpp rmw_zenohd
```

> Note: Without the Zenoh router, nodes will not be able to discover each other since multicast discovery is disabled by default in the node's session config. Instead, nodes will receive discovery information about other peers via the Zenoh router's gossip functionality. See more information on the session configs [below](#configuration).

### Run the `talker`
```bash
# terminal 2
Expand Down Expand Up @@ -111,17 +116,24 @@ export ZENOH_ROUTER_CONFIG_URI=$HOME/MY_ZENOH_ROUTER_CONFIG.json5
```

### Connecting multiple hosts
By default, all discovery traffic is local per host, where the host is the PC running a `Zenoh router`.
To bridge communications across two hosts, the `Zenoh router` configuration for one the hosts must be updated to connect to the other `Zenoh router` at startup.
This is done by specifying an endpoint in host's `Zenoh router` configuration file to as seen below.
In this example, the `Zenoh router` will connect to the `Zenoh router` running on a second host with IP address `192.168.1.1` and port `7447`.
By default, all discovery traffic is local per host, where the host is the computer running a `Zenoh router`,
and each host in a multiple-host system runs a `Zenoh router`.
To bridge communications across two hosts, the `Zenoh router` configuration for one of the hosts must be
updated to connect to the other host's `Zenoh router` at startup.
This is done by setting the `ZENOH_ROUTER_CONFIG_URI` environment variable in one of the hosts to point to a
modified `Zenoh router` configuration file which specifies an endpoint that the other host's `Zenoh router` is
is listening on.

Make a copy of [DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5]( rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_ROUTER_CONFIG.json5) and modify the `connect` block to include the endpoint of the other `Zenoh router`. For example, if the other `Zenoh router` is listening on IP address `192.168.1.1` and port `7447` on its host, modify config file to connect to this router as shown below:

```json5
.... preceding parts of file
{
connect: {
endpoints: ["tcp/192.168.1.1:7447"],
},
}
.... following parts of file
```

> Note: To connect multiple hosts, include the endpoints of all `Zenoh routers` in the network.
Expand Down