domain_bridge icon indicating copy to clipboard operation
domain_bridge copied to clipboard

One topic maps to multiple domains

Open TianqiLi7398 opened this issue 1 year ago • 0 comments

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!

TianqiLi7398 avatar Oct 29 '22 03:10 TianqiLi7398