ros2 / domain_bridge

Bridge communication across different ROS 2 domains.
Apache License 2.0
52 stars 12 forks source link

One topic maps to multiple domains #72

Open TianqiLi7398 opened 1 year ago

TianqiLi7398 commented 1 year ago

Howdy, I'd like to ask for some thoughts of mapping one topic to different domains. For example, I want topic /topic_a from ROS_DOMAIN_ID=0 broadcast to ROS_DOMAIN_ID=[1,2,3,4...].

What I tried: a). in the .yaml config file, I just duplicate this topic like

  /topic_a:
    from_domain: 0
    to_domain: 1
    type: std_msgs/msg/Int16
  /topic_a:
    from_domain: 0
    to_domain: 2
    type: std_msgs/msg/Int16
  /topic_a:
    from_domain: 0
    to_domain: 3
    type: std_msgs/msg/Int16
...

And surprisingly it worked! We are able to duplicate the key in .yaml file and domain_bridge follows this.

b). a more controllable way, I desire to input the bridge content from code (Python, Cpp). But to generate the .yaml file, we need to make the data as dictionary. We cannot duplicate the key in dictionary. And here my question is what is a good way to make this happen in scripts, in stead of hand code the domain bridge.

Thanks!