Skip to content

Scalable Networking for Industrial and Robotics with Zenoh on Raspberry Pi #2074

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

Merged
merged 12 commits into from
Jul 2, 2025
Merged
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
2 changes: 2 additions & 0 deletions assets/contributors.csv
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,6 @@ Gian Marco Iodice,Arm,,,,
Aude Vuilliomenet,Arm,,,,
Andrew Kilroy,Arm,,,,
Peter Harris,Arm,,,,
Chenying Kuo,Adlink,evshary,evshary,,
William Liang,,wyliang,,,
Waheed Brown,Arm,https://github.com/armwaheed,https://www.linkedin.com/in/waheedbrown/,,
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: Introduction to Zenoh
weight: 2

### FIXED, DO NOT MODIFY
layout: learningpathall
---

## The Need for Scalable Communication in Robotics and Edge Computing

Modern robotics and industrial IoT (IIoT) systems are evolving rapidly—from indoor collaborative arms on assembly lines to fleets of outdoor autonomous delivery robots.
These applications must operate in real-time, often across multiple compute nodes, over networks that may span factory LANs, 5G cellular links, or even cloud data centers.

Such systems require fast, reliable, and scalable data communication between nodes.
This includes not just broadcasting sensor updates or actuator commands (i.e., pub/sub), but also performing state queries, storing values for later use, and even distributed computation across nodes. A modern protocol must be:
* Low-latency: Immediate delivery of time-critical messages.
* High-throughput: Efficient data flow across many devices.
* Decentralized: No reliance on central brokers or fixed infrastructure.
* Flexible: Able to run on lightweight edge devices, across WANs, or inside cloud-native environments.

