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

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 }):
downsampling: [
{
// Downsampling publications ("push" messages, and "reply" in case of TRANSIENT_LOCAL publisher)
// in egress direction on WiFi interface
messages: ["push", "reply"],
flows: ["egress"],
interfaces: ["<YOUR_WIFI_INTERFACE>"],
rules: [
// 0.6Hz for the Zenoh key expression used for the "/chatter_public" topic
{
key_expr: "*/chatter_public/**",
freq: 0.6
},
],
},
],
Run the same commands than for previous exercise:
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=traceros2 topic pub /chatter std_msgs/msg/String "data: Hello just me!"ros2 topic pub /chatter_public std_msgs/msg/String "data: Hello World!"ros2 run rmw_zenoh_cpp rmw_zenohdros2 topic echo /chatterros2 topic echo /chatter_publicAnd see the result in the listener on /chatter_public.