diff --git a/content/learning-paths/cross-platform/zenoh-multinode-ros2/1_intro-zenoh.md b/content/learning-paths/cross-platform/zenoh-multinode-ros2/1_intro-zenoh.md index 5e1595325a..3b46ee7423 100644 --- a/content/learning-paths/cross-platform/zenoh-multinode-ros2/1_intro-zenoh.md +++ b/content/learning-paths/cross-platform/zenoh-multinode-ros2/1_intro-zenoh.md @@ -1,12 +1,12 @@ --- -title: Introduction to Zenoh +title: Build scalable communication systems with Eclipse Zenoh weight: 2 ### FIXED, DO NOT MODIFY layout: learningpathall --- -## The Need for Scalable Communication in Robotics and Edge Computing +## The need for scalable communication in robotics and edge computing Modern robotics and industrial IoT 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. @@ -15,36 +15,34 @@ Such systems require fast, reliable, and scalable data communication between nod This includes not just broadcasting sensor updates or actuator commands (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. +* 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 Data Distribution Service (DDS) 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. +Traditional communication stacks such as Data Distribution Service (DDS) 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. Zenoh was developed to address these challenges with a unified approach to data movement, storage, and interaction across heterogeneous, distributed systems. - -## Zenoh: an open-source pub/sub protocol for the Industrial Edge +## What is Zenoh? A scalable pub/sub protocol for the industrial edge [Eclipse Zenoh](https://zenoh.io/) is a modern, open-source, data-centric communication protocol that goes beyond traditional pub/sub. Designed specifically for edge computing, industrial IoT, 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. +- 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, a bridge between DDS systems and Zenoh networks. +Zenoh excels in wireless, 5G, and cross-network deployments, which are environments where multicast is unavailable and DDS often struggles. 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, a bridge between DDS systems and Zenoh networks. 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. -The examples use Raspberry Pi boards, but you’re free to substitute any Cortex-A or Neoverse devices that support network connectivity running Linux. +You can substitute Raspberry Pi with any Linux-based Arm device that supports networking, such as a Cortex-A or Neoverse board. + +By the end of this Learning Path, you'll be able to: +- Explain the core architecture and data flow principles behind Eclipse Zenoh protocol, 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 other Arm Linux devices +- Rebuild and extend a Zenoh queryable node to simulate edge-side logic -Upon completion, you will be able to: -- 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 other Arm Linux devices. -- Rebuild and extend the Zenoh queryable example to simulate edge-side logic. diff --git a/content/learning-paths/cross-platform/zenoh-multinode-ros2/2_zenoh-install.md b/content/learning-paths/cross-platform/zenoh-multinode-ros2/2_zenoh-install.md index da1a28cbe4..2c40074624 100644 --- a/content/learning-paths/cross-platform/zenoh-multinode-ros2/2_zenoh-install.md +++ b/content/learning-paths/cross-platform/zenoh-multinode-ros2/2_zenoh-install.md @@ -1,20 +1,21 @@ --- -title: Setting Up Zenoh on Arm Devices +title: Get started with Zenoh on Raspberry Pi and Arm Linux + weight: 3 ### FIXED, DO NOT MODIFY layout: learningpathall --- -## Setting Up Zenoh on Arm Devices +## Set up Zenoh on Arm devices -The following instructions have been verified on both Raspberry Pi 4 and 5 devices, but you can implement them on any Arm Linux device. +This section shows you how to install and build the open-source Eclipse Zenoh protocol on Arm-based devices like Raspberry Pi. -Before building Zenoh, make sure your system has the necessary development tools and runtime libraries. +The following instructions have been verified on Raspberry Pi 4 and 5, but you can use any Arm Linux device. These steps apply to Raspberry Pi and other Arm-based Linux platforms. Before building Zenoh, make sure your system has the necessary development tools and runtime libraries. -### Install the Rust development environment +## Install the Rust development environment -First, install the [Rust](https://www.rust-lang.org/) environment, since the core of Zenoh is developed using Rust to keep it safe and efficient. +First, install the [Rust](https://www.rust-lang.org/) environment. The core of Zenoh is developed in Rust for performance and safety. ```bash sudo apt update @@ -22,27 +23,26 @@ sudo apt install -y curl gcc curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y ``` -Near the end of the installation you will see the success message: +Near the end of the installation, you should see the message: ```output Rust is installed now. Great! ``` - -Make sure to source the environment to add Rust to your shell environment: +Source your shell environment to activate Rust: ```bash source "$HOME/.cargo/env" ``` -You can learn more using the [Rust install guide](/install-guides/rust/) for Arm Linux. +For more information, see the [Rust Install Guide](/install-guides/rust/) for Arm Linux. -### Install ROS 2 +## Install ROS 2 [Robot Operating System](https://www.ros.org/) is a set of software libraries and tools that help you build robot applications. ROS provides everything from drivers to state-of-the-art algorithms, as well as developer tools. It is completely open-source. -Follow the [ROS2 installation guide](/install-guides/ros2/) to install ROS 2 on your Arm platforms. +If you plan to use Zenoh alongside ROS 2, for example, to bridge DDS-based nodes, you should install ROS 2 before proceeding. See the [ROS2 Installation Guide](/install-guides/ros2/) to install ROS 2 on your Arm platforms. -### Download and build the Zenoh source +## Download and build the Zenoh source Clone the Zenoh repository: @@ -50,15 +50,13 @@ Clone the Zenoh repository: cd $HOME git clone https://github.com/eclipse-zenoh/zenoh.git ``` - -After cloning, use cargo to build the source: +Build the source using Cargo: ```bash cd zenoh cargo build --release --all-targets -j $(nproc) ``` - -This process will take several minutes depending on your device. Once the installation is complete, you should see: +This process will take several minutes depending on your device. When complete, you should see output like: ```output Updating crates.io index @@ -101,13 +99,16 @@ This may become a hard error in the future; see plugins/zenoh-plugin-storage-manager/tests/operations.rs:91:55 @@ -120,7 +121,7 @@ Edit the file `./plugins/zenoh-plugin-storage-manager/tests/operations.rs` and c use crate::path::to::Plugin; ``` -Run the build again: +Then rebuild: ```bash cargo clean && cargo build diff --git a/content/learning-paths/cross-platform/zenoh-multinode-ros2/3_zenoh-multinode.md b/content/learning-paths/cross-platform/zenoh-multinode-ros2/3_zenoh-multinode.md index 06e17d6012..bc7f7ccaf7 100644 --- a/content/learning-paths/cross-platform/zenoh-multinode-ros2/3_zenoh-multinode.md +++ b/content/learning-paths/cross-platform/zenoh-multinode-ros2/3_zenoh-multinode.md @@ -1,39 +1,35 @@ --- -title: Setting Up a Multi-Node Environment +title: Containerize and deploy Zenoh across multiple Raspberry Pi devices + weight: 4 ### FIXED, DO NOT MODIFY layout: learningpathall --- -## Deploying Zenoh on Multiple Raspberry Pi Devices +## Deploy Zenoh on multiple Raspberry Pi devices After building Zenoh and its core examples, the next step is to deploy them across multiple Arm-based devices. -If you’ve already installed Zenoh on an Arm Cortex-A or Neoverse platform as shown in the previous section, you can simply copy the compiled binaries from `~/zenoh/target/release/` to each of your Raspberry Pi devices. - -However, to streamline deployment across multiple devices and ensure repeatability, this section demonstrates how to package Zenoh into a Docker image for batch rollout and scalable testing. - -This containerized approach not only simplifies deployment on Raspberry Pi, but also integrates seamlessly with Arm cloud platforms such as AWS Graviton Arm Cortex-A Linux or Arm Virtual Hardware—enabling a consistent cloud-to-edge development and validation workflow. +If you’ve already installed Zenoh on an Arm Cortex-A or Neoverse platform as shown in the previous section, you can copy the compiled binaries from `~/zenoh/target/release/` to each of your Raspberry Pi devices. -In this session, you’ll use Raspberry Pi boards to simulate a scalable distributed environment. The same workflow applies to any Arm Linux system, including cloud instances and virtual hardware. +To simplify and scale deployment across multiple devices, this section shows how to containerize Zenoh with Docker for streamlined distribution and consistent multi-node testing. This containerized approach enables repeatable rollouts and makes it easier to test distributed communication across Raspberry Pi, Arm cloud instances (like AWS Graviton), and Arm Virtual Hardware. -This setup allows you to simulate real-world, cross-node communication scenarios, making it ideal for evaluating Zenoh’s performance in robotics and industrial IoT applications. +In this session, you’ll use Raspberry Pi boards to simulate a scalable distributed environment. The same workflow applies to any Arm Linux system, including cloud instances and virtual hardware. This setup allows you to simulate real-world, cross-node communication scenarios, making it ideal for evaluating Zenoh’s performance in robotics and industrial IoT applications. This setup simulates real-world, cross-node communication scenarios, making it ideal for robotics and industrial IoT applications that require fast, decentralized messaging using pub/sub, storage, and query models. -### Install Docker on Raspberry Pi -To simplify this process and ensure consistency, you can 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. +## Install Docker on Raspberry Pi +To simplify this process and ensure consistency, you can 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. +This enables scalable, multi-node testing in realistic distributed environments. -First, install Docker on each of Raspberry Pi. +First, install Docker on each Raspberry Pi device: ```bash curl -fsSL get.docker.com -o get-docker.sh && sh get-docker.sh sudo usermod -aG docker $USER ; newgrp docker ``` -### Create a ROS2 + Zenoh Docker Image +## Create a Docker image with ROS 2 and Zenoh To ensure compatibility with ROS-related tools, create a `Dockerfile` based on `ros:galactic `, and use the official Rust installation method to build Zenoh, as shown below. @@ -83,7 +79,8 @@ WORKDIR /root/zenoh/target/release CMD ["/bin/bash"] ``` -Under the directory where the above Dockerfile exists, run the following command to generate the docker image. +From the directory containing the above Dockerfile, run the following command to generate the docker image: + ```bash docker build -t zenoh-node . @@ -106,12 +103,16 @@ You can pull it directly using: ```bash docker pull odinlmshen/zenoh-node ``` +{{% notice Tip %}} +Once built, you can reuse this Docker image across multiple Arm-based nodes, including Raspberry Pi, AWS Graviton, and Arm Virtual Hardware. +{{% /notice %}} + +## Transfer the Docker image to another Raspberry Pi -### Transfer the Docker image to the other Raspberry Pi There are two options to transfer the Docker image to your second device. Choose one of the following methods. -Option 1: Save and copy via file +1. Save and copy using the file: ```bash docker save zenoh-node > zenoh-node.tar @@ -124,11 +125,11 @@ On the target device: docker load < zenoh-node.tar ``` -Option 2: Push the image to a container registry such as Docker Hub +2. Push the image to a container registry such as Docker Hub: You can also push the image to Docker Hub or GitHub Container Registry and pull it on the second device. -### Run the Docker Image +## Run the Docker image Once the image is successfully loaded on the second device, you can run the container to start the Zenoh environment. @@ -138,15 +139,17 @@ docker run -it --network=host zenoh-node The Zenoh example binaries are now available within this container, allowing you to test pub/sub and query flows across devices. -## Run Zenoh in Multi-Node Environment +## Run Zenoh examples in a multi-node environment + +With Zenoh running inside containers across devices, you’re now ready to explore real-time communication using prebuilt examples. -You’re now ready to run and test Zenoh communication flows across distributed edge devices. +The following examples are written in Rust and precompiled in your container image. They're fully interoperable and can be used to demonstrate Zenoh's key capabilities across devices. The Rust binaries are available in the `$ZENOH_LOC/target/release/examples/` directory. If you haven't set `ZENOH_LOC`, they can be found under `~/zenoh/target/release/examples/`. + -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: +- Basic pub/sub – for real-time message distribution +- Query and storage – for persisting and retrieving historical data +- Queryable – for enabling on-demand remote computation +- Dynamic queryable with computation – for executing dynamic logic across nodes -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 +With your Zenoh examples running across containers, you’re now ready to build and benchmark real-time communication flows across nodes, which is ideal for simulating robotic fleets or industrial systems. \ No newline at end of file diff --git a/content/learning-paths/cross-platform/zenoh-multinode-ros2/4_zenoh-ex1-pubsub.md b/content/learning-paths/cross-platform/zenoh-multinode-ros2/4_zenoh-ex1-pubsub.md index 6075c7cf3e..08c889a2ef 100644 --- a/content/learning-paths/cross-platform/zenoh-multinode-ros2/4_zenoh-ex1-pubsub.md +++ b/content/learning-paths/cross-platform/zenoh-multinode-ros2/4_zenoh-ex1-pubsub.md @@ -1,41 +1,46 @@ --- -title: Zenoh Example-1 Simple Pub/Sub +title: Run a simple Zenoh pub/sub example weight: 5 ### FIXED, DO NOT MODIFY layout: learningpathall --- -## Example 1: Simple pub/sub +## Test Zenoh pub/sub across two devices -This first test demonstrates the real-time publish/subscribe model using two Raspberry Pi devices. +This example demonstrates how to use Zenoh’s real-time publish/subscribe model to exchange messages between two Raspberry Pi devices over a local network. -The following command is to initiate a subscriber for a key expression `demo/example/**`, a set of topics starting with the path `demo/example`. +Pub/sub is a core Zenoh communication pattern where data producers (publishers) send values to a key, and data consumers (subscribers) receive updates for matching key expressions. In this case, the subscriber listens for all messages published under the key expression `demo/example/**`, which matches any topic that begins with `demo/example/`. This enables flexible topic filtering and lightweight data dissemination across distributed systems. -### Step 1: Run subscriber +## Start the subscriber node -Run the subscriber example on one of the Raspberry Pi systems. +Run the subscriber example on one of the Raspberry Pi systems: ```bash cd ~/zenoh/target/release/examples ./z_sub ``` -### Step 2: Run publisher +## Start the publisher node -Then, log in to the other Raspberry Pi and run the publisher. +Then, log in to the other Raspberry Pi and run the publisher: ```bash cd ~/zenoh/target/release/examples ./z_pub ``` -The result is shown below: +{{% notice Tip %}} +You can run both `z_sub` and `z_pub` on the same device for testing, but running them on separate Raspberry Pis demonstrates Zenoh’s distributed discovery and cross-node communication. +{{% /notice %}} -![img1 alt-text#center](zenoh_ex1.gif "Figure 1: Simple Pub/Sub") +## Observe the pub/sub data flow -The left-side window shows the `z_sub` program. +The results are shown below: -It receives values with the key `demo/example/zenoh-rs-pub` continuously published by `z_pub` running in the right-side window. +![img1 Zenoh subscriber receiving messages from a publisher in a two-terminal view#center](zenoh_ex1.gif "Simple Pub/Sub") + +The left-side window shows the `z_sub` program. It receives values with the key `demo/example/zenoh-rs-pub` continuously published by `z_pub` running in the right-side window. + +This example confirms that Zenoh’s zero-configuration peer discovery and real-time pub/sub communication are working correctly across physical nodes. -This basic example shows Zenoh's zero-config discovery and low-latency pub/sub across physical nodes. diff --git a/content/learning-paths/cross-platform/zenoh-multinode-ros2/5_zenoh-ex2-storagequery.md b/content/learning-paths/cross-platform/zenoh-multinode-ros2/5_zenoh-ex2-storagequery.md index 4de6612a67..c7bb8846ab 100644 --- a/content/learning-paths/cross-platform/zenoh-multinode-ros2/5_zenoh-ex2-storagequery.md +++ b/content/learning-paths/cross-platform/zenoh-multinode-ros2/5_zenoh-ex2-storagequery.md @@ -1,18 +1,23 @@ --- -title: Zenoh Example-2 Storage and Query +title: Run a Zenoh storage and query example + weight: 6 ### FIXED, DO NOT MODIFY layout: learningpathall --- -## Example 2: Storage and query +## Query historical data using Zenoh’s storage engine + +This example demonstrates Zenoh's data storage and query model which enables nodes to retrieve previously published values—even after the original publisher goes offline. -The second example adds Zenoh's data storage and querying capabilities by enabling nodes to retrieve historical values on demand. +Building on the previous pub/sub example, you’ll now run a lightweight Zenoh daemon that stores key–value pairs in memory. Then, you’ll publish data with `z_put` and retrieve it using `z_get`. -Building on the previous pub/sub example, you’ll now explore how Zenoh supports persistent data storage and on-demand querying, a powerful feature for robotics and IIoT applications. +This pattern is ideal for robotics and IIoT scenarios where devices intermittently connect or request snapshots of remote state. -In a typical warehouse or factory scenario, autonomous robots may periodically publish sensor data such as position, temperature, battery level, and a central system or another robot—may later need to query the latest state of each unit. +For example, in a warehouse or factory: +- Robots can periodically publish position, temperature, or battery level. +- A central system or peer node can later query these values on demand. Unlike Pub/Sub, which requires live, real-time message exchange, Zenoh's storage and query model enables asynchronous access to data that was published earlier, even if the original publisher is no longer online. @@ -20,7 +25,7 @@ In this example, you’ll run the `zenohd` daemon with in-memory storage and use This is especially useful for distributed systems where nodes may intermittently connect or request snapshots of state from peers. -### Step 1: Start the Zenoh daemon with in-memory storage +## Start the Zenoh daemon with in-memory storage On one Raspberry Pi, launch the Zenoh daemon with a configuration that enables in-memory storage for keys in the `demo/example/**` directory. @@ -35,7 +40,7 @@ You should see log messages indicating that the storage_manager plugin is loaded If port 7447 is already in use, either stop any previous Zenoh processes or configure a custom port using the `listen.endpoints.router` setting. -### Step 2: Publish data +## Publish a value On 2nd Raspberry Pi device, use `z_put` to send a key-value pair that will be handled by the `zenohd` storage. @@ -46,7 +51,7 @@ cd ~/zenoh/target/release/examples This command stores the string `Hello from storage!` under the key demo/example/test1. -### Step 3: Query the data +## Query the stored value Back on first Raspberry Pi, you can now query the stored data from any Zenoh connected node. @@ -66,9 +71,18 @@ The result is shown below: ![img2 alt-text#center](zenoh_ex2.gif "Figure 2: Storage and Query") -{{% notice tip %}} +{{% notice Tip %}} If you have more than two Raspberry Pi devices, you can run the `z_get` command on a third device to validate that storage queries work seamlessly across a multi-node setup. {{% /notice %}} This example shows how Zenoh's storage with query model supports asynchronous data access and resilient state-sharing—critical capabilities in robotics and industrial IoT systems where network connectivity may be intermittent or system components loosely coupled. +## What's next? + +Now that you've seen how Zenoh handles pub/sub and storage-based queries, you're ready to build reactive and intelligent edge nodes. + +In the next example, you’ll implement a **Zenoh queryable** that responds to runtime parameters,such as battery level and temperature, by computing and returning a real-time health score. This showcases how Zenoh supports on-demand edge computation without needing to pre-store data. + + + + diff --git a/content/learning-paths/cross-platform/zenoh-multinode-ros2/6_zenoh-ex3-queryable.md b/content/learning-paths/cross-platform/zenoh-multinode-ros2/6_zenoh-ex3-queryable.md index ed9d07ea5e..8bd96ce9c0 100644 --- a/content/learning-paths/cross-platform/zenoh-multinode-ros2/6_zenoh-ex3-queryable.md +++ b/content/learning-paths/cross-platform/zenoh-multinode-ros2/6_zenoh-ex3-queryable.md @@ -1,24 +1,25 @@ --- -title: Zenoh Example-3 Computation on Query using Queryable +title: Run a Zenoh queryable node for on-demand edge computation + weight: 7 ### FIXED, DO NOT MODIFY layout: learningpathall --- -## Example 3: Computation on query +## Computation on query -Next, you’ll explore Zenoh's queryable capability, which lets a node dynamically respond to data queries by executing a custom computation or data generation function. +This example shows how to use Zenoh’s queryable feature to return computed results in real time, instead of serving pre-stored values. -Unlike `zenohd` which simply returns stored data, a queryable node can register to handle a specific key expression and generate responses at runtime. This is ideal for distributed computing at the edge, where lightweight devices, such as Raspberry Pi nodes, can respond to requests with calculated values. This enables sensor fusion, AI inference results, and diagnostics. +Unlike `zenohd` which simply returns stored data, a queryable node can register to handle a specific key expression and generate responses at runtime. This is ideal for distributed computing at the edge, where lightweight devices, such as Raspberry Pi nodes, can respond to requests with calculated values. This pattern is ideal for sensor fusion, lightweight AI inference, and dynamic system diagnostics on resource-constrained edge devices. -### Use Case: On-Demand battery health estimation +## Use case: estimate battery health on demand Imagine a robot fleet management system where the central planner queries each robot for its latest battery health score, which is not published continuously but calculated only when queried. -This saves bandwidth and enables edge compute optimization using Zenoh's Queryable. +This reduces bandwidth usage and enables edge-side optimization using Zenoh's queryable feature. -### Step 1: Launch a queryable node +## Launch a queryable node On one Raspberry Pi device, run the `z_queryable` Zenoh example to register a queryable handler. @@ -37,7 +38,7 @@ Press CTRL-C to quit... The node is now ready to accept queries on the key `demo/example/zenoh-rs-queryable` and respond with a predefined message. -### Step 2: Trigger a query from another node +## Trigger a query from another node On the other Raspberry Pi device, run the `z_get` example. @@ -56,11 +57,11 @@ Sending Query 'demo/example/zenoh-rs-queryable'... The result is shown below: -![img3 alt-text#center](zenoh_ex3.gif "Figure 3: Computation on Query using Queryable") +![img3 Zenoh queryable node responding to on-demand queries from a remote device#center](zenoh_ex3.gif "Figure 3: Computation on Query using Queryable") -The value you receive comes not from storage, but from the computation inside the queryable handler. +The response is generated dynamically by the queryable handler, and not fetched from stored data. -### Real-world application: distributed inference and computation +## Real-world use cases This model enables edge-based intelligence, such as: - Executing custom logic in response to a query such as “calculate load average” @@ -69,4 +70,7 @@ This model enables edge-based intelligence, such as: Queryable is a key feature for data-in-use scenarios, allowing fine-grained, on-demand compute inside your Zenoh-powered architecture. -Next, you’ll extend this Queryable pattern to perform parameterized computation, simulating edge diagnostics and adaptive inference. \ No newline at end of file +## What's next? + +In the next example, you'll extend this queryable pattern to support **runtime parameters**, such as battery level and temperature, allowing each node to return a calculated health score on demand. + diff --git a/content/learning-paths/cross-platform/zenoh-multinode-ros2/7_zenoh-querycomp.md b/content/learning-paths/cross-platform/zenoh-multinode-ros2/7_zenoh-querycomp.md index 1afd3c1103..c017ec8ca1 100644 --- a/content/learning-paths/cross-platform/zenoh-multinode-ros2/7_zenoh-querycomp.md +++ b/content/learning-paths/cross-platform/zenoh-multinode-ros2/7_zenoh-querycomp.md @@ -1,5 +1,5 @@ --- -title: Zenoh Example-4 Dynamic Queryable with Computation +title: Run a Zenoh queryable with parameterized Rust computation weight: 8 ### FIXED, DO NOT MODIFY @@ -14,7 +14,7 @@ You’ll learn how to use Zenoh's Queryable API in Rust to build a parameterized This extends a previous example by supporting runtime query parameters like battery level and temperature. -## Use Case: Real-time battery health via computation +## Use case: real-time battery health through on-demand computation In robotic fleet management, a central controller may need to assess each robot’s battery health on demand. @@ -22,7 +22,7 @@ Instead of streaming data continuously, robots expose a queryable endpoint that This saves bandwidth and enables lightweight edge-side decision-making. -### Step 1: Create a new Zenoh rust project +## Create a new Zenoh rust project On any Raspberry Pi: @@ -40,7 +40,7 @@ tokio = { version = "1", features = ["full"] } url = "2" ``` -### Step 2: Implement the queryable node +## Implement the queryable node Next, log in to the other Raspberry Pi. @@ -103,8 +103,14 @@ Inside the callback: - A health score is computed from these inputs. - The result is sent back to the querying client using query.reply(). +{{% notice Tip %}} +You can extend this queryable pattern to respond to other real-time diagnostics, such as CPU load, camera snapshots, or local ML inference results. +{{% /notice %}} + This design pattern enables efficient, on-demand data exchange with minimal bandwidth usage. This is ideal for edge computing scenarios where resources and connectivity are constrained. +## Battery health estimation formula + The health score is calculated using the following logic: ```rust @@ -115,16 +121,15 @@ This formula estimates battery health as a percentage, considering both battery - battery: Current battery level (default 50%) - temp: Current temperature (default 25°C) -The health estimation logic begins with the battery level as the baseline score. -If the temperature rises above 25°C, the score is adjusted downward—specifically, for every 2°C above this threshold, the health is reduced by 1%. +This logic computes battery health as a percentage, adjusting for elevated temperatures. If temperature exceeds 25°C, the score is reduced by 1% for every 2°C increase. To ensure the calculation remains safe even when the temperature is below 25°C, the code uses saturating_sub(25), which prevents the result from becoming negative and avoids potential underflow errors. -For example, if battery = 88 and temp = 32, then: +For example, if `battery = 88` and `temp = 32`, then: - Temperature offset = (32 - 25) / 2 = 3 - Health = 88 - 3 = 85% -### Step 3: Build and run +## Build and run ```bash cd $HOME/zenoh/zenoh_battery_estimator @@ -138,7 +143,7 @@ After the build process, you will see: Finished `release` profile [optimized] target(s) in 1m 22s ``` -### Step 4: Query it with parameters +## Query it with parameters Run it on the Raspberry Pi you used for the build run: @@ -156,9 +161,9 @@ cd ~/zenoh/target/release/examples The result is shown below: -![img4 alt-text#center](zenoh_ex4.gif "Figure 4: Dynamic Queryable with Computation") +![img4 Estimated battery health query#center](zenoh_ex4.gif "Figure 4: Dynamic Queryable with Computation") -The excepted output is: +The expected output is: ```output >> Received ('robot/battery/estimate': 'Estimated battery health: 85%') diff --git a/content/learning-paths/cross-platform/zenoh-multinode-ros2/_index.md b/content/learning-paths/cross-platform/zenoh-multinode-ros2/_index.md index 833978a14d..39f75a71da 100644 --- a/content/learning-paths/cross-platform/zenoh-multinode-ros2/_index.md +++ b/content/learning-paths/cross-platform/zenoh-multinode-ros2/_index.md @@ -1,22 +1,19 @@ --- -title: Scalable Networking for Industrial and Robotics with Zenoh on Raspberry Pi - -draft: true -cascade: - draft: true +title: Build and deploy multi-node Zenoh systems on Raspberry Pi minutes_to_complete: 45 -who_is_this_for: This Learning Path is for robotics developers, industrial automation engineers, and IoT system architects building distributed, scalable, and low-latency applications. Whether you are using Robot Operating System (ROS), developing autonomous systems, or designing multi-node communication frameworks, you can use Eclipse Zenoh on Arm-based platforms, both in the cloud and on local devices like Raspberry Pi. +who_is_this_for: This Learning Path is for robotics developers, industrial automation engineers, and IoT system architects who are building distributed, scalable, and low-latency applications. Whether you're using the Robot Operating System (ROS), developing autonomous systems, or designing multi-node communication frameworks, you can use Eclipse Zenoh on Arm-based platforms, both in the cloud and on local devices like Raspberry Pi. + learning_objectives: - - Understand Zenoh's architecture and its integration of pub/sub, storage, querying, and computation models. - - Build and run Zenoh examples on both Arm servers and Raspberry Pi. - - Set up and deploy a multi-node Zenoh system. + - Understand Zenoh's architecture and how it integrates pub/sub, storage, querying, and computation models + - Build and run Zenoh examples on both Arm servers and Raspberry Pi + - Set up and deploy a multi-node Zenoh system prerequisites: - - At least two local Cortex-A devices running Linux, such as Raspberry Pi 4 or Pi 5. You can also use Arm servers or cloud instances. - - Experience with ROS 2 applications. + - At least two local Cortex-A devices running Linux, such as Raspberry Pi 4 or Pi 5. You can also use Arm servers or cloud instances + - Experience with ROS 2 applications author: - Odin Shen @@ -32,6 +29,8 @@ tools_software_languages: - ROS2 - C - Raspberry Pi + - Zenoh + - Rust operatingsystems: - Linux @@ -50,6 +49,11 @@ further_reading: title: Eclipse Zenoh Github link: https://github.com/eclipse-zenoh/zenoh type: documentation + - resource: + title: Zenoh and ROS 2 Integration Guide + link: https://github.com/eclipse-zenoh/zenoh-plugin-ros2 + type: documentation + ### FIXED, DO NOT MODIFY