Traditional communication stacks such as DDS ([Data Distribution Service](https://en.wikipedia.org/wiki/Data_Distribution_Service)) serve as the backbone for middleware like ROS 2. However, DDS struggles in multi-network or wireless environments where multicast is unavailable, or NAT traversal is needed.
These constraints can severely impact deployment and performance at the edge.


## Zenoh: An Open-Source Pub/Sub Protocol for the Industrial Edge

[Eclipse Zenoh](https://zenoh.io/) is a modern, [open-source](https://github.com/eclipse-zenoh/zenoh) data-centric communication protocol that goes beyond traditional pub/sub. Designed specifically for edge computing, IIoT, robotics, and autonomous systems, Zenoh unifies:

* Data in motion through a powerful and efficient pub/sub model.
* Data at rest via geo-distributed storage plugins.
* Data in use with direct query support.
* On-demand computation via queryable nodes that can generate data dynamically.

Unlike most traditional stacks, Zenoh is fully decentralized and designed to operate across cloud-to-edge-to-thing topologies, making it ideal for industrial robotics, autonomous systems, and smart environments.
It supports heterogeneous platforms, is implemented in Rust for performance and safety, and also offers bindings for Python, enabling rapid prototyping.

Zenoh is particularly effective in wireless, 5G, or cross-network deployments where multicast and DDS fall short.
Its routing engine avoids excessive discovery traffic, conserves bandwidth, and supports seamless bridging between legacy ROS 2/DDS apps and modern, optimized Zenoh networks using zenoh-bridge-dds.

In this learning path, you’ll use Zenoh to build and validate a multi-node distributed communication system across multiple Arm-based platforms, gaining hands-on experience with data exchange and coordination between edge devices.

To make the upcoming demo more intuitive and easy to follow, we’ll demonstrate the setup using two physical Cortex-A Linux devices.

I’ll be using Raspberry Pi boards in this learning path, but you’re free to substitute them with any Cortex-A devices that support network connectivity with Linux-based OS installed, depending on your development setup.

In real-world ROS 2 deployment scenarios, developers typically conduct validation and performance testing across systems with more than two nodes.
To simulate such environments, using [Arm virtual hardware](https://www.arm.com/products/development-tools/simulation/virtual-hardware) is also a common and efficient approach.

This will help you quickly validate your architecture choices and communication patterns when designing distributed applications.

* Raspberry Pi,
* Linux-based Cortex-A, or
* Arm Virtual Hardware (AVH).

After this learning path, you will:
* Understand the core architecture and data flow principles behind Eclipse Zenoh, including its support for pub/sub, querying, and queryable edge functions.
* Build and run distributed Zenoh examples across multiple Arm-based nodes—using Raspberry Pi or AVH to simulate scalable deployment environments.
* Rebuild and extend the Zenoh queryable example to simulate edge-side logic.

By the end of this learning path, you’ll have deployed a fully functional, scalable, and latency-aware Zenoh system.

You can also check [here](https://zenoh.io/docs/getting-started/first-app) to find some simple examples.
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
---
title: Setting Up Zenoh on Arm Devices
weight: 3

### FIXED, DO NOT MODIFY
layout: learningpathall
---

## Setting Up Zenoh on Arm Devices

The following instructions are verified on both Raspberry Pi 4/5 and Arm Virtual Hardware, but you can implement them on any Cortex-A Linux device.

Before building Zenoh, make sure your system has the necessary development tools and runtime libraries.

### Install the Rust build environment

First, we need to install the [Rust](https://www.rust-lang.org/) build environment, since the core of Zenoh is totally developed using Rust to keep it safe and efficient.

Follow this [installation guide](https://learn.arm.com/install-guides/rust/) to install Rust and Cargo on Arm Linux, a build system for Rust. Or, simply use the following commands.

```bash
curl https://sh.rustup.rs -sSf | sh
```

Follow the prompts to complete the installation. If successful, you’ll see:

```output
Rust is installed now. Great!
```

For more details, refer to [Rust’s official install guide.](https://doc.rust-lang.org/cargo/getting-started/installation.html#install-rust-and-cargo)

### Install ROS 2

[Robot Operating System](https://www.ros.org/) is a set of software libraries and tools that help you build robot applications. From drivers to state-of-the-art algorithms, and with powerful developer tools, ROS has what you need for your next robotics project. And it's all open source.

Since ROS was started in 2007, a lot has changed in the robotics and ROS community. The goal of the [ROS 2](https://docs.ros.org/en/rolling/index.html) project is to adapt to these changes, leveraging what is great about ROS 1 and improving what isn’t.

Here is the quick [installation guide](https://learn.arm.com/install-guides/ros2/) about how to install ROS 2 in Arm platform.

### Download and build the Zenoh source

Now, we can clone the Zenoh.

```bash
cd ~
git clone https://github.com/eclipse-zenoh/zenoh.git
```

After that, simply use cargo to build the source.

```bash
cd zenoh
cargo build --release --all-targets -j $(nproc)
```

This will take several minutes depending on your device. Once the installation is complete, you should see:

```output
cargo build --release --all-targets -j $(nproc)
Updating crates.io index
Downloaded humantime v2.2.0
Downloaded spin v0.10.0
Downloaded crossbeam-channel v0.5.14
Downloaded uhlc v0.8.1
Downloaded 4 crates (182.5 KB) in 2.19s
warning: output filename collision.
The lib target `zenoh_plugin_storage_manager` in package `zenoh-plugin-storage-manager v1.4.0 (/home/ubuntu/zenoh/plugins/zenoh-plugin-storage-manager)` has the same output filename as the lib target `zenoh_plugin_storage_manager` in package `zenoh-plugin-storage-manager v1.4.0 (/home/ubuntu/zenoh/plugins/zenoh-plugin-storage-manager)`.
Colliding filename is: /home/ubuntu/zenoh/target/release/deps/libzenoh_plugin_storage_manager.so
The targets should have unique names.
Consider changing their names to be unique or compiling them separately.
This may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>.
warning: output filename collision.
The lib target `zenoh_plugin_storage_manager` in package `zenoh-plugin-storage-manager v1.4.0 (/home/ubuntu/zenoh/plugins/zenoh-plugin-storage-manager)` has the same output filename as the lib target `zenoh_plugin_storage_manager` in package `zenoh-plugin-storage-manager v1.4.0 (/home/ubuntu/zenoh/plugins/zenoh-plugin-storage-manager)`.
Colliding filename is: /home/ubuntu/zenoh/target/release/deps/libzenoh_plugin_storage_manager.so.dwp
The targets should have unique names.
Consider changing their names to be unique or compiling them separately.
This may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>.
warning: output filename collision.
The lib target `zenoh_plugin_storage_manager` in package `zenoh-plugin-storage-manager v1.4.0 (/home/ubuntu/zenoh/plugins/zenoh-plugin-storage-manager)` has the same output filename as the lib target `zenoh_plugin_storage_manager` in package `zenoh-plugin-storage-manager v1.4.0 (/home/ubuntu/zenoh/plugins/zenoh-plugin-storage-manager)`.
Colliding filename is: /home/ubuntu/zenoh/target/release/deps/libzenoh_plugin_storage_manager.rlib
The targets should have unique names.
Consider changing their names to be unique or compiling them separately.
This may become a hard error in the future; see <https://github.com/rust-lang/cargo/issues/6313>.
Compiling proc-macro2 v1.0.86
Compiling unicode-ident v1.0.13
Compiling libc v0.2.158
Compiling version_check v0.9.5
Compiling autocfg v1.3.0
...
Compiling zenoh-link-quic v1.4.0 (/home/ubuntu/zenoh/io/zenoh-links/zenoh-link-quic)
Compiling zenoh_backend_traits v1.4.0 (/home/ubuntu/zenoh/plugins/zenoh-backend-traits)
Compiling zenoh-plugin-storage-manager v1.4.0 (/home/ubuntu/zenoh/plugins/zenoh-plugin-storage-manager)
Compiling zenoh-ext v1.4.0 (/home/ubuntu/zenoh/zenoh-ext)
Compiling zenoh-ext-examples v1.4.0 (/home/ubuntu/zenoh/zenoh-ext/examples)
Compiling zenoh-plugin-example v1.4.0 (/home/ubuntu/zenoh/plugins/zenoh-plugin-example)
Compiling zenoh-backend-example v1.4.0 (/home/ubuntu/zenoh/plugins/zenoh-backend-example)
Finished `release` profile [optimized] target(s) in 6m 28s
```

After the build process, the binary executables will be stored under the directory of `~/zenoh/target/release/examples/`.

{{% notice Note %}}
Installation time may vary depending on your device’s processing power.
{{% /notice %}}

With Zenoh successfully compiled, you’re ready to explore how nodes communicate using the Zenoh runtime.
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
title: Setting Up a Multi-Node Environment
weight: 4

### FIXED, DO NOT MODIFY
layout: learningpathall
---

## Deploying Zenoh on Multiple Raspberry Pi Devices Using Docker

After building Zenoh and its core examples, your next step is to deploy them across multiple Arm-based devices.

In this session, you’ll use Raspberry Pi boards to simulate a scalable, distributed environment—but the same workflow applies to any Arm Linux system, including Arm cloud instances and Arm Virtual Hardware.

You’ll learn how to use Docker to deploy the environment on physical devices, and how to duplicate virtual instances using snapshot cloning on Arm Virtual Hardware.

This setup lets you simulate `real-world`, `cross-node communication`, making it ideal for validating Zenoh’s performance in robotics and industrial IoT use cases.

### Install Docker on Raspberry Pi

To simplify this process and ensure consistency, you’ll use Docker to containerize your Zenoh and ROS 2 environment.
This lets you quickly replicate the same runtime on any device without needing to rebuild from source.

This enables multi-node testing and real-world distributed communication scenarios.

First, install the docker environment on each of Raspberry Pi if you don't have that.

```bash
curl -sSL https://get.docker.com | sh
sudo usermod -aG docker pi
```

Log out and back in, or run newgrp docker to activate Docker group permissions.

### Create a ROS 2 + DDS Docker Image

In a working directory, create a `Dockerfile` with the following content to create the ROS 2 / DDS docker image.

```bash
FROM ros:galactic
RUN apt-get update
RUN apt-get install -y ros-galactic-demo-nodes-cpp ros-galactic-rmw-cyclonedds-cpp ros-galactic-turtlesim
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
CMD bash
```

Under the directory where the above Dockerfile exists, run the following command to generate the docker image.

```bash
$ docker build -t zenoh-node .
```

After this has been done, the created ROS 2 docker image can be seen by the following command.

```bash
$ docker images | grep zenoh-node
```

```output
zenoh-node latest b7a9c27cf8a8 About a minute ago 962MB
```

### Transfer the Docker Image on Another RPi

You now need to transfer the Docker image to your second device. Choose one of the following methods:

You have two options:

Option 1: Save and copy via file

```bash
docker save zenoh-node > zenoh-node.tar
scp zenoh-node.tar pi@<target_ip>:/home/pi/
```

On the target device:
```bash
docker load < zenoh-node.tar
```

Option 2: Push to a container registry (e.g., DockerHub or GHCR).

You can also push the image to Docker Hub or GitHub Container Registry and pull it on the second device.

### Run the Docker Image

Once the image is successfully loaded into second device, you can run the container by

```bash
docker run -it --network=host zenoh-node
```

Now, all the Zenoh example binaries are now available within this container, allowing you to test pub/sub and query flows across devices.

### Another Duplicate Setting Option on Arm Virtual Hardware

If you have [Corellium](https://www.corellium.com/) account, you can

1. Set up and install Zenoh on a single AVH instance.
2. Use the [Clone](https://support.corellium.com/features/snapshots) function to duplicate the environment.
3. Optionally, you may optionally rename the device to avh* for easy device recognition by changing the setting in the `/etc/hostname` file.

## Run Zenoh in Multi-Node Environment

You’re now ready to run and test Zenoh communication flows across distributed edge devices.

The source of the examples written in Rust will be provided, and both are interoperable. The
Rust binaries are already available under: `$ZENOH_LOC/target/release/examples/` directory.

The following sections illustrate the procedures to run the Zenoh examples so as to demonstrate the primary capabilities of Zenoh
1. Basic Pub/Sub – for real-time message distribution
2. Query and Storage – to persist and retrieving historical data
3. Queryable – to enable on-demand remote computation
4. Dynamic Queryable with Computation
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
title: Zenoh Example-1 Simple Pub/Sub
weight: 5

### FIXED, DO NOT MODIFY
layout: learningpathall
---

## Example 1: Simple Pub/Sub

This first test demonstrates Zenoh’s real-time publish/subscribe model using two Raspberry Pi devices.

The following command is to initiate a subscriber for a key expression `demo/example/**`, i.e. a set of topics starting with the path `demo/example`.

### Step 1: Run Subscriber

Log in to Pi using any of the methods:

```bash
cd ~/zenoh/target/release/examples
./z_sub
```

### Step 2: Run Publisher

Then, log in to another machine Pi.

```bash
cd ~/zenoh/target/release/examples
./z_pub
```

The result will look like:
![img1 alt-text#center](zenoh_ex1.gif "Figure 1: Simple Pub/Sub")

In the left-side window, I have logged into the device Pi4 and run the z_sub program.
It receives values with the key `demo/example/zenoh-rs-pub` continuously published by z_pub running on Pi in the right-side window.

This basic example shows Zenoh’s zero-config discovery and low-latency pub/sub across physical nodes.
Loading