Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions demo/cyclonedds-uri/.env.template
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
JOINCODE=fc94:b01d:1803:8dd8:b293:5c7d:7639:932a/xxxxxxxxxxxxxxxxxx # get from app.husarnet.com and rename to .env

# uncomment to choose ROS 2 Jazzy
CHOOSEN_ROS=jazzy
CHOSEN_ROS=jazzy
CYCLONE_SYNTAX=new

# uncomment to choose ROS 2 Humble
# CHOOSEN_ROS=humble
# CHOSEN_ROS=humble
# CYCLONE_SYNTAX=new

# uncomment to choose ROS 2 Foxy
# CHOOSEN_ROS=foxy
# CHOSEN_ROS=foxy
# CYCLONE_SYNTAX=old
2 changes: 1 addition & 1 deletion demo/cyclonedds-uri/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
build:
context: .
args:
- ROS_DISTRO=${CHOOSEN_ROS:-jazzy} # CHOOSEN_ROS because ROS_DISTRO is already set in host environment
- ROS_DISTRO=${CHOSEN_ROS:-jazzy} # CHOSEN_ROS because ROS_DISTRO is already set in host environment
network_mode: service:husarnet
depends_on:
husarnet: { condition: service_healthy } # husarnet service is healthy if all hosts listed in WAIT_HOSTNAMES are reachable
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
JOINCODE=fc94:b01d:1803:8dd8:b293:5c7d:7639:932a/xxxxxxxxxxxxxxxxxx # get from app.husarnet.com and rename to .env

# uncomment to choose ROS 2 Jazzy
CHOOSEN_ROS=jazzy
CHOSEN_ROS=jazzy

# uncomment to choose ROS 2 Humble
# CHOOSEN_ROS=humble
# CHOSEN_ROS=humble

# uncomment to choose ROS 2 Foxy
# CHOOSEN_ROS=foxy
# CHOSEN_ROS=foxy
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
build:
context: .
args:
- ROS_DISTRO=${CHOOSEN_ROS:-jazzy} # CHOOSEN_ROS because ROS_DISTRO is already set in host environment
- ROS_DISTRO=${CHOSEN_ROS:-jazzy} # CHOSEN_ROS because ROS_DISTRO is already set in host environment
network_mode: service:husarnet
depends_on:
husarnet: { condition: service_healthy } # husarnet service is healthy if all hosts listed in WAIT_HOSTNAMES are reachable
Expand Down
6 changes: 3 additions & 3 deletions demo/fastrtps-default-profiles-file/simple/.env.template
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
JOINCODE=fc94:b01d:1803:8dd8:b293:5c7d:7639:932a/xxxxxxxxxxxxxxxxxx # get from app.husarnet.com and rename to .env

# uncomment to choose ROS 2 Jazzy
CHOOSEN_ROS=jazzy
CHOSEN_ROS=jazzy

# uncomment to choose ROS 2 Humble
# CHOOSEN_ROS=humble
# CHOSEN_ROS=humble

# uncomment to choose ROS 2 Foxy
# CHOOSEN_ROS=foxy
# CHOSEN_ROS=foxy
2 changes: 1 addition & 1 deletion demo/fastrtps-default-profiles-file/simple/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
build:
context: .
args:
- ROS_DISTRO=${CHOOSEN_ROS:-jazzy} # CHOOSEN_ROS because ROS_DISTRO is already set in host environment
- ROS_DISTRO=${CHOSEN_ROS:-jazzy} # CHOSEN_ROS because ROS_DISTRO is already set in host environment
network_mode: service:husarnet
depends_on:
husarnet: { condition: service_healthy } # husarnet service is healthy if all hosts listed in WAIT_HOSTNAMES are reachable
Expand Down
4 changes: 2 additions & 2 deletions demo/husarnet-dds/cyclonedds/.env.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
JOINCODE=fc94:b01d:1803:8dd8:b293:5c7d:7639:932a/xxxxxxxxxxxxxxxxxx # get from app.husarnet.com and rename to .env

# uncomment to choose ROS 2 Humble
CHOOSEN_ROS=humble
CHOSEN_ROS=humble

# uncomment to choose ROS 2 Foxy
# CHOOSEN_ROS=foxy
# CHOSEN_ROS=foxy
2 changes: 1 addition & 1 deletion demo/husarnet-dds/cyclonedds/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
build:
context: .
args:
- ROS_DISTRO=${CHOOSEN_ROS:-jazzy} # CHOOSEN_ROS because ROS_DISTRO is already set in host environment
- ROS_DISTRO=${CHOSEN_ROS:-jazzy} # CHOSEN_ROS because ROS_DISTRO is already set in host environment
network_mode: service:husarnet
depends_on:
husarnet: { condition: service_healthy } # husarnet service is healthy if all hosts listed in WAIT_HOSTNAMES are reachable
Expand Down
4 changes: 2 additions & 2 deletions demo/husarnet-dds/discovery-server/.env.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
JOINCODE=fc94:b01d:1803:8dd8:b293:5c7d:7639:932a/xxxxxxxxxxxxxxxxxx # get from app.husarnet.com and rename to .env

# uncomment to choose ROS 2 Humble
CHOOSEN_ROS=humble
CHOSEN_ROS=humble

