Skip to content

Instantly share code, notes, and snippets.

@JEnoch
Created September 20, 2021 21:02
Show Gist options
  • Save JEnoch/7694362fd03c82a046d6df3d68aca2f3 to your computer and use it in GitHub Desktop.
Save JEnoch/7694362fd03c82a046d6df3d68aca2f3 to your computer and use it in GitHub Desktop.
zenoh/DDS bridge: downsampling of periodic topics

Bridging the DDS traffic over a constrained connectivity (in throughput and/or number of message per second) might require to perform downsampling of some periodic DDS publications.

A new option for this purpose have been introduced in the new IAC2 branch of the zenoh bridge for DDS: --periodic-topics <topics_regex>=<period_in_ms>

Example of usage

Assuming you need to bridge the following topics over UDP, and want to ensure a minimal period between each re-publication (period values here are just examples and might not be relevant):

car -> basestation minimal publication period
/raptor_dbw_interface/ct_report 200 ms
/raptor_dbw_interface/pt_report 500 ms
/raptor_dbw_interface/misc_report_do 200 ms
basestation -> car minimal publication period
/raptor_dbw_interface/rc_to_ct 100 ms
/joystick/command 50 ms

zenoh bridge command in the car

zenoh-bridge-dds --no-multicast-scouting -l udp/0.0.0.0:7447 \
 --allow "ct_report|pt_report|misc_report_do|rc_to_ct|joystick/command" \
 --periodic-topics "ct_report|misc_report_do=200" \
 --periodic-topics "pt_report=500"

zenoh bridge command in the basestation

Assuming car's IP is 10.42.3.1:

zenoh-bridge-dds --no-multicast-scouting -l udp/0.0.0.0:7447 -e udp/10.42.3.1:7447 \
 --allow "ct_report|pt_report|misc_report_do|rc_to_ct|joystick/command" \
 --periodic-topics "joystick/command=50" \
 --periodic-topics "rc_to_ct=100"

explanation of each argument

  • --no-multicast-scouting : make sure zenoh doesn’t use UDP multicast
  • -l use/0.0.0.0:7447 : open a UDP socket on any interface on port 7447
  • -e udp/10.42.3.1:7447: establish a UDP session with bridge in the car (10.42.3.1). Note that the session will be bidirectional, since zenoh sends the IP of basestation to the car when establishing the session.
  • --allow <regex> : the list of topics allowed to be routed, as a regular expression (partial matching of topic name is supported, thus no need to set the full name of each topic).
  • --periodic-topics <regex>=<period_in_ms> : a list of topic to be routed at the specified period.
    e.g.: --periodic-topics "ct_report|misc_report_do=200" specifies to re-publish the topics /raptor_dbw_interface/ct_report and /raptor_dbw_interface/misc_report_do at 200ms interval (i.e. 5Hz max)

Instructions to build this version of zenoh bridge:

  • cd ~
  • git clone --branch IAC2 https://github.com/eclipse-zenoh/zenoh-plugin-dds
  • cd zenoh-plugin-dds/zenoh-bridge-dds
  • cargo build --release
  • The zenoh-bridge-dds binary path will be: ~/zenoh-plugin-dds/zenoh-bridge-dds/target/release/zenoh-bridge-dds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment