Function domain_bridge::parse_domain_bridge_yaml_config

Function Documentation

DomainBridgeConfig domain_bridge::parse_domain_bridge_yaml_config(std::filesystem::path file_path)

Create a DomainBridgeConfig object from a YAML file.

The YAML file may contain the following optional keys:

  • name: Name of the domain bridge

  • from_domain: The default ‘from_domain’ used for bridged topics. If omitted, then each topic bridge must specify its own value.

  • to_domain: The default ‘to_domain’ used for bridged topics If omitted, then each topic bridge must specify it’s own value.

  • topics: A map of topic names to a map of topic bridge information

For each topic bridge, the following keys are valid:

  • type: Message type to bridge

  • from_domain: Subscribe to the topic on this domain ID

  • to_domain: Publish to the topic on this domain ID

  • qos: QoS options.

  • remap: Remap topic name to this name in ‘to_domain’.

QoS options are a map of policy kinds to policy values. If an option for a policy is not provided then a default value is used. For each QoS option provided, it will override the default policy.

Supported QoS options:

  • reliability: must be ‘reliable’ or ‘best_effort’

  • durability: must be ‘volatile’ or ‘transient_local’

  • history: must be ‘keep_last’ or ‘keep_all’

  • depth: a positive integer

  • deadline: an integer representing number of nanoseconds (negative for “infinite”), or the string ‘auto’ to automatically match the value of a publisher.

  • lifespan: an integer representing number of nanoseconds (negative for “infinite”), or the string ‘auto’ to automatically match the value of a publisher.

For example,

See also

QosOptions

name: my_bridge
from_domain: 2
to_domain: 3
topics:
  chatter:
    type: example_interfaces/msg/String
  clock:
    type: rosgraph_msgs/msg/Clock
    # Override the default 'to_domain' above
    to_domain: 4
  foo/bar:
    type: example_interfaces/msg/Empty
    # Override reliability, history, and depth
    # Let durability policy be automatically determined
    qos:
      reliability: best_effort
      history: keep_last
      depth: 42
  chitter:
    type: example_interfaces/msg/String
    # Remap 'chitter' topic to 'chatter'
    remap: chatter
Parameters:

file_path – Path to the YAML file.

Throws:

domain_bridge::YamlParsingError – if there was an error parsing the YAML file, for example, if a required key is missing.

Returns:

A DomainBridgeConfig object populated according to the input YAML file.