# uncomment to choose ROS 2 Foxy
# CHOOSEN_ROS=foxy
# CHOSEN_ROS=foxy
2 changes: 1 addition & 1 deletion demo/husarnet-dds/discovery-server/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
build:
context: .
args:
- ROS_DISTRO=${CHOOSEN_ROS:-jazzy} # CHOOSEN_ROS because ROS_DISTRO is already set in host environment
- ROS_DISTRO=${CHOSEN_ROS:-jazzy} # CHOSEN_ROS because ROS_DISTRO is already set in host environment
network_mode: service:husarnet
depends_on:
husarnet: { condition: service_healthy } # husarnet service is healthy if all hosts listed in WAIT_HOSTNAMES are reachable
Expand Down
4 changes: 2 additions & 2 deletions demo/husarnet-dds/simple-fastdds/.env.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
JOINCODE=fc94:b01d:1803:8dd8:b293:5c7d:7639:932a/xxxxxxxxxxxxxxxxxx # get from app.husarnet.com and rename to .env

# uncomment to choose ROS 2 Humble
CHOOSEN_ROS=humble
CHOSEN_ROS=humble

# uncomment to choose ROS 2 Foxy
# CHOOSEN_ROS=foxy
# CHOSEN_ROS=foxy
2 changes: 1 addition & 1 deletion demo/husarnet-dds/simple-fastdds/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
build:
context: .
args:
- ROS_DISTRO=${CHOOSEN_ROS:-humble} # CHOOSEN_ROS because ROS_DISTRO is already set in host environment
- ROS_DISTRO=${CHOSEN_ROS:-humble} # CHOSEN_ROS because ROS_DISTRO is already set in host environment
network_mode: service:husarnet
depends_on:
husarnet: { condition: service_healthy } # husarnet service is healthy if all hosts listed in WAIT_HOSTNAMES are reachable
Expand Down
8 changes: 8 additions & 0 deletions demo/zenoh/multicast-discovery/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# uncomment to choose ROS 2 Jazzy
CHOSEN_ROS=jazzy

# uncomment to choose ROS 2 Humble
# CHOSEN_ROS=humble

# uncomment to choose ROS 2 Foxy
# CHOSEN_ROS=foxy
8 changes: 8 additions & 0 deletions demo/zenoh/multicast-discovery/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ARG ROS_DISTRO=jazzy

FROM ros:${ROS_DISTRO}-ros-core

RUN apt update && apt install -y \
ros-${ROS_DISTRO}-rmw-zenoh-cpp \
ros-${ROS_DISTRO}-demo-nodes-cpp && \
rm -rf /var/lib/apt/lists/*
41 changes: 41 additions & 0 deletions demo/zenoh/multicast-discovery/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Using Zenoh RMW with `scouting/multicast/enabled=true`

This demo illustrates how to connect ROS nodes scattered over multiple hosts using the Zenoh middleware without the need to setup a Zenoh router.

Please be aware that multicast discovery is disabled by default for important reasons. See the [excerpt from Zenoh RMW's design documentation](https://github.com/ros2/rmw_zenoh/blob/rolling/docs/design.md#brief-overview) below:

> The UDP Multicast Scouting is disabled by default. The decision to not rely on UDP multicast for discovery was intentional, aimed at avoiding issues with misconfigured networks, operating systems, or containers. It also helps prevent uncontrolled communication between robots in the same LAN, which could lead to interferences if not properly configured with different ROS_DOMAIN_ID or namespaces.

Husarnet is not used in this demo, as at the time of writing, Husarnet does not support multicast connections. Instead, the demo uses a Docker network to simulate a LAN where multicast discovery can be tested.

There are two hosts, `talker-host` and `listener-host`, both connected using a Docker network, `zenoh-multicast-discovery-net`:
- `talker-host` runs a talker node that scouts for peers using multicast on all available network interfaces
- `listener-host` runs a listener node that scouts for peers using multicast on all available network interfaces

For more information about enabling multicast discovery, [see here.](https://github.com/ros2/rmw_zenoh?tab=readme-ov-file#examples)

For more information about the general Zenoh RMW setup, [visit the project repository.](https://github.com/ros2/rmw_zenoh)

Please note that the provided `rmw-zenoh-session.json5` config file is an unmodified copy of the default config from Zenoh RMW repository.

## Basic Setup

Create a `.env` file based on the `.env.template` as a reference. There you can change the ROS distribution by setting `CHOSEN_ROS=jazzy`.

### Creating a Network

```bash
docker network create zenoh-multicast-discovery-net
```

### Running the Talker

```bash
CHATTER_ROLE=talker docker compose up --build --force-recreate
```

### Running the Listener

```bash
CHATTER_ROLE=listener docker compose up --build --force-recreate
```
24 changes: 24 additions & 0 deletions demo/zenoh/multicast-discovery/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: ${CHATTER_ROLE:-talker}-zenoh

networks:
zenoh-multicast-discovery-net:
external: true

services:
chatter:
build:
context: .
args:
- ROS_DISTRO=${CHOSEN_ROS:-jazzy}
networks:
- zenoh-multicast-discovery-net
volumes:
- ./rmw-zenoh-session.json5:/var/tmp/rmw-zenoh-session.json5
environment:
- RMW_IMPLEMENTATION=rmw_zenoh_cpp
- ZENOH_SESSION_CONFIG_URI=/var/tmp/rmw-zenoh-session.json5
- ZENOH_CONFIG_OVERRIDE=listen/endpoints=["tcp/0.0.0.0:0"];scouting/multicast/enabled=true
# ^ IMPORTANT: This line specifies that nodes should scout for peers using multicast discovery on all network interfaces.
- ZENOH_ROUTER_CHECK_ATTEMPTS=-1
# ^ IMPORTANT: This line specifies that the nodes should not attempt to find the router.
command: ros2 run demo_nodes_cpp ${CHATTER_ROLE:-talker}
Loading