Skip to content

Commit

Permalink
Merge branch 'main' of github.com:ZettaScaleLabs/roscon2024_workshop
Browse files Browse the repository at this point in the history
  • Loading branch information
JEnoch committed Oct 21, 2024
2 parents 1d4af4f + df00d09 commit 405fde0
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,5 @@ The docker directory contains several scripts to help manage the container:
### [Exercise 5 - Discovery via UDP multicast](exercises/ex-5.md)

### [Exercise 6 - Access Control](exercises/ex-6.md)

### [Exercise 7 - Downsampling](exercises/ex-7.md)
49 changes: 49 additions & 0 deletions exercises/ex-7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Exercise 7 - Downsampling

By configuration the Zenoh router can perform downsampling (i.e. reducing the frequency of messages) for some topics published via a specified interface.

## Configuration

<p align="center"><img src="pictures/downsampling.png" height="300" alt="downsampling"/></p>

Follow up with the same partner than the previous exercise.

In container A add this `downsampling` configuration at the end of your `zenoh_confs/ROUTER_CONFIG.json5` file (just before the last `}`):

```json5
downsampling: [
{
// Downsampling publications in egress on WiFi interface
interfaces: ["<YOUR_WIFI_INTERFACE>"],
flow: "egress",
rules: [
// 0.5Hz for the Zenoh key expression used for the "/chatter_public" topic
{
key_expr: "0/chatter_public/std_msgs::msg::dds_::String_/RIHS01_df668c740482bbd48fb39d76a70dfd4bd59db1288021743503259e948f6b1a18",
freq: 0.5
},
],
},
],
```

## Running the Test

Run the same commands than for previous exercise:

* In container A:
* Start the router (with the custom configuration): `ZENOH_ROUTER_CONFIG_URI=/ros_ws/zenoh_confs/ROUTER_CONFIG.json5 ros2 run rmw_zenoh_cpp rmw_zenohd`
You can also add this environment variable to see the router applying the access control:
`RUST_LOG=info,zenoh::net::routing::interceptor=debug`
* Start the publisher on the denied topic:
`ros2 topic pub /chatter std_msgs/msg/String "data: Hello just me!"`
* Start another publisher on an allowed topic:
`ros2 topic pub /chatter_public std_msgs/msg/String "data: Hello World!"`
* In container B:
* Start the router (with the default configuration): `ros2 run rmw_zenoh_cpp rmw_zenohd`
* Start the listener on the denied topic:
`ros2 topic echo /chatter`
* Start the listener on an allowed topic:
`ros2 topic echo /chatter_public`

And see the result in the listener on `/chatter_public`.
Binary file added exercises/pictures/downsampling.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 405fde0

Please sign in to comment.