diff --git a/autoware_system_designer.instructions.md b/autoware_system_designer.instructions.md
index a7ae9647..7dd40010 100644
--- a/autoware_system_designer.instructions.md
+++ b/autoware_system_designer.instructions.md
@@ -221,11 +221,21 @@ Top-level entry point defining the complete system.
- `description`: (Optional) Description of the mode.
- `default`: (Optional) `true`/`false` to mark as default mode.
- `parameter_sets`: List of parameter set files. Can be an empty list `[]`.
+- `communication_domains`: (Optional) Communication domains of the system. Compute units of one domain exchange topics directly; units of different domains exchange only what a domain bridge of the system carries. The design connects ports across domains as usual.
+ - `name`: Domain identifier referenced by `compute_units[].communication_domain` (e.g., `main`). Lowercase letters, digits and underscores, starting with a letter.
+ - `description`: (Optional) Brief explanation of the domain.
+ - `id`: (Optional) Identifier the middleware knows the domain by, a non-negative integer, distinct per domain. The generated launcher of a unit and the runtime hand it to the nodes they start; on ROS 2 it is the `ROS_DOMAIN_ID` (0 to 232). A domain without it is the one of the environment its units are launched in.
- `compute_units`: (Optional) Compute units the system is deployed on. A unit is one independently launched environment (an ECU, a container or a partition) with no copy-free IPC to other units; the hardware or execution environment hosting it is outside the system design. Components on different units communicate over the network only, so a node group cannot span units. Once declared, every component's `compute_unit` must name one of them, and each onboard unit gets a launcher in every mode even when no component of that mode runs on it.
- `name`: Unit identifier referenced by `components[].compute_unit` (e.g., `main_ecu`). Lowercase letters, digits and underscores, starting with a letter (`^[a-z][a-z0-9_]*$`); the name is used as the launcher directory and file name and as the runtime `--compute-unit` value.
- `kind`: (Optional) Where the unit exists relative to the deployed vehicle. `onboard` (default) runs on the vehicle and gets a launcher; `offboard` is a participant outside the vehicle (infrastructure, cloud, remote operation) whose components are declared for wiring only. Offboard units get no launcher and no launch-command entry; their components remain in the structure export.
- `description`: (Optional) Brief explanation of the unit.
- `requires`: (Optional) Capabilities the unit needs from the execution environment it is launched in (e.g., `[gpu]`, or `gpu` for one). Names are free (`^[a-z][a-z0-9_]*$`); an E/E architecture may bind the unit only to an environment whose `provides` holds every one of them.
+ - `communication_domain`: (Optional) Name of the `communication_domains` entry the unit's nodes run in. A unit without it takes part in no declared domain (a unit of non-ROS software, for example) and its nodes, if any, run in the domain of the environment it is launched in; the build reports such a unit once it connects to a unit in a domain.
+- `domain_bridges`: (Optional) Bridges between communication domains. A bridge carries every connection whose two ends run in its two domains, in either direction, under its own name: a topic from the publisher's domain to the subscriber's, a service from the server's domain to the client's. The designer derives the topics and services from the connections, generates the configuration of the bridge process and launches it as a member of the bridge's compute unit. A connection crossing two domains no bridge joins is reported at build time. Services need a bridge process that reads `services` from its configuration.
+ - `name`: Bridge identifier (`^[a-z][a-z0-9_]*$`); the name of the bridge process, unique among the system's components.
+ - `type`: Bridge process. `ros2_domain_bridge` (the `domain_bridge` package) is the one type, declared in `config/domain_bridge_types.yaml`.
+ - `compute_unit`: Onboard unit the bridge process runs on.
+ - `domains`: The two `communication_domains` entries the bridge joins; one bridge per pair. Both need an `id`.
- `peripherals`: (Optional) Hardware outside the compute units that components talk to (sensors, actuators, vehicle controllers), by logical name. The system design names no device; an E/E architecture binds each name to one.
- `name`: Peripheral identifier (`^[a-z][a-z0-9_]*$`); the key an E/E architecture binds by.
- `node`: (Optional) Gateway node(s) of the peripheral: the nodes that talk to its hardware, one path or a list (e.g., `/sensing/lidar/lidar_top`, or the receiver and sender of a CAN channel). How the hardware's data maps to the nodes' topics is the device's and the driver's, not the system design's. The interfaces and addresses each gateway node's compute unit reaches the device by are derived from it.
@@ -256,7 +266,7 @@ Top-level entry point defining the complete system.
**Mode-Specific Overrides:**
Each mode can define overrides using the mode name as a key:
-- `override`: Dictionary containing mode-specific overrides. All system configuration fields can be overridden (e.g., `variables`, `variable_files`, `modes`, `parameter_sets`, `compute_units`, `components`, `connections`). The variant resolver applies the appropriate merge strategy for each field type (key-based replacement for fields with identifiers, append for lists without keys, dictionary merge for dictionaries).
+- `override`: Dictionary containing mode-specific overrides. All system configuration fields can be overridden (e.g., `variables`, `variable_files`, `modes`, `parameter_sets`, `communication_domains`, `compute_units`, `domain_bridges`, `components`, `connections`). The variant resolver applies the appropriate merge strategy for each field type (key-based replacement for fields with identifiers, append for lists without keys, dictionary merge for dictionaries).
- `remove`: Dictionary specifying what to remove in this mode. All system configuration fields can be removed (e.g., `modes`, `parameter_sets`, `compute_units`, `components`, `variables`, `connections`). The variant resolver applies the appropriate removal strategy (key-based removal for fields with identifiers, full match for lists without keys). When components are removed, connections involving them are automatically filtered out.
### 4.4. Parameter Set Configuration (`.parameter_set.yaml`)
diff --git a/autoware_system_designer/autoware_system_designer/builder/compute_units.py b/autoware_system_designer/autoware_system_designer/builder/compute_units.py
index eaa9f286..57fb5338 100644
--- a/autoware_system_designer/autoware_system_designer/builder/compute_units.py
+++ b/autoware_system_designer/autoware_system_designer/builder/compute_units.py
@@ -12,15 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-"""Declared compute units of a resolved system and the component binding rule."""
+"""Declared compute units and communication domains of a resolved system and their binding rules."""
from __future__ import annotations
import re
-from typing import List
+from typing import Any, Dict, List
from autoware_system_designer.common.exceptions import ValidationError
from autoware_system_designer.common.source_location import format_source, source_from_config
+from autoware_system_designer.model import serde
from autoware_system_designer.model.config import COMPUTE_UNIT_NAME_PATTERN, SystemConfig
@@ -29,6 +30,49 @@ def compute_unit_names(system_config: SystemConfig) -> List[str]:
return [unit.name for unit in system_config.compute_units or []]
+def compute_unit_records(system_config: SystemConfig) -> List[Dict[str, Any]]:
+ """Export records of the declared units; a unit in a domain with an identifier carries it as ``domain_id``."""
+ ids = {domain.name: domain.id for domain in system_config.communication_domains or []}
+ records = []
+ for unit in system_config.compute_units or []:
+ record = serde.dump(unit)
+ if ids.get(unit.communication_domain) is not None:
+ record["domain_id"] = ids[unit.communication_domain]
+ records.append(record)
+ return records
+
+
+def check_communication_domains(system_config: SystemConfig) -> None:
+ """Declared domains are unique in name and identifier, and each unit's domain is a declared one.
+
+ Runs on the resolved config, like the component binding check.
+ """
+ domains = system_config.communication_domains or []
+ names = [domain.name for domain in domains]
+ duplicates = sorted({name for name in names if names.count(name) > 1})
+ if duplicates:
+ src = source_from_config(system_config, "/communication_domains")
+ raise ValidationError(f"Duplicate communication domain declaration(s): {duplicates}{format_source(src)}")
+ by_id: Dict[int, str] = {}
+ for idx, domain in enumerate(domains):
+ if domain.id is None:
+ continue
+ if domain.id in by_id:
+ src = source_from_config(system_config, f"/communication_domains/{idx}/id")
+ raise ValidationError(
+ f"Communication domains '{by_id[domain.id]}' and '{domain.name}' share the identifier "
+ f"{domain.id}{format_source(src)}"
+ )
+ by_id[domain.id] = domain.name
+ for idx, unit in enumerate(system_config.compute_units or []):
+ if unit.communication_domain is not None and unit.communication_domain not in names:
+ src = source_from_config(system_config, f"/compute_units/{idx}/communication_domain")
+ raise ValidationError(
+ f"Compute unit '{unit.name}' references undeclared communication domain "
+ f"'{unit.communication_domain}'; declared communication domains: {names}{format_source(src)}"
+ )
+
+
def check_component_compute_units(system_config: SystemConfig) -> None:
"""Once a system declares compute units, their names are valid and unique and each component binds to one.
diff --git a/autoware_system_designer/autoware_system_designer/builder/config/launch_manager.py b/autoware_system_designer/autoware_system_designer/builder/config/launch_manager.py
index bf6c049e..fa08bc75 100644
--- a/autoware_system_designer/autoware_system_designer/builder/config/launch_manager.py
+++ b/autoware_system_designer/autoware_system_designer/builder/config/launch_manager.py
@@ -56,7 +56,7 @@ def get_launcher_data(self, instance: "Instance") -> Dict[str, Any]:
"""Build full launcher dict for this node instance (for generation/serialization)."""
cfg = self.launch_config
- resolved_args = instance.parameter_manager.resolve_substitutions(cfg.args)
+ resolved_args = cfg.args if cfg.launch_time_args else instance.parameter_manager.resolve_substitutions(cfg.args)
launcher_data: Dict[str, Any] = {
"package": cfg.package_name,
diff --git a/autoware_system_designer/autoware_system_designer/builder/deployment_instance.py b/autoware_system_designer/autoware_system_designer/builder/deployment_instance.py
index 2e1b8187..4ee91e31 100644
--- a/autoware_system_designer/autoware_system_designer/builder/deployment_instance.py
+++ b/autoware_system_designer/autoware_system_designer/builder/deployment_instance.py
@@ -15,7 +15,13 @@
import logging
from typing import Callable, Dict
-from autoware_system_designer.builder.compute_units import check_component_compute_units
+from autoware_system_designer.builder.compute_units import check_communication_domains, check_component_compute_units
+from autoware_system_designer.builder.domain_bridges import (
+ apply_bridge_names,
+ apply_domain_bridges,
+ check_domain_bridges,
+ scope_instances_by_domain,
+)
from autoware_system_designer.builder.instances.instance_tree import set_instances
from autoware_system_designer.builder.instances.instances import Instance
from autoware_system_designer.builder.parameters.parameter_resolver import ParameterResolver
@@ -45,8 +51,12 @@ def set_system(
config_registry,
package_paths: Dict[str, str],
snapshot_callback: Callable[[str, Exception | None], None] | None = None,
+ domain_bridge_config_dir: str = "",
) -> None:
- """Set system for this deployment instance."""
+ """Set system for this deployment instance.
+
+ *domain_bridge_config_dir* is where a launched domain bridge finds its generated configuration.
+ """
def _snapshot(step: str, error: Exception | None = None) -> None:
if snapshot_callback:
@@ -83,8 +93,12 @@ def _snapshot(step: str, error: Exception | None = None) -> None:
# 1. set component instances
check_component_compute_units(system_config)
+ check_communication_domains(system_config)
+ check_domain_bridges(system_config)
logger.info(f"Instance '{self.name}': setting component instances")
set_instances(self, system_config.full_name, config_registry)
+ apply_domain_bridges(self, domain_bridge_config_dir)
+ scope_instances_by_domain(self)
self.check_duplicate_node_path()
_snapshot("1_parse")
@@ -95,6 +109,7 @@ def _snapshot(step: str, error: Exception | None = None) -> None:
current_step = "connections"
logger.info(f"Instance '{self.name}': setting connections")
self.link_manager.set_links()
+ apply_bridge_names(self)
self.check_duplicate_port_path()
self.check_ports()
_snapshot("2_connections")
@@ -113,18 +128,18 @@ def _snapshot(step: str, error: Exception | None = None) -> None:
raise
def check_duplicate_node_path(self) -> None:
- """Check for duplicate normalized (namespace + name) node paths.
+ """Check for duplicate normalized (namespace + name) node paths within a communication domain.
- Components/modules may share namespaces. Node instances must have unique
+ Components/modules may share namespaces. Node instances of one domain must have unique
normalized paths generated from namespace + node name.
"""
- node_path_map: Dict[str, Instance] = {}
+ node_path_map: Dict[tuple, Instance] = {}
for inst in self.iter_tree():
if inst.entity_type != "node":
continue
node_path = Namespace(list(Namespace.from_path(inst.namespace)) + ([inst.name] if inst.name else []))
normalized_path = node_path.to_string()
- other = node_path_map.setdefault(normalized_path, inst)
+ other = node_path_map.setdefault((inst.resolved_path.domain, normalized_path), inst)
if other is not inst:
raise ValidationError(
f"Duplicate node path found: '{normalized_path}'. "
@@ -133,7 +148,7 @@ def check_duplicate_node_path(self) -> None:
)
def check_duplicate_port_path(self) -> None:
- """Every port of the tree has its own path; ids and default topics derive from it.
+ """Every port of a communication domain has its own path; ids and default topics derive from it.
Two instances placed on one path collide here when they define a port of the same name.
"""
@@ -141,7 +156,7 @@ def check_duplicate_port_path(self) -> None:
for inst in self.iter_tree():
manager = inst.link_manager
for port in (*manager.in_ports.values(), *manager.out_ports.values()):
- key = (isinstance(port, InPort), tuple(port.namespace), port.name)
+ key = (inst.resolved_path.domain, isinstance(port, InPort), tuple(port.namespace), port.name)
other = owners.setdefault(key, inst)
if other is not inst:
raise ValidationError(
diff --git a/autoware_system_designer/autoware_system_designer/builder/domain_bridges.py b/autoware_system_designer/autoware_system_designer/builder/domain_bridges.py
new file mode 100644
index 00000000..d3b92cb1
--- /dev/null
+++ b/autoware_system_designer/autoware_system_designer/builder/domain_bridges.py
@@ -0,0 +1,351 @@
+# Copyright 2026 TIER IV, inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Domain bridges of a system: the generated bridge processes and the connections each one carries."""
+
+import logging
+from functools import lru_cache
+from pathlib import Path
+from typing import TYPE_CHECKING, Any, Dict, Iterator, List, Optional, Tuple
+
+import yaml
+
+from autoware_system_designer.builder.config.launch_manager import LaunchManager
+from autoware_system_designer.common.exceptions import ValidationError
+from autoware_system_designer.common.source_location import format_source, source_from_config
+from autoware_system_designer.model.config import DomainBridge, SystemConfig
+from autoware_system_designer.model.execution import LaunchConfig, LaunchState
+
+if TYPE_CHECKING:
+ from autoware_system_designer.builder.instances.instances import Instance
+
+logger = logging.getLogger(__name__)
+
+DOMAIN_BRIDGE_TYPES_FILE = Path(__file__).resolve().parents[1] / "config" / "domain_bridge_types.yaml"
+
+# Port roles of a topic connection; a connection of a server and a client is a service.
+_TOPIC_ROLES = (None, "publisher", "subscriber")
+_SERVICE_ROLES = {"server", "client"}
+
+
+@lru_cache(maxsize=None)
+def domain_bridge_types() -> Dict[str, Dict[str, Any]]:
+ """Bridge process spec of each domain bridge type, as declared in the domain bridge types file."""
+ with open(DOMAIN_BRIDGE_TYPES_FILE) as f:
+ types = yaml.safe_load(f) or {}
+ for type_name, spec in types.items():
+ if not isinstance(spec, dict) or not spec.get("package") or not spec.get("executable"):
+ raise ValidationError(
+ f"Domain bridge type '{type_name}' in {DOMAIN_BRIDGE_TYPES_FILE} needs 'package' and 'executable'"
+ )
+ return types
+
+
+def domain_bridge_config_file(bridge_name: str) -> str:
+ """File name of a bridge's generated configuration, inside the mode's bridge configuration directory."""
+ return f"{bridge_name}.yaml"
+
+
+def _unit_domains(system_config: SystemConfig) -> Dict[str, Optional[str]]:
+ return {unit.name: unit.communication_domain for unit in system_config.compute_units or []}
+
+
+def _domain_ids(system_config: SystemConfig) -> Dict[str, Optional[int]]:
+ return {domain.name: domain.id for domain in system_config.communication_domains or []}
+
+
+def _domain_prefixes(system_config: SystemConfig) -> Dict[str, Optional[str]]:
+ return {domain.name: domain.prefix for domain in system_config.communication_domains or []}
+
+
+def far_side_name(name: str, origin_prefix: str, is_service: bool) -> str:
+ """Name a topic or service of one domain takes in another: under the prefix of its domain.
+
+ A service is reached as a request sent to its domain.
+ """
+ return f"/to_{origin_prefix.lstrip('/')}{name}" if is_service else f"{origin_prefix}{name}"
+
+
+def scope_instances_by_domain(instance: "Instance") -> None:
+ """Mark the path of every instance with the communication domain of its compute unit."""
+ system_config = instance.configuration
+ unit_domains = _unit_domains(system_config) if getattr(system_config, "compute_units", None) else {}
+ for inst in instance.iter_tree():
+ inst.resolved_path.domain = unit_domains.get(inst.compute_unit) or ""
+
+
+def apply_bridge_names(instance: "Instance") -> None:
+ """Give each subscriber and client fed across a bridge the name its bridge exposes in its domain.
+
+ A name the bridge shares keeps the publisher's; a global port keeps its own.
+ """
+ system_config = instance.configuration
+ bridges = getattr(system_config, "domain_bridges", None) or []
+ if not bridges:
+ return
+ unit_domains = _unit_domains(system_config)
+ prefixes = _domain_prefixes(system_config)
+ by_domains = {frozenset(bridge.domains): bridge for bridge in bridges}
+ for out_port, publisher, in_port, subscriber in _cross_domain_connections(instance):
+ source = unit_domains.get(publisher.compute_unit)
+ target = unit_domains.get(subscriber.compute_unit)
+ if source is None or target is None or source == target or in_port.is_global:
+ continue
+ bridge = by_domains.get(frozenset((source, target)))
+ name = out_port.get_topic()
+ if bridge is None or name in bridge.shared_names:
+ continue
+ is_service = {out_port.role, in_port.role} == _SERVICE_ROLES
+ in_port.bridged_topic = far_side_name(name, prefixes[source], is_service).lstrip("/").split("/")
+
+
+def check_domain_bridges(system_config: SystemConfig) -> None:
+ """Each declared bridge is of a known type, runs on an onboard unit and joins two declared domains alone.
+
+ Both domains carry an identifier: the bridge process enters them by it, whatever environment it runs in.
+ Runs on the resolved config, like the communication domain check.
+ """
+ bridges = system_config.domain_bridges or []
+ if not bridges:
+ return
+ types = domain_bridge_types()
+ ids = _domain_ids(system_config)
+ prefixes = _domain_prefixes(system_config)
+ units = {unit.name: unit for unit in system_config.compute_units or []}
+ names = [bridge.name for bridge in bridges]
+ duplicates = sorted({name for name in names if names.count(name) > 1})
+ if duplicates:
+ src = source_from_config(system_config, "/domain_bridges")
+ raise ValidationError(f"Duplicate domain bridge declaration(s): {duplicates}{format_source(src)}")
+
+ joined: Dict[frozenset, str] = {}
+ for idx, bridge in enumerate(bridges):
+
+ def error(message: str, field: str) -> ValidationError:
+ src = source_from_config(system_config, f"/domain_bridges/{idx}/{field}")
+ return ValidationError(f"Domain bridge '{bridge.name}' {message}{format_source(src)}")
+
+ if bridge.type not in types:
+ raise error(f"uses unsupported type '{bridge.type}'. Supported types: {', '.join(sorted(types))}", "type")
+ unit = units.get(bridge.compute_unit)
+ if unit is None:
+ raise error(
+ f"references undeclared compute unit '{bridge.compute_unit}'; declared compute units: {list(units)}",
+ "compute_unit",
+ )
+ if unit.kind != "onboard":
+ raise error(f"runs on the {unit.kind} compute unit '{unit.name}', which gets no launcher", "compute_unit")
+ if len(bridge.domains) != 2 or bridge.domains[0] == bridge.domains[1]:
+ raise error(f"joins {bridge.domains}; a bridge joins two different communication domains", "domains")
+ undeclared = [domain for domain in bridge.domains if domain not in ids]
+ if undeclared:
+ raise error(
+ f"references undeclared communication domain(s) {undeclared}; "
+ f"declared communication domains: {list(ids)}",
+ "domains",
+ )
+ other = joined.setdefault(frozenset(bridge.domains), bridge.name)
+ if other != bridge.name:
+ raise error(f"joins {bridge.domains}, which domain bridge '{other}' joins already", "domains")
+ without_id = [domain for domain in bridge.domains if ids[domain] is None]
+ if without_id:
+ raise error(
+ f"joins {without_id}, declared without an identifier; a bridged communication domain needs an 'id'",
+ "domains",
+ )
+ without_prefix = [domain for domain in bridge.domains if not prefixes[domain]]
+ if without_prefix:
+ raise error(
+ f"joins {without_prefix}, declared without a prefix; "
+ "a bridged communication domain needs a 'prefix' for its names in the other domain",
+ "domains",
+ )
+
+
+def apply_domain_bridges(instance: "Instance", config_dir: str) -> None:
+ """Add the process of each declared bridge to the system as a node of the bridge's compute unit.
+
+ *config_dir* is where the launched bridge finds its generated configuration.
+ """
+ from autoware_system_designer.builder.instances.instances import Instance
+
+ system_config = instance.configuration
+ for bridge in system_config.domain_bridges or []:
+ if bridge.name in instance.children:
+ raise ValidationError(f"Domain bridge name '{bridge.name}' conflicts with existing system component name")
+ spec = domain_bridge_types()[bridge.type]
+ bridge_instance = Instance(
+ name=bridge.name, compute_unit=bridge.compute_unit, namespace=[], layer=instance.layer
+ )
+ bridge_instance.parent = instance
+ bridge_instance.entity_type = "node"
+ bridge_instance.launch_manager = LaunchManager(
+ launch_config=LaunchConfig(
+ package_name=spec["package"],
+ node_output="both",
+ executable=spec["executable"],
+ args=f"{config_dir.rstrip('/')}/{domain_bridge_config_file(bridge.name)}",
+ launch_time_args=True,
+ launch_state=LaunchState.SINGLE_NODE,
+ )
+ )
+ instance.children[bridge.name] = bridge_instance
+ logger.info(
+ "Created domain bridge '%s' (type=%s, compute_unit=%s, domains=%s)",
+ bridge.name,
+ bridge.type,
+ bridge.compute_unit,
+ bridge.domains,
+ )
+
+
+def _cross_domain_connections(instance: "Instance") -> Iterator[Tuple[Any, "Instance", Any, "Instance"]]:
+ """Connected node port pairs of the tree as (publishing port, its node, subscribing port, its node)."""
+ nodes = [inst for inst in instance.iter_tree() if inst.entity_type == "node"]
+ owners = {id(port): node for node in nodes for port in node.link_manager.get_all_out_ports()}
+ for node in nodes:
+ for in_port in node.link_manager.get_all_in_ports():
+ for server in in_port.servers:
+ for out_port in server.get_reference_list():
+ owner = owners.get(id(out_port))
+ if owner is not None:
+ yield out_port, owner, in_port, node
+
+
+def domain_bridge_records(instance: "Instance") -> List[Dict[str, Any]]:
+ """Export records of the declared bridges, each with the topics and services it carries and their direction.
+
+ A bridge carries a connection whose two ends run in its two domains: a topic from the publisher's
+ domain to the subscriber's, a service from the server's domain to the client's. A connection crossing
+ domains no bridge joins is reported, as is one a bridge cannot carry. A unit in no domain is no
+ participant of any; it is reported once it connects to a unit in one.
+ """
+ records, issues = _carried_connections(instance, report=True)
+ for issue in issues:
+ logger.warning(issue)
+ return records
+
+
+def domain_bridge_issues(instance: "Instance") -> List[str]:
+ """Defects that leave a connection or a bridge dead at runtime: a connection crossing domains no bridge
+ joins, and a bridge joining a domain where no node runs."""
+ return _carried_connections(instance, report=False)[1]
+
+
+def _populated_domains(instance: "Instance", unit_domains: Dict[str, Optional[str]], bridges: List[Any]) -> set:
+ """Communication domains holding a node of the tree, the bridge processes aside."""
+ bridge_names = {bridge.name for bridge in bridges}
+ return {
+ unit_domains.get(node.compute_unit)
+ for node in instance.iter_tree()
+ if node.entity_type == "node" and not (node.parent is instance and node.name in bridge_names)
+ }
+
+
+def _carried_connections(instance: "Instance", report: bool) -> Tuple[List[Dict[str, Any]], List[str]]:
+ """Bridge records and the defects of ``domain_bridge_issues``; *report* logs the other findings."""
+ system_config = instance.configuration
+ issues: List[str] = []
+ bridges = getattr(system_config, "domain_bridges", None) or []
+ unit_domains = _unit_domains(system_config) if getattr(system_config, "compute_units", None) else {}
+ if not any(unit_domains.values()):
+ return [], issues
+ ids = _domain_ids(system_config)
+ by_domains = {frozenset(bridge.domains): bridge for bridge in bridges}
+ topics: Dict[str, Dict[Tuple[str, str], Dict[str, Any]]] = {bridge.name: {} for bridge in bridges}
+ services: Dict[str, Dict[str, Dict[str, Any]]] = {bridge.name: {} for bridge in bridges}
+ outside: set = set()
+
+ for out_port, publisher, in_port, subscriber in _cross_domain_connections(instance):
+ source = unit_domains.get(publisher.compute_unit)
+ target = unit_domains.get(subscriber.compute_unit)
+ if (source is None) != (target is None):
+ unit, peer = (
+ (publisher.compute_unit, subscriber.compute_unit)
+ if source is None
+ else (subscriber.compute_unit, publisher.compute_unit)
+ )
+ if report and (unit, peer) not in outside:
+ outside.add((unit, peer))
+ logger.warning(
+ f"Compute unit '{unit}' is in no communication domain and connects to '{peer}' in "
+ f"'{source or target}', e.g. '{out_port.port_path}' -> '{in_port.port_path}'"
+ )
+ if source is None or target is None or source == target:
+ continue
+ connection = f"'{out_port.port_path}' -> '{in_port.port_path}'"
+ crossing = f"crosses the communication domains '{source}' -> '{target}'"
+ bridge = by_domains.get(frozenset((source, target)))
+ if bridge is None:
+ issues.append(f"Connection {connection} {crossing}, which no domain bridge joins")
+ continue
+ if {out_port.role, in_port.role} == _SERVICE_ROLES:
+ service = out_port.get_topic()
+ entry = {"service": service, "message_type": out_port.msg_type, "from": source, "to": target}
+ if in_port.get_topic() != service:
+ entry["far_name"] = in_port.get_topic()
+ known = services[bridge.name].setdefault(service, entry)
+ if known["from"] != source:
+ raise ValidationError(
+ f"Service '{service}' has servers in the communication domains '{source}' and "
+ f"'{known['from']}'; domain bridge '{bridge.name}' carries a service from one domain"
+ )
+ continue
+ if out_port.role not in _TOPIC_ROLES or in_port.role not in _TOPIC_ROLES:
+ if report:
+ logger.warning(
+ f"Connection {connection} {crossing}; "
+ f"domain bridge '{bridge.name}' carries topics and services only"
+ )
+ continue
+ topic = out_port.get_topic()
+ shared = topic in bridge.shared_names
+ if in_port.is_global and not (shared and in_port.get_topic() == topic):
+ if report:
+ logger.warning(
+ f"Connection {connection} {crossing} on a topic of the subscriber's own; domain bridge "
+ f"'{bridge.name}' carries it only as a shared name equal to the publisher's"
+ )
+ continue
+ entry = {"topic": topic, "message_type": out_port.msg_type, "from": source, "to": target}
+ if not shared:
+ entry["far_name"] = in_port.get_topic()
+ key = (topic, source)
+ known = topics[bridge.name].setdefault(key, entry)
+ if shared and (topic, target) in topics[bridge.name]:
+ raise ValidationError(
+ f"Shared topic '{topic}' crosses the communication domains '{source}' and '{target}' in both "
+ f"directions; domain bridge '{bridge.name}' would return each message to its origin"
+ )
+
+ populated = _populated_domains(instance, unit_domains, bridges)
+ records = []
+ for bridge in bridges:
+ for domain in bridge.domains:
+ if domain not in populated:
+ issues.append(
+ f"Domain bridge '{bridge.name}' joins the communication domain '{domain}', where no node runs"
+ )
+ record: Dict[str, Any] = {
+ "name": bridge.name,
+ "type": bridge.type,
+ "compute_unit": bridge.compute_unit,
+ "domains": [{"name": domain, "id": ids[domain]} for domain in bridge.domains],
+ "node": instance.children[bridge.name].path,
+ "config_file": domain_bridge_config_file(bridge.name),
+ "topics": sorted(topics[bridge.name].values(), key=lambda entry: (entry["topic"], entry["from"])),
+ "services": sorted(services[bridge.name].values(), key=lambda entry: entry["service"]),
+ }
+ records.append(record)
+ return records, issues
diff --git a/autoware_system_designer/autoware_system_designer/builder/export/instance_to_json.py b/autoware_system_designer/autoware_system_designer/builder/export/instance_to_json.py
index 7b94bd25..2ab16819 100644
--- a/autoware_system_designer/autoware_system_designer/builder/export/instance_to_json.py
+++ b/autoware_system_designer/autoware_system_designer/builder/export/instance_to_json.py
@@ -23,6 +23,8 @@
from datetime import datetime, timezone
from typing import TYPE_CHECKING, Any, Dict
+from autoware_system_designer.builder.compute_units import compute_unit_records
+from autoware_system_designer.builder.domain_bridges import domain_bridge_records
from autoware_system_designer.builder.ee_architecture import peripheral_nodes
from autoware_system_designer.model.export_schema import (
SCHEMA_VERSION,
@@ -140,7 +142,7 @@ def _collect_parameter_files(instance: "Instance") -> list[ParameterFileData]:
def _collect_compute_units(instance: "Instance") -> list[Dict[str, Any]]:
"""Compute units declared by the system config in effect for this mode."""
configuration = getattr(instance, "configuration", None)
- return dump(getattr(configuration, "compute_units", None) or [])
+ return compute_unit_records(configuration) if getattr(configuration, "compute_units", None) else []
def _node_paths(instance: "Instance", paths: set) -> set:
@@ -177,6 +179,9 @@ def collect_system_structure(instance: "Instance", system_name: str, mode: str)
"generated_at": datetime.now(timezone.utc).isoformat(),
"compute_units": _collect_compute_units(instance),
}
+ domain_bridges = domain_bridge_records(instance)
+ if domain_bridges:
+ metadata["domain_bridges"] = domain_bridges
peripherals = _collect_peripherals(instance)
if peripherals:
metadata["peripherals"] = peripherals
diff --git a/autoware_system_designer/autoware_system_designer/builder/export/json_io.py b/autoware_system_designer/autoware_system_designer/builder/export/json_io.py
index 5644634e..503ddeea 100644
--- a/autoware_system_designer/autoware_system_designer/builder/export/json_io.py
+++ b/autoware_system_designer/autoware_system_designer/builder/export/json_io.py
@@ -148,6 +148,17 @@ def launch_target_compute_units(metadata: SystemStructureMetadata) -> List[str]
]
+def compute_unit_domain_ids(metadata: SystemStructureMetadata) -> Dict[str, int]:
+ """Identifier of the communication domain of each declared unit that has one, by unit name."""
+
+ units = metadata.get("compute_units") if isinstance(metadata, dict) else None
+ return {
+ unit["name"]: unit["domain_id"]
+ for unit in (units if isinstance(units, list) else [])
+ if isinstance(unit, dict) and unit.get("name") and isinstance(unit.get("domain_id"), int)
+ }
+
+
def launcher_compute_units(data: InstanceData, metadata: SystemStructureMetadata) -> List[str]:
"""Units a mode gets launchers for: the declared ``onboard`` units, else the units its components reference."""
diff --git a/autoware_system_designer/autoware_system_designer/builder/parameters/parameter_manager.py b/autoware_system_designer/autoware_system_designer/builder/parameters/parameter_manager.py
index 029afe1b..d081c1be 100644
--- a/autoware_system_designer/autoware_system_designer/builder/parameters/parameter_manager.py
+++ b/autoware_system_designer/autoware_system_designer/builder/parameters/parameter_manager.py
@@ -102,7 +102,11 @@ def resolve_substitutions(self, input_string: str, source: Optional[SourceLocati
2. ${output topic_name}
3. ${parameter param_name}
4. $(var ...), $(env ...), $(find-pkg-share ...) if resolver is available
+
+ The elements of a list value are resolved one by one.
"""
+ if isinstance(input_string, list):
+ return [self.resolve_substitutions(element, source) for element in input_string]
if not input_string or not isinstance(input_string, str):
return input_string
@@ -293,7 +297,7 @@ def resolve_all_parameters(self):
"""Resolve any remaining substitutions in all parameters and parameter files."""
# Resolve all parameter values
for param in self.parameters.list:
- if param.value is not None and isinstance(param.value, str) and param.allow_substs:
+ if isinstance(param.value, (str, list)) and param.allow_substs:
resolved_value = self.resolve_substitutions(param.value, source=getattr(param, "source", None))
if resolved_value != param.value:
param.assign(resolved_value, param.data_type)
diff --git a/autoware_system_designer/autoware_system_designer/builder/resolution/variant_resolver.py b/autoware_system_designer/autoware_system_designer/builder/resolution/variant_resolver.py
index b63172c7..8b2c7c3f 100644
--- a/autoware_system_designer/autoware_system_designer/builder/resolution/variant_resolver.py
+++ b/autoware_system_designer/autoware_system_designer/builder/resolution/variant_resolver.py
@@ -17,7 +17,9 @@
from autoware_system_designer.builder.resolution.connection_resolver import filter_connections_by_removed_entities
from autoware_system_designer.model.config import (
+ CommunicationDomain,
ComputeUnit,
+ DomainBridge,
EeArchitectureConfig,
ModuleConfig,
NodeConfig,
@@ -201,7 +203,9 @@ def resolve(self, system_config: SystemConfig, config_yaml: Dict[str, Any]):
{"field": "variable_files", "key_field": None},
{"field": "modes", "key_field": "name"},
{"field": "parameter_sets", "key_field": None}, # Parameter sets are appended
+ {"field": "communication_domains", "key_field": "name", "converter": CommunicationDomain.from_dict},
{"field": "compute_units", "key_field": "name", "converter": ComputeUnit.from_dict},
+ {"field": "domain_bridges", "key_field": "name", "converter": DomainBridge.from_dict},
{"field": "peripherals", "key_field": "name"},
{"field": "components", "key_field": "name"},
{"field": "connections", "key_field": None},
@@ -256,7 +260,9 @@ def _apply_removals(self, system_config: SystemConfig, remove_config: Dict[str,
remove_specs = [
{"field": "modes", "key_field": "name"},
{"field": "parameter_sets", "key_field": None}, # Remove parameter sets by value
+ {"field": "communication_domains", "key_field": "name"},
{"field": "compute_units", "key_field": "name"},
+ {"field": "domain_bridges", "key_field": "name"},
{"field": "peripherals", "key_field": "name"},
{"field": "components", "key_field": "name"},
{"field": "variables", "key_field": "name"},
diff --git a/autoware_system_designer/autoware_system_designer/common/export_layout.py b/autoware_system_designer/autoware_system_designer/common/export_layout.py
index d6d40837..80ec1605 100644
--- a/autoware_system_designer/autoware_system_designer/common/export_layout.py
+++ b/autoware_system_designer/autoware_system_designer/common/export_layout.py
@@ -55,6 +55,15 @@ def config_dir_in_package(self) -> str:
def config_dir(self) -> str:
return os.path.join(self.output_root_dir, self.config_dir_in_package)
+ @property
+ def domain_bridge_dir_in_package(self) -> str:
+ """Generated domain bridge configurations per mode, relative to the package share directory."""
+ return f"exports/{self.system_name}/domain_bridge"
+
+ @property
+ def domain_bridge_dir(self) -> str:
+ return os.path.join(self.output_root_dir, self.domain_bridge_dir_in_package)
+
@property
def parameter_set_dir(self) -> str:
return os.path.join(self.exports_dir, "parameter_set/")
diff --git a/autoware_system_designer/autoware_system_designer/common/naming.py b/autoware_system_designer/autoware_system_designer/common/naming.py
index 6aafe01e..b9eb728a 100644
--- a/autoware_system_designer/autoware_system_designer/common/naming.py
+++ b/autoware_system_designer/autoware_system_designer/common/naming.py
@@ -66,6 +66,9 @@ def generate_unique_id(namespace: list[str], *components: str) -> str:
A sanitized unique identifier string stable across nodes.
"""
parts: list[str] = []
+ domain = getattr(namespace, "domain", "")
+ if domain:
+ parts.append(f"domain:{domain}")
if namespace:
parts.extend(namespace)
for comp in components:
diff --git a/autoware_system_designer/autoware_system_designer/config/domain_bridge_types.yaml b/autoware_system_designer/autoware_system_designer/config/domain_bridge_types.yaml
new file mode 100644
index 00000000..ac6e261a
--- /dev/null
+++ b/autoware_system_designer/autoware_system_designer/config/domain_bridge_types.yaml
@@ -0,0 +1,6 @@
+# Bridge process of each domain bridge type.
+# package, executable: the bridge executable
+
+ros2_domain_bridge:
+ package: domain_bridge
+ executable: domain_bridge
diff --git a/autoware_system_designer/autoware_system_designer/deploy.py b/autoware_system_designer/autoware_system_designer/deploy.py
index 20e4c55d..48ad500d 100644
--- a/autoware_system_designer/autoware_system_designer/deploy.py
+++ b/autoware_system_designer/autoware_system_designer/deploy.py
@@ -32,11 +32,14 @@
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple
+from autoware_system_designer.builder.compute_units import compute_unit_records
from autoware_system_designer.builder.config.config_registry import ConfigRegistry, format_duplicate_report
from autoware_system_designer.builder.deployment_instance import DeploymentInstance
from autoware_system_designer.builder.ee_architecture import peripheral_arguments, resolve_ee_architecture
+from autoware_system_designer.builder.domain_bridges import domain_bridge_issues
from autoware_system_designer.builder.export.instance_to_json import collect_system_structure
from autoware_system_designer.builder.export.json_io import (
+ compute_unit_domain_ids,
extract_system_structure_data,
iter_mode_data,
iter_mode_payloads,
@@ -69,6 +72,7 @@
from autoware_system_designer.generator import build_script_generator
from autoware_system_designer.generator.deploy_launchers import generate_deploy_launchers
from autoware_system_designer.generator.parameter_template_generator import ParameterTemplateGenerator
+from autoware_system_designer.generator.ros2_launcher.domain_bridge_config import write_domain_bridge_configs
from autoware_system_designer.generator.ros2_launcher.generate_module_launcher import generate_module_launch_file
from autoware_system_designer.generator.subsystem_launcher import generate_subsystem_launcher
from autoware_system_designer.generator.subsystem_parameters import PackagePaths
@@ -191,6 +195,7 @@ def __init__(self, deploy_config: DeploymentConfig):
self._package_source_paths: Dict[str, str] = {}
# Undefined $(var ...) references per mode: name -> source locations.
self._undefined_variables: Dict[str, Dict[str, List[str]]] = {}
+ self._domain_bridge_issues: Dict[str, List[str]] = {}
# Values holding $(command ...), by source location, over every mode.
self._command_uses: Dict[str, str] = {}
# Built system structure of each mode.
@@ -206,6 +211,7 @@ def build(self) -> BuildArtifacts:
self._resolve_ee_architectures(system_config, artifacts)
self._check_used_duplicates()
self._check_undefined_variables(artifacts)
+ self._check_domain_bridge_issues()
self._report_command_substitutions()
self._collect_package_resolution(artifacts)
save_artifacts_manifest(artifacts)
@@ -298,7 +304,7 @@ def _init_artifacts(self, system_config: SystemConfig, deploy_variants: List[Dic
deployment_package_name=getattr(self.config_registry, "deployment_package_name", None),
argument_names=self._collect_system_argument_names(system_config),
deploy_variants=deploy_variants,
- compute_units=serde.dump(system_config.compute_units or []),
+ compute_units=compute_unit_records(system_config),
file_package_map=self.config_registry.file_package_map,
config_registry=self.config_registry,
)
@@ -604,10 +610,19 @@ def _build_mode_instance(
self.config_registry,
package_paths=self._package_paths,
snapshot_callback=snapshot_callback,
+ domain_bridge_config_dir=self._domain_bridge_config_dir(artifacts, mode_key),
)
return mode_key, deploy_instance, snapshot_store
+ @staticmethod
+ def _domain_bridge_config_dir(artifacts: BuildArtifacts, mode_key: str) -> str:
+ """Launch-time location of a mode's domain bridge configurations: in the installed deployment package."""
+ if artifacts.deployment_package_name:
+ share = f"$(find-pkg-share {artifacts.deployment_package_name})"
+ return f"{share}/{artifacts.layout.domain_bridge_dir_in_package}/{mode_key}"
+ return str(Path(artifacts.layout.domain_bridge_dir).resolve() / mode_key)
+
def _export_mode_structure(
self, mode_key: str, deploy_instance: DeploymentInstance, artifacts: BuildArtifacts
) -> Dict[str, Any]:
@@ -635,6 +650,9 @@ def _build_modes(self, system_config: SystemConfig, artifacts: BuildArtifacts) -
)
structure_payload = self._export_mode_structure(mode_key, deploy_instance, artifacts)
self._structures[mode_key] = structure_payload["data"]
+ bridge_issues = domain_bridge_issues(deploy_instance)
+ if bridge_issues:
+ self._domain_bridge_issues[mode_key] = bridge_issues
resolver = deploy_instance.parameter_resolver
for location, value in (resolver.command_uses if resolver else {}).items():
self._command_uses.setdefault(location, value)
@@ -680,6 +698,13 @@ def _check_used_duplicates(self) -> None:
f"'->' marks the definition in use:\n" + format_duplicate_report(duplicates)
)
+ def _check_domain_bridge_issues(self) -> None:
+ """Strict gate on cross-domain connections no bridge carries and bridges joining a domain without nodes."""
+ if not self._domain_bridge_issues or not self.config_registry.strict:
+ return
+ lines = [f" [{mode_key}] {issue}" for mode_key, issues in self._domain_bridge_issues.items() for issue in issues]
+ raise ValidationError(f"{len(lines)} domain bridge defect(s):\n" + "\n".join(lines))
+
def _check_undefined_variables(self, artifacts: BuildArtifacts) -> None:
"""Strict gate on $(var ...) references that name no variable, system argument or deployment argument."""
if not self._undefined_variables or not self.config_registry.strict:
@@ -869,6 +894,7 @@ def generate_launchers(artifacts: BuildArtifacts) -> None:
mode_launcher_dir,
forward_args=deploy_variable_names,
compute_units=compute_units,
+ domain_ids=compute_unit_domain_ids(metadata),
)
logger.info(f"Generated launcher for mode: {mode_key}")
@@ -885,6 +911,17 @@ def generate_launchers(artifacts: BuildArtifacts) -> None:
)
+def generate_domain_bridge_configs(artifacts: BuildArtifacts) -> List[str]:
+ """Generate the configuration file of each domain bridge from the exported JSON."""
+ # The tree is wholly generated; configurations of bridges or modes gone from the design go with it.
+ shutil.rmtree(artifacts.layout.domain_bridge_dir, ignore_errors=True)
+ output_paths = []
+ for mode_key, _data, metadata in _iter_mode_payloads(artifacts):
+ mode_dir = export_path(artifacts.layout.domain_bridge_dir, mode_key)
+ output_paths.extend(write_domain_bridge_configs(metadata.get("domain_bridges", []), mode_dir))
+ return output_paths
+
+
def export_parameter_set_templates(artifacts: BuildArtifacts) -> Dict[str, List[str]]:
"""Generate parameter set templates from the exported JSON."""
if not artifacts.mode_keys:
diff --git a/autoware_system_designer/autoware_system_designer/generator/ros2_launcher/domain_bridge_config.py b/autoware_system_designer/autoware_system_designer/generator/ros2_launcher/domain_bridge_config.py
new file mode 100644
index 00000000..622819d5
--- /dev/null
+++ b/autoware_system_designer/autoware_system_designer/generator/ros2_launcher/domain_bridge_config.py
@@ -0,0 +1,71 @@
+# Copyright 2026 TIER IV, inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Configuration files of the ROS 2 ``domain_bridge`` process, written from the exported bridge records."""
+
+import os
+from typing import Any, Dict, List
+
+import yaml
+
+from autoware_system_designer.common.path_utils import export_path
+
+_HEADER = "# This file is auto-generated domain bridge configuration by the Autoware System Designer\n"
+
+
+def domain_bridge_config(record: Dict[str, Any]) -> Dict[str, Any]:
+ """Configuration of one bridge: its first domain is the default origin, topics of the other way are reversed.
+
+ A service names the domain of its server and of its client; the key is absent when the bridge carries none.
+ """
+ origin, destination = record["domains"]
+ ids = {domain["name"]: domain["id"] for domain in record["domains"]}
+ topics: Dict[str, Dict[str, Any]] = {}
+ for entry in record.get("topics", []):
+ topic: Dict[str, Any] = {"type": entry["message_type"]}
+ if entry.get("far_name"):
+ topic["remap"] = entry["far_name"]
+ if entry["from"] != origin["name"]:
+ topic["reversed"] = True
+ topics[entry["topic"]] = topic
+ config: Dict[str, Any] = {
+ "name": record["name"],
+ "from_domain": origin["id"],
+ "to_domain": destination["id"],
+ "topics": topics,
+ }
+ services: Dict[str, Dict[str, Any]] = {}
+ for entry in record.get("services", []):
+ service: Dict[str, Any] = {"type": entry["message_type"]}
+ if entry.get("far_name"):
+ service["remap"] = entry["far_name"]
+ service["from_domain"] = ids[entry["from"]]
+ service["to_domain"] = ids[entry["to"]]
+ services[entry["service"]] = service
+ if services:
+ config["services"] = services
+ return config
+
+
+def write_domain_bridge_configs(records: List[Dict[str, Any]], output_dir: str) -> List[str]:
+ """Write the configuration file of each bridge record into *output_dir*; returns the written paths."""
+ paths = []
+ for record in records:
+ path = export_path(output_dir, record["config_file"])
+ os.makedirs(os.path.dirname(path), exist_ok=True)
+ with open(path, "w") as f:
+ f.write(_HEADER)
+ yaml.safe_dump(domain_bridge_config(record), f, sort_keys=False)
+ paths.append(path)
+ return paths
diff --git a/autoware_system_designer/autoware_system_designer/generator/ros2_launcher/generate_module_launcher.py b/autoware_system_designer/autoware_system_designer/generator/ros2_launcher/generate_module_launcher.py
index d3118a9f..0c6aef1c 100644
--- a/autoware_system_designer/autoware_system_designer/generator/ros2_launcher/generate_module_launcher.py
+++ b/autoware_system_designer/autoware_system_designer/generator/ros2_launcher/generate_module_launcher.py
@@ -17,6 +17,7 @@
from pathlib import Path
from typing import Any, Dict, List
+from autoware_system_designer.common.exceptions import ValidationError
from autoware_system_designer.common.path_utils import export_path
from autoware_system_designer.common.source_location import SourceLocation, format_source
from autoware_system_designer.common.template_renderer import TemplateRenderer
@@ -80,12 +81,27 @@ def _generate_component_launcher(
_render_template_to_file("component_launcher.xml.jinja2", launcher_file, template_data)
+# Domain identifiers of the default DDS port mapping.
+ROS_DOMAIN_ID_MAX = 232
+
+
+def _ros_domain_id(compute_unit: str, domain_id: int | None) -> int | None:
+ """The communication domain identifier of a unit as a ROS domain."""
+ if domain_id is not None and not 0 <= domain_id <= ROS_DOMAIN_ID_MAX:
+ raise ValidationError(
+ f"Compute unit '{compute_unit}': communication domain identifier {domain_id} is no ROS domain "
+ f"(0..{ROS_DOMAIN_ID_MAX})"
+ )
+ return domain_id
+
+
def _generate_compute_unit_launcher(
compute_unit: str,
components: list,
output_dir: str,
forward_args: List[str] | None = None,
component_forward_args: Dict[str, List[str]] | None = None,
+ ros_domain_id: int | None = None,
):
"""Generate compute unit launcher from serialized system structure."""
@@ -107,6 +123,7 @@ def _generate_compute_unit_launcher(
"compute_unit": compute_unit,
"components": components_data,
"forward_args": forward_args or [],
+ "ros_domain_id": ros_domain_id,
}
_render_template_to_file("compute_unit_launcher.xml.jinja2", launcher_file, template_data)
@@ -116,13 +133,15 @@ def generate_module_launch_file(
output_dir: str,
forward_args: List[str] | None = None,
compute_units: List[str] | None = None,
+ domain_ids: Dict[str, int] | None = None,
):
"""Main entry point for launcher generation.
*compute_units* is the list of launchable units; each gets a compute-unit
launcher even when no component of this mode runs on it, and components on
any other unit get none. Without a declaration the units are the ones the
- components reference.
+ components reference. A unit in *domain_ids* launches its nodes in the ROS
+ domain of that identifier.
"""
logger.debug(f"Generating launcher from system structure data in {output_dir}")
@@ -148,6 +167,7 @@ def generate_module_launch_file(
output_dir,
forward_args=forward_args,
component_forward_args=component_args_map,
+ ros_domain_id=_ros_domain_id(compute_unit, (domain_ids or {}).get(compute_unit)),
)
for (compute_unit, component_name), components in component_map.items():
diff --git a/autoware_system_designer/autoware_system_designer/generator/ros2_launcher/templates/compute_unit_launcher.xml.jinja2 b/autoware_system_designer/autoware_system_designer/generator/ros2_launcher/templates/compute_unit_launcher.xml.jinja2
index a02776ca..90fdea87 100644
--- a/autoware_system_designer/autoware_system_designer/generator/ros2_launcher/templates/compute_unit_launcher.xml.jinja2
+++ b/autoware_system_designer/autoware_system_designer/generator/ros2_launcher/templates/compute_unit_launcher.xml.jinja2
@@ -9,6 +9,11 @@
{% endfor %}
+{% if ros_domain_id is not none %}
+
+
+
+{% endif %}
{% for component_info in components %}
diff --git a/autoware_system_designer/autoware_system_designer/model/config.py b/autoware_system_designer/autoware_system_designer/model/config.py
index 5f765a41..05c2c42b 100644
--- a/autoware_system_designer/autoware_system_designer/model/config.py
+++ b/autoware_system_designer/autoware_system_designer/model/config.py
@@ -37,6 +37,53 @@ def from_dict(cls, d: dict) -> "RemapEntry":
COMPUTE_UNIT_NAME_PATTERN = r"^[a-z][a-z0-9_]*$"
+@dataclass
+class CommunicationDomain:
+ """A communication domain declared by the system; compute units join one by name.
+
+ Units of one domain exchange topics directly; units of different domains do not.
+ ``id`` is the identifier the middleware knows the domain by; None leaves it
+ to the environment. ``prefix`` is the name prefix the domain's topics and
+ services take in another domain, across a domain bridge.
+ """
+
+ name: str
+ description: str = ""
+ id: Optional[int] = field(default=None, metadata={"omit_default": True})
+ prefix: Optional[str] = field(default=None, metadata={"omit_default": True})
+
+ @classmethod
+ def from_dict(cls, d: dict) -> "CommunicationDomain":
+ return cls(name=d["name"], description=d.get("description", ""), id=d.get("id"), prefix=d.get("prefix"))
+
+
+@dataclass
+class DomainBridge:
+ """A bridge declared by the system between two of its communication domains.
+
+ The bridge carries every connection whose ends lie in its two domains, in
+ either direction. ``type`` names the bridge process, which runs as a member
+ of ``compute_unit``. A topic or service of ``shared_names`` keeps its name in
+ both domains; every other one takes the prefix of its domain on the far side.
+ """
+
+ name: str
+ type: str
+ compute_unit: str
+ domains: List[str]
+ shared_names: List[str] = field(default_factory=list, metadata={"omit_default": True})
+
+ @classmethod
+ def from_dict(cls, d: dict) -> "DomainBridge":
+ return cls(
+ name=d["name"],
+ type=d.get("type", ""),
+ compute_unit=d.get("compute_unit", ""),
+ domains=list(d.get("domains") or []),
+ shared_names=list(d.get("shared_names") or []),
+ )
+
+
@dataclass
class ComputeUnit:
"""A compute unit declared by the system; components bind to one by name.
@@ -51,12 +98,16 @@ class ComputeUnit:
``requires`` names the capabilities (e.g. ``gpu``) the unit's execution
environment has to provide, whatever hardware that turns out to be.
+
+ ``communication_domain`` names the declared communication domain the unit's
+ nodes run in; None leaves it to the environment the unit is launched in.
"""
name: str
kind: str = "onboard" # one of COMPUTE_UNIT_KINDS
description: str = ""
requires: List[str] = field(default_factory=list)
+ communication_domain: Optional[str] = field(default=None, metadata={"omit_default": True})
@classmethod
def from_dict(cls, d: dict) -> "ComputeUnit":
@@ -71,6 +122,7 @@ def from_dict(cls, d: dict) -> "ComputeUnit":
kind=d.get("kind", "onboard"),
description=d.get("description", ""),
requires=list(requires),
+ communication_domain=d.get("communication_domain"),
)
@@ -235,7 +287,9 @@ class SystemConfig(Config):
modes: Optional[List[ModeDict]] = None
mode_configs: Optional[Dict[str, Dict[str, Any]]] = None # Mode-specific overrides/removals
parameter_sets: Optional[List[str]] = None # System-level parameter sets
+ communication_domains: Optional[List[CommunicationDomain]] = None # Declared domains; None without any
compute_units: Optional[List[ComputeUnit]] = None # Declared units; None when the system declares none
+ domain_bridges: Optional[List[DomainBridge]] = None # Bridges between declared domains; None without any
peripherals: Optional[List[Dict[str, Any]]] = None # Hardware a component talks to, by logical name
components: Optional[List[ComponentDict]] = None
connections: Optional[List[Any]] = None
diff --git a/autoware_system_designer/autoware_system_designer/model/execution.py b/autoware_system_designer/autoware_system_designer/model/execution.py
index e1250e34..f9d3f1fb 100644
--- a/autoware_system_designer/autoware_system_designer/model/execution.py
+++ b/autoware_system_designer/autoware_system_designer/model/execution.py
@@ -59,6 +59,7 @@ def __init__(
container_target: str = "",
launch_state: LaunchState = LaunchState.SINGLE_NODE,
use_intra_process_comms: bool = False,
+ launch_time_args: bool = False,
):
self.package_name = package_name
self.ros2_launch_file = ros2_launch_file
@@ -69,6 +70,8 @@ def __init__(
self.container_target = container_target
self.launch_state = launch_state
self.use_intra_process_comms = use_intra_process_comms
+ # The args hold launch-time substitutions and stay as written at build time.
+ self.launch_time_args = launch_time_args
@classmethod
def from_config(cls, config: Any) -> "LaunchConfig":
diff --git a/autoware_system_designer/autoware_system_designer/model/namespace.py b/autoware_system_designer/autoware_system_designer/model/namespace.py
index e58d8447..7131f95f 100644
--- a/autoware_system_designer/autoware_system_designer/model/namespace.py
+++ b/autoware_system_designer/autoware_system_designer/model/namespace.py
@@ -9,6 +9,9 @@ class Namespace(list[str]):
namespace/path transformations.
"""
+ # Communication domain of the instance on this path; names are unique within one domain.
+ domain: str = ""
+
def __init__(self, segments: Sequence[str] | None = None):
super().__init__(segments or [])
diff --git a/autoware_system_designer/autoware_system_designer/model/ports.py b/autoware_system_designer/autoware_system_designer/model/ports.py
index 6e5eefa3..80246b5a 100644
--- a/autoware_system_designer/autoware_system_designer/model/ports.py
+++ b/autoware_system_designer/autoware_system_designer/model/ports.py
@@ -168,6 +168,8 @@ def __init__(
super().__init__(name, msg_type, namespace, remap_target, role)
self.servers = []
self._server_ids: Set[int] = set()
+ # Name of the topic in this port's communication domain when a domain bridge renames it.
+ self.bridged_topic: List[str] = []
self.event = PortEvent("input_" + name, self.namespace, "input", name)
self.event.set_type("on_input")
@@ -189,7 +191,12 @@ def set_servers(self, port_list: List[Port]):
@property
def topic(self) -> List[str]:
- """The publisher's topic; a global node subscriber keeps its own, an unconnected interface port has none."""
+ """The publisher's topic; a global node subscriber keeps its own, an unconnected interface port has none.
+
+ A port fed across a domain bridge holds the name the bridge gives the topic in its domain.
+ """
+ if self.bridged_topic:
+ return self.bridged_topic
if self.servers and not (self.is_global and self.own_topic):
return self.servers[0].topic
return self.own_topic
diff --git a/autoware_system_designer/autoware_system_designer/parser/data_parser.py b/autoware_system_designer/autoware_system_designer/parser/data_parser.py
index 07228e48..bdacd25c 100644
--- a/autoware_system_designer/autoware_system_designer/parser/data_parser.py
+++ b/autoware_system_designer/autoware_system_designer/parser/data_parser.py
@@ -20,11 +20,13 @@
from autoware_system_designer.common.parameter_types import coerce_numeric_value, normalize_type_name
from autoware_system_designer.common.source_location import SourceLocation, format_source, lookup_source
from autoware_system_designer.model.config import (
+ CommunicationDomain,
ComputeUnit,
Config,
ConfigSubType,
ConfigType,
DeviceConfig,
+ DomainBridge,
EeArchitectureConfig,
ModuleConfig,
NodeConfig,
@@ -320,6 +322,8 @@ def _create_entity_data(
raw_remaps = config.get("remaps") or []
raw_compute_units = config.get("compute_units")
+ raw_domains = config.get("communication_domains")
+ raw_bridges = config.get("domain_bridges")
return SystemConfig(
**base_data,
base=base_name,
@@ -328,9 +332,13 @@ def _create_entity_data(
modes=config.get("modes"),
mode_configs=mode_configs if mode_configs else None,
parameter_sets=config.get("parameter_sets"),
+ communication_domains=(
+ [CommunicationDomain.from_dict(d) for d in raw_domains] if raw_domains is not None else None
+ ),
compute_units=(
[ComputeUnit.from_dict(u) for u in raw_compute_units] if raw_compute_units is not None else None
),
+ domain_bridges=([DomainBridge.from_dict(b) for b in raw_bridges] if raw_bridges is not None else None),
peripherals=config.get("peripherals"),
components=config.get("components"),
connections=config.get("connections"),
diff --git a/autoware_system_designer/autoware_system_designer/schema/0.5.0/system.json b/autoware_system_designer/autoware_system_designer/schema/0.5.0/system.json
index 8bbb6570..1ee9297c 100644
--- a/autoware_system_designer/autoware_system_designer/schema/0.5.0/system.json
+++ b/autoware_system_designer/autoware_system_designer/schema/0.5.0/system.json
@@ -107,6 +107,35 @@
"peripherals": {
"description": "Experimental (E/E architecture): hardware outside the compute units that components talk to, by logical name; an E/E architecture binds each name to a device. Entries are not checked against a schema"
},
+ "communication_domains": {
+ "type": "array",
+ "description": "Communication domains of the system. Compute units of one domain exchange topics directly; units of different domains do not",
+ "items": {
+ "type": "object",
+ "required": ["name"],
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[a-z][a-z0-9_]*$",
+ "description": "Lowercase letters, digits and underscores, starting with a letter; referenced by compute_units[].communication_domain"
+ },
+ "description": {
+ "type": "string"
+ },
+ "id": {
+ "type": "integer",
+ "minimum": 0,
+ "description": "Identifier the middleware knows the domain by; the launcher and the runtime hand it to the nodes of the domain's units. Without it the domain is the one of the environment its units are launched in"
+ },
+ "prefix": {
+ "type": "string",
+ "pattern": "^(/[a-z][a-z0-9_]*)+$",
+ "description": "Name prefix the topics and services of this domain take in another domain, across a domain bridge; required on a bridged domain"
+ }
+ },
+ "additionalProperties": false
+ }
+ },
"compute_units": {
"type": "array",
"items": {
@@ -128,6 +157,10 @@
},
"requires": {
"description": "Experimental (E/E architecture): capabilities the unit's execution environment has to provide (e.g. gpu); not checked against a schema"
+ },
+ "communication_domain": {
+ "type": "string",
+ "description": "Name of the declared communication domain the unit's nodes run in; without it the unit runs in the domain of the environment it is launched in"
}
},
"additionalProperties": false
@@ -198,6 +231,44 @@
]
}
},
+ "domain_bridges": {
+ "type": "array",
+ "description": "Bridges between communication domains. A bridge carries every connection whose ends lie in its two domains, in either direction",
+ "items": {
+ "type": "object",
+ "required": ["name", "type", "compute_unit", "domains"],
+ "properties": {
+ "name": {
+ "type": "string",
+ "pattern": "^[a-z][a-z0-9_]*$",
+ "description": "Lowercase letters, digits and underscores, starting with a letter; the bridge process takes it as its name"
+ },
+ "type": {
+ "type": "string",
+ "description": "Bridge process, one of the types the designer declares in config/domain_bridge_types.yaml"
+ },
+ "compute_unit": {
+ "type": "string",
+ "description": "Declared compute unit the bridge process runs on"
+ },
+ "domains": {
+ "type": "array",
+ "description": "The two declared communication domains the bridge joins; both need an id",
+ "items": { "type": "string" },
+ "minItems": 2,
+ "maxItems": 2,
+ "uniqueItems": true
+ },
+ "shared_names": {
+ "type": "array",
+ "description": "Topics and services the bridge carries under one name in both domains; every other one takes the prefix of its domain on the far side",
+ "items": { "type": "string", "pattern": "^/" },
+ "uniqueItems": true
+ }
+ },
+ "additionalProperties": false
+ }
+ },
"node_groups": {
"type": "array",
"items": {
diff --git a/autoware_system_designer/autoware_system_designer/schema/yaml_schema.py b/autoware_system_designer/autoware_system_designer/schema/yaml_schema.py
index 444fb07d..2c8ee110 100644
--- a/autoware_system_designer/autoware_system_designer/schema/yaml_schema.py
+++ b/autoware_system_designer/autoware_system_designer/schema/yaml_schema.py
@@ -236,6 +236,98 @@ def _system_compute_unit_semantics(config: Dict[str, Any]) -> Iterable[SchemaIss
return issues
+def _system_communication_domain_semantics(config: Dict[str, Any]) -> Iterable[SchemaIssue]:
+ """Declared communication domains are unique and every compute unit's domain is a declared one.
+
+ A variant file inherits the declarations from its base and is checked on the resolved system at build time.
+ """
+ if "base" in config:
+ return []
+ domains = config.get("communication_domains")
+ domains = domains if isinstance(domains, list) else []
+ issues: List[SchemaIssue] = []
+ names: List[str] = []
+ for idx, domain in enumerate(domains):
+ if not isinstance(domain, dict):
+ continue
+ name = domain.get("name")
+ if name in names:
+ issues.append(
+ SchemaIssue(
+ message=f"Duplicate communication domain '{name}'", yaml_path=f"/communication_domains/{idx}/name"
+ )
+ )
+ names.append(name)
+ units = config.get("compute_units")
+ for idx, unit in enumerate(units if isinstance(units, list) else []):
+ domain = unit.get("communication_domain") if isinstance(unit, dict) else None
+ if domain is not None and domain not in names:
+ issues.append(
+ SchemaIssue(
+ message=(
+ f"Compute unit '{unit.get('name')}' references undeclared communication domain '{domain}'; "
+ f"declared communication domains: {names}"
+ ),
+ yaml_path=f"/compute_units/{idx}/communication_domain",
+ )
+ )
+ return issues
+
+
+def _system_domain_bridge_semantics(config: Dict[str, Any]) -> Iterable[SchemaIssue]:
+ """Declared domain bridges are unique, join declared domains and run on a declared compute unit.
+
+ A variant file inherits the declarations from its base and is checked on the resolved system at build time.
+ """
+ if "base" in config:
+ return []
+ bridges = config.get("domain_bridges")
+ if not isinstance(bridges, list):
+ return []
+
+ def declared(field: str) -> List[Any]:
+ entries = config.get(field)
+ return [entry.get("name") for entry in entries if isinstance(entry, dict)] if isinstance(entries, list) else []
+
+ domains = declared("communication_domains")
+ units = declared("compute_units")
+ issues: List[SchemaIssue] = []
+ names: List[Any] = []
+ for idx, bridge in enumerate(bridges):
+ if not isinstance(bridge, dict):
+ continue
+ name = bridge.get("name")
+ if name in names:
+ issues.append(
+ SchemaIssue(message=f"Duplicate domain bridge '{name}'", yaml_path=f"/domain_bridges/{idx}/name")
+ )
+ names.append(name)
+ bridge_domains = bridge.get("domains")
+ for domain in bridge_domains if isinstance(bridge_domains, list) else []:
+ if domain not in domains:
+ issues.append(
+ SchemaIssue(
+ message=(
+ f"Domain bridge '{name}' references undeclared communication domain '{domain}'; "
+ f"declared communication domains: {domains}"
+ ),
+ yaml_path=f"/domain_bridges/{idx}/domains",
+ )
+ )
+ unit = bridge.get("compute_unit")
+ if unit is not None and unit not in units:
+ issues.append(
+ SchemaIssue(
+ message=(
+ f"Domain bridge '{name}' references undeclared compute unit '{unit}'; "
+ f"declared compute units: {units}"
+ ),
+ yaml_path=f"/domain_bridges/{idx}/compute_unit",
+ )
+ )
+ return issues
+
+
def _variant_forbidden_root_fields_semantics(
*,
forbidden_fields: Sequence[str],
@@ -312,11 +404,15 @@ def get_semantic_checks(
return (
_format_version_semantics,
_system_compute_unit_semantics,
+ _system_communication_domain_semantics,
+ _system_domain_bridge_semantics,
_variant_forbidden_root_fields_semantics(
forbidden_fields=(
"modes",
"parameter_sets",
+ "communication_domains",
"compute_units",
+ "domain_bridges",
"peripherals",
"components",
"connections",
diff --git a/autoware_system_designer/script/deployment_process.py b/autoware_system_designer/script/deployment_process.py
index ba314df1..9e720117 100644
--- a/autoware_system_designer/script/deployment_process.py
+++ b/autoware_system_designer/script/deployment_process.py
@@ -25,6 +25,7 @@
export_parameter_set_templates,
export_reference_latency,
generate_build_scripts,
+ generate_domain_bridge_configs,
generate_launchers,
generate_subsystem_launch_file,
)
@@ -101,6 +102,9 @@ def build(
logger.info("Autoware System Designer: Generating launch files...")
generate_launchers(artifacts)
+ logger.info("Autoware System Designer: Generating domain bridge configurations...")
+ generate_domain_bridge_configs(artifacts)
+
logger.info("Autoware System Designer: Generating build scripts...")
generate_build_scripts(artifacts)
diff --git a/autoware_system_designer/test/test_compute_units.py b/autoware_system_designer/test/test_compute_units.py
index 0c8b3c08..0c39f7ba 100644
--- a/autoware_system_designer/test/test_compute_units.py
+++ b/autoware_system_designer/test/test_compute_units.py
@@ -17,10 +17,10 @@
import pytest
from pipeline_harness import run_pipeline, stage_case
-from autoware_system_designer.builder.compute_units import check_component_compute_units
+from autoware_system_designer.builder.compute_units import check_communication_domains, check_component_compute_units
from autoware_system_designer.common.exceptions import ValidationError
from autoware_system_designer.deploy import load_build_artifacts
-from autoware_system_designer.model.config import ComputeUnit
+from autoware_system_designer.model.config import CommunicationDomain, ComputeUnit
from autoware_system_designer.parser.data_parser import ConfigParser
from autoware_system_designer.schema.yaml_schema import get_semantic_checks
@@ -300,3 +300,115 @@ def test_export_carries_the_reference_latency_and_no_visualization(tmp_path):
assert sorted(p.name for p in exported.iterdir()) == ["default_latency.json"]
assert (exported / "default_latency.json").read_text() == (latency_dir / "default_latency.json").read_text()
assert not (run.exports_dir / "visualization").exists()
+
+
+DOMAIN_SYSTEM = """\
+autoware_system_design_format: 0.5.0
+
+name: Probe.system
+
+communication_domains:
+ - name: main
+ id: {main_id}
+ - name: mrm
+ id: {mrm_id}
+ - name: free
+
+compute_units:
+ - name: main_ecu
+ communication_domain: {unit_domain}
+
+components:
+ - name: a
+ entity: A.node
+ compute_unit: main_ecu
+
+connections: []
+"""
+
+
+def _domain_system(tmp_path, main_id="1", mrm_id="3", unit_domain="main"):
+ path = tmp_path / "Probe.system.yaml"
+ path.write_text(DOMAIN_SYSTEM.format(main_id=main_id, mrm_id=mrm_id, unit_domain=unit_domain))
+ return path
+
+
+def test_parser_builds_typed_communication_domains(tmp_path):
+ config = ConfigParser().parse_entity_file(str(_domain_system(tmp_path)))
+ assert config.communication_domains == [
+ CommunicationDomain(name="main", id=1),
+ CommunicationDomain(name="mrm", id=3),
+ CommunicationDomain(name="free"),
+ ]
+ assert config.compute_units == [ComputeUnit(name="main_ecu", communication_domain="main")]
+ check_communication_domains(config)
+
+
+@pytest.mark.parametrize("value", ["-1", "1.5", "true", '"1"'])
+def test_invalid_domain_id_is_rejected_by_schema(tmp_path, value):
+ with pytest.raises(ValidationError) as excinfo:
+ ConfigParser().parse_entity_file(str(_domain_system(tmp_path, main_id=value)))
+ assert "/communication_domains/0/id" in str(excinfo.value)
+
+
+def test_undeclared_domain_of_a_unit_is_an_issue(tmp_path):
+ text = DOMAIN_SYSTEM.format(main_id=1, mrm_id=3, unit_domain="ghost")
+ issues = _system_issues(text)
+ assert [issue.yaml_path for issue in issues] == ["/compute_units/0/communication_domain"]
+ assert "ghost" in issues[0].message
+
+
+def test_resolved_check_rejects_shared_identifiers_and_undeclared_domains(tmp_path):
+ config = ConfigParser().parse_entity_file(str(_domain_system(tmp_path)))
+ config.compute_units.append(ComputeUnit(name="late_ecu", communication_domain="ghost"))
+ with pytest.raises(ValidationError) as excinfo:
+ check_communication_domains(config)
+ assert "late_ecu" in str(excinfo.value) and "ghost" in str(excinfo.value)
+
+ config = ConfigParser().parse_entity_file(str(_domain_system(tmp_path)))
+ config.communication_domains[1].id = 1
+ with pytest.raises(ValidationError) as excinfo:
+ check_communication_domains(config)
+ assert "'main' and 'mrm'" in str(excinfo.value)
+
+
+def _stage_multi_with_domains(tmp_path, sub_id=2):
+ workspace = stage_case("compute_units", tmp_path)
+ system = workspace / "units_pkg" / "Multi.system.yaml"
+ text = system.read_text()
+ text = text.replace(
+ "compute_units:\n",
+ f"communication_domains:\n - name: sub\n id: {sub_id}\n - name: free\n\ncompute_units:\n",
+ )
+ text = text.replace(" - name: sub_ecu\n", " - name: sub_ecu\n communication_domain: sub\n")
+ text = text.replace(" - name: remote_ecu\n", " - name: remote_ecu\n communication_domain: free\n")
+ system.write_text(text)
+ return workspace
+
+
+def test_unit_launcher_sets_the_identifier_of_the_unit_domain(tmp_path):
+ workspace = _stage_multi_with_domains(tmp_path)
+ run = run_pipeline(workspace, "units_pkg/Multi.system.yaml", tmp_path)
+
+ artifacts = load_build_artifacts(str(run.out_root), run.system_name)
+ assert [unit.get("communication_domain") for unit in artifacts.compute_units] == [None, "sub", "free"]
+ assert [unit.get("domain_id") for unit in artifacts.compute_units] == [None, 2, None]
+ # A unit declaring no domain exports no entry for it, a domain without an identifier none for that.
+ assert "communication_domain" not in artifacts.compute_units[0]
+ assert "domain_id" not in artifacts.compute_units[2]
+
+ for mode in ("default", "solo"):
+ units = {unit["name"]: unit for unit in run.structure(mode)["metadata"]["compute_units"]}
+ assert units["sub_ecu"]["communication_domain"] == "sub" and units["sub_ecu"]["domain_id"] == 2
+ assert "communication_domain" not in units["main_ecu"]
+ sub = (run.launcher_dir(mode) / "sub_ecu" / "sub_ecu.launch.xml").read_text()
+ assert '' in sub
+ main = (run.launcher_dir(mode) / "main_ecu" / "main_ecu.launch.xml").read_text()
+ assert "ROS_DOMAIN_ID" not in main
+
+
+def test_launcher_rejects_an_identifier_that_is_no_ros_domain(tmp_path):
+ workspace = _stage_multi_with_domains(tmp_path, sub_id=233)
+ with pytest.raises(Exception) as excinfo:
+ run_pipeline(workspace, "units_pkg/Multi.system.yaml", tmp_path)
+ assert "233" in str(excinfo.value) and "sub_ecu" in str(excinfo.value)
diff --git a/autoware_system_designer/test/test_domain_bridges.py b/autoware_system_designer/test/test_domain_bridges.py
new file mode 100644
index 00000000..134db959
--- /dev/null
+++ b/autoware_system_designer/test/test_domain_bridges.py
@@ -0,0 +1,345 @@
+# Copyright 2026 TIER IV, inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Domain bridges: declaration checks, the connections a bridge carries, and its generated process."""
+
+import pytest
+import yaml
+from pipeline_harness import run_pipeline, stage_case
+
+from autoware_system_designer.builder.domain_bridges import check_domain_bridges
+from autoware_system_designer.common.exceptions import ValidationError
+from autoware_system_designer.model.config import DomainBridge
+from autoware_system_designer.parser.data_parser import ConfigParser
+from autoware_system_designer.schema.yaml_schema import get_semantic_checks
+
+BRIDGE_SYSTEM = """\
+autoware_system_design_format: 0.5.0
+
+name: Probe.system
+
+communication_domains:
+ - name: main
+ id: 1
+ prefix: /main
+ - name: mrm
+ id: 3
+ prefix: /mrm
+ - name: free
+
+compute_units:
+ - name: main_ecu
+ communication_domain: main
+ - name: mrm_ecu
+ communication_domain: mrm
+ - name: remote_ecu
+ kind: offboard
+ communication_domain: main
+
+domain_bridges:
+ - name: mrm_bridge
+ type: ros2_domain_bridge
+ compute_unit: main_ecu
+ domains: [main, mrm]
+
+components:
+ - name: a
+ entity: A.node
+ compute_unit: main_ecu
+
+connections: []
+"""
+
+
+def _parse(tmp_path, text=BRIDGE_SYSTEM):
+ path = tmp_path / "Probe.system.yaml"
+ path.write_text(text)
+ return ConfigParser().parse_entity_file(str(path))
+
+
+def _system_issues(text: str):
+ config = yaml.safe_load(text)
+ issues = []
+ for check in get_semantic_checks("system"):
+ issues.extend(check(config))
+ return [issue for issue in issues if issue.yaml_path != "/autoware_system_design_format"]
+
+
+def test_parser_builds_typed_domain_bridges(tmp_path):
+ config = _parse(tmp_path)
+ assert config.domain_bridges == [
+ DomainBridge(name="mrm_bridge", type="ros2_domain_bridge", compute_unit="main_ecu", domains=["main", "mrm"])
+ ]
+ check_domain_bridges(config)
+ assert _system_issues(BRIDGE_SYSTEM) == []
+
+
+@pytest.mark.parametrize(
+ "old, new, path",
+ [
+ ("domains: [main, mrm]", "domains: [main]", "/domain_bridges/0/domains"),
+ ("domains: [main, mrm]", "domains: [main, main]", "/domain_bridges/0/domains"),
+ (" compute_unit: main_ecu\n domains", " domains", "/domain_bridges/0"),
+ ("name: mrm_bridge", "name: MrmBridge", "/domain_bridges/0/name"),
+ ],
+)
+def test_malformed_bridge_is_rejected_by_schema(tmp_path, old, new, path):
+ with pytest.raises(ValidationError) as excinfo:
+ _parse(tmp_path, BRIDGE_SYSTEM.replace(old, new))
+ assert path in str(excinfo.value)
+
+
+def test_undeclared_references_of_a_bridge_are_issues():
+ text = BRIDGE_SYSTEM.replace("domains: [main, mrm]", "domains: [main, ghost]").replace(
+ " compute_unit: main_ecu\n domains", " compute_unit: lost_ecu\n domains"
+ )
+ issues = _system_issues(text)
+ assert [issue.yaml_path for issue in issues] == ["/domain_bridges/0/domains", "/domain_bridges/0/compute_unit"]
+ assert "ghost" in issues[0].message and "lost_ecu" in issues[1].message
+
+
+@pytest.mark.parametrize(
+ "change, message",
+ [
+ (lambda bridge: setattr(bridge, "type", "pipe"), "unsupported type 'pipe'"),
+ (lambda bridge: setattr(bridge, "compute_unit", "lost_ecu"), "undeclared compute unit 'lost_ecu'"),
+ (lambda bridge: setattr(bridge, "compute_unit", "remote_ecu"), "offboard compute unit 'remote_ecu'"),
+ (lambda bridge: setattr(bridge, "domains", ["main", "ghost"]), "undeclared communication domain(s) ['ghost']"),
+ (lambda bridge: setattr(bridge, "domains", ["main", "free"]), "['free'], declared without an identifier"),
+ ],
+)
+def test_resolved_check_rejects_a_bridge_that_cannot_run(tmp_path, change, message):
+ config = _parse(tmp_path)
+ change(config.domain_bridges[0])
+ with pytest.raises(ValidationError) as excinfo:
+ check_domain_bridges(config)
+ assert "mrm_bridge" in str(excinfo.value) and message in str(excinfo.value)
+
+
+def test_resolved_check_rejects_two_bridges_of_one_domain_pair(tmp_path):
+ config = _parse(tmp_path)
+ config.domain_bridges.append(
+ DomainBridge(name="second", type="ros2_domain_bridge", compute_unit="main_ecu", domains=["mrm", "main"])
+ )
+ with pytest.raises(ValidationError) as excinfo:
+ check_domain_bridges(config)
+ assert "'second'" in str(excinfo.value) and "'mrm_bridge' joins already" in str(excinfo.value)
+
+
+def _stage_multi_with_bridge(tmp_path, bridge=True):
+ """Multi with the talker in ``main``, the listener in ``sub`` and the offboard monitor in ``far``."""
+ workspace = stage_case("compute_units", tmp_path)
+ system = workspace / "units_pkg" / "Multi.system.yaml"
+ text = system.read_text()
+ bridges = (
+ "domain_bridges:\n - name: sub_bridge\n type: ros2_domain_bridge\n compute_unit: main_ecu\n"
+ " domains: [sub, main]\n\n"
+ )
+ text = text.replace(
+ "compute_units:\n",
+ "communication_domains:\n - name: main\n id: 1\n prefix: /main\n - name: sub\n id: 2\n prefix: /sub\n"
+ " - name: far\n id: 9\n\n"
+ + (bridges if bridge else "")
+ + "compute_units:\n",
+ )
+ text = text.replace(" - name: main_ecu\n", " - name: main_ecu\n communication_domain: main\n")
+ text = text.replace(" - name: sub_ecu\n", " - name: sub_ecu\n communication_domain: sub\n")
+ text = text.replace(" - name: remote_ecu\n", " - name: remote_ecu\n communication_domain: far\n")
+ system.write_text(text)
+ return workspace
+
+
+def test_bridge_carries_the_connections_between_its_domains(tmp_path, capfd):
+ workspace = _stage_multi_with_bridge(tmp_path)
+ run = run_pipeline(workspace, "units_pkg/Multi.system.yaml", tmp_path)
+
+ (record,) = run.structure("default")["metadata"]["domain_bridges"]
+ assert record["name"] == "sub_bridge" and record["compute_unit"] == "main_ecu"
+ assert record["domains"] == [{"name": "sub", "id": 2}, {"name": "main", "id": 1}]
+ assert record["node"] == "/sub_bridge"
+ (topic,) = record["topics"]
+ assert (topic["from"], topic["to"]) == ("main", "sub")
+ assert topic["message_type"] == "std_msgs/msg/String"
+
+ # The first domain of the bridge is the origin of its file; the talker's topic runs the other way.
+ config_path = run.exports_dir / "domain_bridge" / "default" / "sub_bridge.yaml"
+ config = yaml.safe_load(config_path.read_text())
+ assert config == {
+ "name": "sub_bridge",
+ "from_domain": 2,
+ "to_domain": 1,
+ "topics": {topic["topic"]: {"type": "std_msgs/msg/String", "remap": topic["far_name"], "reversed": True}},
+ }
+ # The listener reads the topic under the prefix of the talker's domain.
+ assert topic["far_name"] == "/main" + topic["topic"]
+ listener = (run.launcher_dir("default") / "sub_ecu").rglob("*.launch.xml")
+ assert any(f'to="{topic["far_name"]}"' in path.read_text() for path in listener)
+
+ # The bridge is a member of its unit, started on its configuration in the installed deployment package.
+ node = next(child for child in run.structure("default")["data"]["children"] if child["name"] == "sub_bridge")
+ assert node["compute_unit"] == "main_ecu" and node["package"] == "domain_bridge"
+ args = "$(find-pkg-share units_pkg)/exports/Multi/domain_bridge/default/sub_bridge.yaml"
+ assert node["launcher"]["args"] == args
+ launcher = (run.launcher_dir("default") / "main_ecu" / "sub_bridge" / "sub_bridge.launch.xml").read_text()
+ assert 'exec="domain_bridge" name="sub_bridge"' in launcher
+ assert f'args="{args}"' in launcher
+
+ # No bridge joins the domain of the offboard monitor.
+ unbridged = [line for line in capfd.readouterr().err.splitlines() if "no domain bridge joins" in line]
+ assert unbridged and all("'main' -> 'far'" in line for line in unbridged)
+
+ # Without the listener the bridge stays and carries nothing.
+ (solo,) = run.structure("solo")["metadata"]["domain_bridges"]
+ assert solo["topics"] == []
+ assert yaml.safe_load((run.exports_dir / "domain_bridge" / "solo" / "sub_bridge.yaml").read_text())["topics"] == {}
+
+
+def test_system_without_bridges_exports_none(tmp_path, capfd):
+ workspace = _stage_multi_with_bridge(tmp_path, bridge=False)
+ run = run_pipeline(workspace, "units_pkg/Multi.system.yaml", tmp_path)
+ assert "domain_bridges" not in run.structure("default")["metadata"]
+ assert not list((run.exports_dir / "domain_bridge").rglob("*.yaml"))
+ assert "'main' -> 'sub', which no domain bridge joins" in capfd.readouterr().err
+
+
+def test_unit_in_no_domain_is_reported_once_it_connects_to_a_unit_in_one(tmp_path, capfd):
+ workspace = _stage_multi_with_bridge(tmp_path)
+ system = workspace / "units_pkg" / "Multi.system.yaml"
+ system.write_text(
+ system.read_text().replace(" - name: sub_ecu\n communication_domain: sub\n", " - name: sub_ecu\n")
+ )
+ run = run_pipeline(workspace, "units_pkg/Multi.system.yaml", tmp_path)
+
+ reported = [line for line in capfd.readouterr().err.splitlines() if "is in no communication domain" in line]
+ # Once per mode that holds the connection; the solo mode has no listener.
+ assert len(reported) == 1
+ assert "'sub_ecu'" in reported[0] and "'main_ecu' in 'main'" in reported[0]
+ assert run.structure("default")["metadata"]["domain_bridges"][0]["topics"] == []
+
+
+_SERVICE_NODE = """\
+autoware_system_design_format: 0.4.0
+name: {name}.node
+package:
+ name: units_pkg
+ provider: dummy
+launch:
+ plugin: units::{name}
+ executable: {executable}
+subscribers: []
+publishers: []
+{kind}:
+ - name: reset
+ message_type: std_srvs/srv/Trigger
+param_files: []
+param_values: []
+processes: []
+"""
+
+
+def test_bridge_carries_a_service_from_the_domain_of_its_server(tmp_path, capfd):
+ workspace = _stage_multi_with_bridge(tmp_path)
+ package = workspace / "units_pkg"
+ (package / "Resetter.node.yaml").write_text(
+ _SERVICE_NODE.format(name="Resetter", executable="resetter_node", kind="servers")
+ )
+ (package / "Operator.node.yaml").write_text(
+ _SERVICE_NODE.format(name="Operator", executable="operator_node", kind="clients")
+ )
+ system = package / "Multi.system.yaml"
+ text = system.read_text().replace(
+ "connections:\n",
+ " - name: resetter\n entity: Resetter.node\n compute_unit: sub_ecu\n"
+ " - name: operator\n entity: Operator.node\n compute_unit: main_ecu\n\n"
+ "connections:\n - - resetter.server.reset\n - operator.client.reset\n",
+ )
+ system.write_text(text)
+ run = run_pipeline(workspace, "units_pkg/Multi.system.yaml", tmp_path)
+
+ (record,) = run.structure("default")["metadata"]["domain_bridges"]
+ (service,) = record["services"]
+ assert (service["from"], service["to"]) == ("sub", "main")
+ assert service["message_type"] == "std_srvs/srv/Trigger"
+
+ # A service names both domains itself, whichever is the origin of the file.
+ config = yaml.safe_load((run.exports_dir / "domain_bridge" / "default" / "sub_bridge.yaml").read_text())
+ assert config["services"] == {
+ service["service"]: {
+ "type": "std_srvs/srv/Trigger",
+ "remap": "/to_sub" + service["service"],
+ "from_domain": 2,
+ "to_domain": 1,
+ }
+ }
+ assert service["far_name"] == "/to_sub" + service["service"]
+ assert len(config["topics"]) == 1
+ assert "carries topics and services only" not in capfd.readouterr().err
+
+
+def test_strict_build_rejects_a_connection_no_bridge_joins(tmp_path):
+ workspace = _stage_multi_with_bridge(tmp_path)
+ with pytest.raises(Exception, match=r"\[default\] Connection .* 'main' -> 'far', which no domain bridge joins"):
+ run_pipeline(workspace, "units_pkg/Multi.system.yaml", tmp_path, strict=True)
+
+
+def test_bridge_of_a_domain_emptied_by_a_mode_is_a_defect(tmp_path, capfd):
+ workspace = _stage_multi_with_bridge(tmp_path)
+ run_pipeline(workspace, "units_pkg/Multi.system.yaml", tmp_path)
+ # The solo mode drops the listener, the only node of the bridged ``sub`` domain.
+ empty = [line for line in capfd.readouterr().err.splitlines() if "where no node runs" in line]
+ assert len(empty) == 1 and "'sub_bridge'" in empty[0] and "'sub'" in empty[0]
+
+ with pytest.raises(Exception, match=r"\[solo\] Domain bridge 'sub_bridge' joins the communication domain 'sub'"):
+ run_pipeline(workspace, "units_pkg/Multi.system.yaml", tmp_path / "strict", strict=True)
+
+
+def test_shared_name_crosses_a_bridge_unchanged(tmp_path):
+ workspace = _stage_multi_with_bridge(tmp_path)
+ plain = run_pipeline(workspace, "units_pkg/Multi.system.yaml", tmp_path / "plain")
+ (topic,) = plain.structure("default")["metadata"]["domain_bridges"][0]["topics"]
+
+ system = workspace / "units_pkg" / "Multi.system.yaml"
+ system.write_text(
+ system.read_text().replace(
+ " domains: [sub, main]\n", f" domains: [sub, main]\n shared_names: [{topic['topic']}]\n"
+ )
+ )
+ run = run_pipeline(workspace, "units_pkg/Multi.system.yaml", tmp_path / "shared")
+ (shared,) = run.structure("default")["metadata"]["domain_bridges"][0]["topics"]
+ assert "far_name" not in shared
+ config = yaml.safe_load((run.exports_dir / "domain_bridge" / "default" / "sub_bridge.yaml").read_text())
+ assert config["topics"] == {topic["topic"]: {"type": "std_msgs/msg/String", "reversed": True}}
+
+
+def test_bridged_domain_needs_a_prefix(tmp_path):
+ config = _parse(tmp_path, BRIDGE_SYSTEM.replace(" prefix: /mrm\n", ""))
+ with pytest.raises(ValidationError, match=r"joins \['mrm'\], declared without a prefix"):
+ check_domain_bridges(config)
+
+
+def test_two_domains_hold_a_node_of_one_path(tmp_path):
+ workspace = _stage_multi_with_bridge(tmp_path)
+ system = workspace / "units_pkg" / "Multi.system.yaml"
+ text = system.read_text()
+ assert " - name: talker\n" in text
+ component = text[text.index(" - name: talker\n") :].split("\n - name:")[0]
+ twin = component.replace(" - name: talker\n", " - name: talker_twin\n").replace("main_ecu", "sub_ecu")
+ twin += "\n path: /talker" if "path:" not in twin else ""
+ system.write_text(text.replace(component, component + "\n" + twin.rstrip("\n")))
+ run = run_pipeline(workspace, "units_pkg/Multi.system.yaml", tmp_path)
+
+ twins = [child for child in run.structure("default")["data"]["children"] if child["path"] == "/talker"]
+ assert sorted(child["compute_unit"] for child in twins) == ["main_ecu", "sub_ecu"]
+ ports = [port["unique_id"] for child in twins for port in child["out_ports"]]
+ assert len(ports) == len(set(ports))
diff --git a/autoware_system_designer/test/test_parameter_substitution.py b/autoware_system_designer/test/test_parameter_substitution.py
new file mode 100644
index 00000000..f56bd370
--- /dev/null
+++ b/autoware_system_designer/test/test_parameter_substitution.py
@@ -0,0 +1,37 @@
+# Copyright 2026 TIER IV, inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Port substitutions in the parameter values of a node design."""
+
+from pipeline_harness import run_pipeline, stage_case
+
+
+def test_port_substitutions_resolve_in_each_element_of_a_list_value(tmp_path):
+ workspace = stage_case("compute_units", tmp_path)
+ node = workspace / "units_pkg" / "Listener.node.yaml"
+ node.write_text(
+ node.read_text().replace(
+ "param_values: []",
+ "param_values:\n"
+ " - name: source\n type: string\n default: ${input chatter}\n"
+ " - name: sources\n type: string_array\n default:\n - ${input chatter}\n - fixed\n",
+ )
+ )
+ run = run_pipeline(workspace, "units_pkg/Multi.system.yaml", tmp_path)
+
+ launcher = (run.launcher_dir("default") / "sub_ecu" / "listener" / "listener.launch.xml").read_text()
+ topic = launcher.partition('/ the member name with every character outside letters, digits, _ - . as _
@@ -501,7 +510,7 @@ What a replay sets on the middleware of its scope comes from `config/replay_midd
| `launcher` | Launcher settings set on every member of the scope | `use_intra_process_comms: false` |
| `distro_variable` | Environment variable that names the distribution | `ROS_DISTRO` |
| `isolation_environment` | Environment of a replay whose discovery stays on this host, by distribution; `default` is for any other | `humble`: `ROS_LOCALHOST_ONLY=1`, `default`: `ROS_AUTOMATIC_DISCOVERY_RANGE=LOCALHOST` |
-| `domain_id_variable` | Environment variable that carries `--domain-id` | `ROS_DOMAIN_ID` |
+| `domain_id_variable` | Environment variable that carries a domain `id` | `ROS_DOMAIN_ID` |
| `identifier_types` | Identifier message types `uuid_order` ranks, with the field of the bytes | `unique_identifier_msgs/msg/UUID: uuid` |
| `qos_value_names` | Quality of service values a bag's metadata writes as numbers, each with its rmw name, by policy | `durability`: `1: transient_local`, `2: volatile` |
diff --git a/autoware_system_designer_runtime/autoware_system_designer_runtime/_impl/core/domain.py b/autoware_system_designer_runtime/autoware_system_designer_runtime/_impl/core/domain.py
new file mode 100644
index 00000000..cdd4e9a4
--- /dev/null
+++ b/autoware_system_designer_runtime/autoware_system_designer_runtime/_impl/core/domain.py
@@ -0,0 +1,82 @@
+# Copyright 2026 TIER IV, inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Communication domain of a launch, taken from the compute units of the system structure."""
+
+from __future__ import annotations
+
+from dataclasses import dataclass
+from typing import Any, Mapping, MutableMapping, Optional
+
+
+@dataclass(frozen=True)
+class LaunchDomain:
+ """Communication domain the launched units share: its name and the identifier the middleware knows it by."""
+
+ name: Optional[str] = None
+ id: Optional[int] = None
+
+
+def unit_domains(structure: Mapping[str, Any]) -> dict[str, LaunchDomain]:
+ """Communication domain of each compute unit that is in one, by unit name."""
+ metadata = structure.get("metadata")
+ units = metadata.get("compute_units") if isinstance(metadata, Mapping) else None
+ domains: dict[str, LaunchDomain] = {}
+ for unit in units if isinstance(units, list) else []:
+ if not isinstance(unit, Mapping) or not isinstance(unit.get("name"), str):
+ continue
+ name = unit.get("communication_domain")
+ if not isinstance(name, str):
+ continue
+ domain_id = unit.get("domain_id")
+ valid = isinstance(domain_id, int) and not isinstance(domain_id, bool)
+ domains[unit["name"]] = LaunchDomain(name, domain_id if valid else None)
+ return domains
+
+
+def _launched_units(entity: Mapping[str, Any], units: set[str]) -> set[str]:
+ if entity.get("entity_type") == "node" and entity.get("launcher"):
+ units.add(entity.get("compute_unit") or "")
+ for child in entity.get("children", []):
+ _launched_units(child, units)
+ return units
+
+
+def launch_domain(structure: Mapping[str, Any], ecu: Optional[str]) -> LaunchDomain:
+ """Communication domain the launched nodes run in; empty when their compute units are in none.
+
+ One runtime process talks to its members in one domain, so the units it
+ launches have to agree on theirs.
+ """
+ declared = unit_domains(structure)
+ if not declared:
+ return LaunchDomain()
+ units = {ecu} if ecu is not None else _launched_units(structure.get("data") or {}, set())
+ domains = {unit: declared.get(unit, LaunchDomain()) for unit in sorted(units)}
+ if len(set(domains.values())) > 1:
+ listing = ", ".join(f"{unit or '(no unit)'}={domain.name or 'none'}" for unit, domain in domains.items())
+ raise RuntimeError(
+ f"the compute units to launch are in different communication domains ({listing}); "
+ "launch them one at a time with --compute-unit"
+ )
+ return next(iter(domains.values()), LaunchDomain())
+
+
+def apply_domain_id(domain: LaunchDomain, environment: MutableMapping[str, str], variable: str) -> Optional[str]:
+ """Sets the domain identifier as *variable* of *environment*; returns the value it replaced when that differs."""
+ if domain.id is None or not variable:
+ return None
+ previous = environment.get(variable)
+ environment[variable] = str(domain.id)
+ return previous if previous not in (None, "", str(domain.id)) else None
diff --git a/autoware_system_designer_runtime/autoware_system_designer_runtime/_impl/ros2/launchers/single_node.py b/autoware_system_designer_runtime/autoware_system_designer_runtime/_impl/ros2/launchers/single_node.py
index 1aebab7b..47e538e1 100644
--- a/autoware_system_designer_runtime/autoware_system_designer_runtime/_impl/ros2/launchers/single_node.py
+++ b/autoware_system_designer_runtime/autoware_system_designer_runtime/_impl/ros2/launchers/single_node.py
@@ -19,11 +19,13 @@
from typing import Mapping, Sequence
from ..common.params import _ros_args, build_cmd, remap_pairs
+from ..common.substitutions import resolve_substitutions
def node_cmdline(spec: Mapping, parameter_files: Sequence[str] = ()) -> list[str]:
launcher = spec["launcher"]
- extra_args = launcher.get("args", "")
+ # Arguments may hold launch-time substitutions.
+ extra_args = resolve_substitutions(launcher.get("args", ""), {})
cmd = build_cmd(launcher)
if extra_args:
cmd += extra_args.split()
diff --git a/autoware_system_designer_runtime/autoware_system_designer_runtime/config/replay_middleware.yaml b/autoware_system_designer_runtime/autoware_system_designer_runtime/config/replay_middleware.yaml
index 2f9ff149..124e7c6f 100644
--- a/autoware_system_designer_runtime/autoware_system_designer_runtime/config/replay_middleware.yaml
+++ b/autoware_system_designer_runtime/autoware_system_designer_runtime/config/replay_middleware.yaml
@@ -18,7 +18,7 @@ isolation_environment:
default:
ROS_AUTOMATIC_DISCOVERY_RANGE: LOCALHOST
-# Environment variable that carries the domain of the replay.
+# Environment variable that carries the identifier of a communication domain: of a launch, and of a replay.
domain_id_variable: ROS_DOMAIN_ID
# Identifier message types, each with the field that holds the identifier's bytes.
diff --git a/autoware_system_designer_runtime/autoware_system_designer_runtime/run_log.py b/autoware_system_designer_runtime/autoware_system_designer_runtime/run_log.py
index db320bd2..4e811c08 100644
--- a/autoware_system_designer_runtime/autoware_system_designer_runtime/run_log.py
+++ b/autoware_system_designer_runtime/autoware_system_designer_runtime/run_log.py
@@ -99,9 +99,11 @@ def write_run_manifest(
deploy: Optional[str],
members: Sequence[str],
launch: Optional[str] = None,
+ communication_domain: Optional[str] = None,
+ domain_id: Optional[int] = None,
) -> Path:
"""Records what a run's log directory holds: the system structure and unit it ran, the launch the
- run belongs to and the member paths whose directories lie beside it."""
+ run belongs to, the communication domain the design gave it and the member paths whose directories lie beside it."""
metadata = data.get("metadata")
if not isinstance(metadata, Mapping):
metadata = {}
@@ -111,6 +113,8 @@ def write_run_manifest(
"compute_unit": ecu,
"deploy": deploy,
"launch": launch,
+ "communication_domain": communication_domain,
+ "domain_id": domain_id,
"system_structure": str(Path(json_path).resolve()),
"started": time.time(),
"members": list(members),
diff --git a/autoware_system_designer_runtime/autoware_system_designer_runtime/system_runner.py b/autoware_system_designer_runtime/autoware_system_designer_runtime/system_runner.py
index eeb37561..1cc032f9 100644
--- a/autoware_system_designer_runtime/autoware_system_designer_runtime/system_runner.py
+++ b/autoware_system_designer_runtime/autoware_system_designer_runtime/system_runner.py
@@ -24,6 +24,7 @@
import asyncio
import json
import logging
+import os
import re
import sys
from pathlib import Path
@@ -34,6 +35,7 @@
from ._impl.core.config import ActorConfig
from ._impl.core.control_channel import ControlChannel
from ._impl.core.coordinator import ensure_output_dir
+from ._impl.core.domain import apply_domain_id, launch_domain
from ._impl.core.stdin_console import COMMANDS as CONSOLE_COMMANDS
from ._impl.core.stdin_console import run_console
from ._impl.measure.clock import CLOCK_AUTO, CLOCK_CHOICES
@@ -41,6 +43,7 @@
from ._impl.measure.node_graph import NodeGraph
from ._impl.measure.session import TRACE_SUBDIR, MeasureOptions, MeasureSession, default_latency_out
from ._impl.measure.tracer import TracerArming, TracerSwitches, locate_tracer
+from ._impl.replay.middleware import replay_middleware
from ._impl.ros2.builder import populate_builder
from ._impl.ros2.common.substitutions import bind_variables, resolve_argument_values, unresolved_var_names
from ._impl.ros2.launching_side import add_launching_side
@@ -185,6 +188,21 @@ def launch_from_json(
data = bind_deploy_arguments(data, json_path, deploy=deploy, overrides=arguments or {})
bind_launching_side(data["data"], json_path, deploy=deploy, overrides=arguments or {})
+ # The runtime's own endpoints read the process environment, the members inherit it.
+ domain = launch_domain(data, ecu)
+ domain_variable = replay_middleware().domain_id_variable
+ replaced = apply_domain_id(domain, os.environ, domain_variable)
+ if domain.name is not None:
+ logger.info(
+ "communication domain %s%s",
+ domain.name,
+ (
+ ""
+ if domain.id is None or not domain_variable
+ else f": {domain_variable}={domain.id}" + (f" (the environment had {replaced})" if replaced else "")
+ ),
+ )
+
out_dir = output_dir or ensure_output_dir()
logger.info("logs: %s", out_dir)
@@ -241,6 +259,8 @@ async def _run() -> int:
deploy=deploy,
members=coord.names(),
launch=launch_id,
+ communication_domain=domain.name,
+ domain_id=domain.id,
)
except OSError as exc:
logger.warning("cannot write %s: %s", out_dir / RUN_MANIFEST, exc)
diff --git a/autoware_system_designer_runtime/test/test_communication_domain.py b/autoware_system_designer_runtime/test/test_communication_domain.py
new file mode 100644
index 00000000..fb46c31a
--- /dev/null
+++ b/autoware_system_designer_runtime/test/test_communication_domain.py
@@ -0,0 +1,109 @@
+# Copyright 2026 TIER IV, inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Communication domain of a launch: derived from the compute units, applied to the environment."""
+
+import pytest
+
+from autoware_system_designer_runtime._impl.core.domain import (
+ LaunchDomain,
+ apply_domain_id,
+ launch_domain,
+ unit_domains,
+)
+
+VARIABLE = "DOMAIN_VARIABLE"
+
+
+def _node(name, unit):
+ return {"entity_type": "node", "name": name, "compute_unit": unit, "launcher": {"launch_state": "single_node"}}
+
+
+def _structure(units, nodes):
+ return {
+ "metadata": {"compute_units": units},
+ "data": {"entity_type": "system", "children": [{"entity_type": "module", "children": nodes}]},
+ }
+
+
+UNITS = [
+ {"name": "main", "communication_domain": "main", "domain_id": 1},
+ {"name": "main_mrm", "communication_domain": "mrm", "domain_id": 3},
+ {"name": "perception", "communication_domain": "main", "domain_id": 1},
+ {"name": "logging"},
+ {"name": "tools", "communication_domain": "free"},
+]
+
+
+def test_unit_domains_skip_units_in_none_and_identifiers_that_are_no_integer():
+ structure = _structure([*UNITS, {"name": "odd", "communication_domain": "odd", "domain_id": True}], [])
+ assert unit_domains(structure) == {
+ "main": LaunchDomain("main", 1),
+ "main_mrm": LaunchDomain("mrm", 3),
+ "perception": LaunchDomain("main", 1),
+ "tools": LaunchDomain("free"),
+ "odd": LaunchDomain("odd"),
+ }
+ assert unit_domains({}) == {}
+
+
+def test_selected_unit_gives_its_domain():
+ structure = _structure(UNITS, [_node("a", "main"), _node("b", "main_mrm")])
+ assert launch_domain(structure, "main_mrm") == LaunchDomain("mrm", 3)
+ assert launch_domain(structure, "logging") == LaunchDomain()
+
+
+def test_units_launched_together_share_one_domain():
+ structure = _structure(UNITS, [_node("a", "main"), _node("b", "perception")])
+ assert launch_domain(structure, None) == LaunchDomain("main", 1)
+
+
+@pytest.mark.parametrize("other", ["main_mrm", "logging", "tools"])
+def test_units_of_different_domains_are_not_launched_together(other):
+ structure = _structure(UNITS, [_node("a", "main"), _node("b", other)])
+ with pytest.raises(RuntimeError) as excinfo:
+ launch_domain(structure, None)
+ assert "main=main" in str(excinfo.value) and "--compute-unit" in str(excinfo.value)
+
+
+def test_a_design_without_domains_leaves_the_environment():
+ structure = _structure([{"name": "main"}, {"name": "sub"}], [_node("a", "main"), _node("b", "sub")])
+ assert launch_domain(structure, None) == LaunchDomain()
+ environment = {VARIABLE: "7"}
+ assert apply_domain_id(LaunchDomain(), environment, VARIABLE) is None
+ assert apply_domain_id(LaunchDomain("free"), environment, VARIABLE) is None
+ assert environment == {VARIABLE: "7"}
+
+
+def test_apply_sets_the_variable_and_reports_a_replaced_value():
+ environment = {VARIABLE: "7"}
+ assert apply_domain_id(LaunchDomain("mrm", 3), environment, VARIABLE) == "7"
+ assert environment[VARIABLE] == "3"
+ assert apply_domain_id(LaunchDomain("mrm", 3), environment, VARIABLE) is None
+ assert apply_domain_id(LaunchDomain("mrm", 3), {}, VARIABLE) is None
+ unnamed = {}
+ assert apply_domain_id(LaunchDomain("mrm", 3), unnamed, "") is None and unnamed == {}
+
+
+def test_node_arguments_resolve_launch_time_substitutions(monkeypatch):
+ from autoware_system_designer_runtime._impl.ros2.launchers import single_node
+
+ monkeypatch.setattr(single_node, "build_cmd", lambda launcher: ["bridge"])
+ monkeypatch.setenv("ASD_TEST_CONFIG_DIR", "/cfg")
+ spec = {
+ "name": "mrm_bridge",
+ "namespace": "/",
+ "launcher": {"args": "$(env ASD_TEST_CONFIG_DIR)/mrm_bridge.yaml", "ports": []},
+ }
+ assert single_node.node_cmdline(spec)[:2] == ["bridge", "/cfg/mrm_bridge.yaml"]
diff --git a/autoware_system_designer_runtime/test/test_run_manifest.py b/autoware_system_designer_runtime/test/test_run_manifest.py
index f1765611..25fe4d7a 100644
--- a/autoware_system_designer_runtime/test/test_run_manifest.py
+++ b/autoware_system_designer_runtime/test/test_run_manifest.py
@@ -34,6 +34,8 @@ def test_run_manifest_names_what_the_log_directory_holds(tmp_path):
deploy=None,
members=["/sensing/lidar/driver", "/perception/detector"],
launch="20260521_153012-a1b2",
+ communication_domain="main_mrm",
+ domain_id=3,
)
assert path == tmp_path / RUN_MANIFEST
manifest = json.loads(path.read_text())
@@ -42,6 +44,7 @@ def test_run_manifest_names_what_the_log_directory_holds(tmp_path):
assert manifest["compute_unit"] == "main_ecu"
assert manifest["deploy"] is None
assert manifest["launch"] == "20260521_153012-a1b2"
+ assert manifest["communication_domain"] == "main_mrm" and manifest["domain_id"] == 3
assert manifest["system_structure"] == str(structure.resolve())
assert manifest["started"] > 0
assert manifest["members"] == ["/sensing/lidar/driver", "/perception/detector"]
@@ -53,7 +56,7 @@ def test_run_manifest_falls_back_to_the_structure_file_name(tmp_path):
)
manifest = json.loads(path.read_text())
assert manifest["system"] is None and manifest["mode"] == "Vehicle" and manifest["deploy"] == "site"
- assert manifest["launch"] is None
+ assert manifest["launch"] is None and manifest["communication_domain"] is None and manifest["domain_id"] is None
def test_runs_starting_in_one_second_get_their_own_log_directory(tmp_path):
diff --git a/autoware_system_designer_studio/README.md b/autoware_system_designer_studio/README.md
index ac23ec4b..8942cfce 100644
--- a/autoware_system_designer_studio/README.md
+++ b/autoware_system_designer_studio/README.md
@@ -532,7 +532,9 @@ reaches the sequence diagram without a page reload; `health` reports the `record
`rviz.start` runs `rviz2` from the launch environment as a job of its own, one per daemon
(`conflict` while it runs), on the `--rviz-config` file, else on `autoware_launch`'s `autoware.rviz`
-under the environment's ament prefixes, else on no configuration. The workbench offers it as
+under the environment's ament prefixes, else on no configuration. It joins the communication
+domain of the launched units: the domain `id` of the launched unit its system declares first, among
+those having one, else the domain of the launch environment. The workbench offers it as
"Launch RViz" in the launch bar's drawer.
Launch jobs need the ROS environment the daemon itself does without: start `serve` from a sourced
diff --git a/autoware_system_designer_studio/autoware_system_designer_studio/exports.py b/autoware_system_designer_studio/autoware_system_designer_studio/exports.py
index 6e1cded1..cf16b595 100644
--- a/autoware_system_designer_studio/autoware_system_designer_studio/exports.py
+++ b/autoware_system_designer_studio/autoware_system_designer_studio/exports.py
@@ -209,8 +209,9 @@ def mode_keys(self) -> list[str]:
modes = self.manifest.get("mode_keys")
return [m for m in modes if isinstance(m, str)] if isinstance(modes, list) else []
- def compute_units(self) -> list[dict[str, str]]:
- """Declared units (name, kind, description only); without a declaration, the units any mode launches."""
+ def compute_units(self) -> list[dict[str, Any]]:
+ """Declared units (name, kind, description, and the communication domain of a unit in one); without a
+ declaration, the units any mode launches."""
declared = self._declared_units()
if declared:
return declared
@@ -231,7 +232,7 @@ def launch_units(self, mode: str) -> list[str]:
return [name for name in units if isinstance(name, str) and name] if isinstance(units, list) else []
return [unit["name"] for unit in self._declared_units() if unit["kind"] == KIND_ONBOARD]
- def _declared_units(self) -> list[dict[str, str]]:
+ def _declared_units(self) -> list[dict[str, Any]]:
declared = self.manifest.get("compute_units")
if not isinstance(declared, list):
return []
@@ -240,6 +241,7 @@ def _declared_units(self) -> list[dict[str, str]]:
"name": unit["name"],
"kind": str(unit.get("kind") or KIND_ONBOARD),
"description": str(unit.get("description") or ""),
+ **_unit_domain(unit),
}
for unit in declared
if isinstance(unit, dict) and isinstance(unit.get("name"), str)
@@ -318,6 +320,16 @@ def _interface_ports(value: Any) -> list[dict[str, str]]:
return [{"name": item["name"], "topic": str(item.get("topic") or "")} for item in _named_records(value)]
+def _unit_domain(unit: dict[str, Any]) -> dict[str, Any]:
+ """The communication domain of a declared unit and its identifier; empty for a unit in none."""
+ name = unit.get("communication_domain")
+ if not isinstance(name, str):
+ return {}
+ domain_id = unit.get("domain_id")
+ valid = isinstance(domain_id, int) and not isinstance(domain_id, bool)
+ return {"communication_domain": name, **({"domain_id": domain_id} if valid else {})}
+
+
def _unit_status(unit: dict[str, str], served: Optional[set[str]]) -> str:
if unit["kind"] == KIND_OFFBOARD:
return UNIT_OFFBOARD
diff --git a/autoware_system_designer_studio/autoware_system_designer_studio/pages/render.py b/autoware_system_designer_studio/autoware_system_designer_studio/pages/render.py
index e2533028..53fb509b 100644
--- a/autoware_system_designer_studio/autoware_system_designer_studio/pages/render.py
+++ b/autoware_system_designer_studio/autoware_system_designer_studio/pages/render.py
@@ -282,11 +282,13 @@ def _structure(self, export: SystemExport, mode: str) -> str:
inject_vis_guides(data)
# Declared compute units travel with each mode's tree; the node diagram groups components by them.
# A subsystem carries the one unit it launches as.
+ # Domain bridges name the cross-domain links they carry.
# Peripherals mark their gateway nodes, the nodes that talk to the hardware.
declared_units = export.compute_units() if export.kind == TARGET_SUBSYSTEM else metadata.get("compute_units")
view = {
**data,
"compute_units": declared_units or [],
+ "domain_bridges": metadata.get("domain_bridges") or [],
"peripherals": metadata.get("peripherals") or [],
"mode": mode,
}
diff --git a/autoware_system_designer_studio/autoware_system_designer_studio/serve/launch.py b/autoware_system_designer_studio/autoware_system_designer_studio/serve/launch.py
index 9a1cb900..7cdfafaf 100644
--- a/autoware_system_designer_studio/autoware_system_designer_studio/serve/launch.py
+++ b/autoware_system_designer_studio/autoware_system_designer_studio/serve/launch.py
@@ -91,6 +91,7 @@
RUNTIME_PACKAGE = "autoware_system_designer_runtime"
RVIZ_JOB_KIND = "rviz"
RVIZ = "rviz2"
+ROS_DOMAIN_ID_ENV = "ROS_DOMAIN_ID"
# Default RViz configuration, looked up under the launch environment's ament prefixes.
RVIZ_CONFIG_SHARE = Path("share/autoware_launch/rviz/autoware.rviz")
@@ -514,8 +515,22 @@ def require_mode(self, system_id: str, mode: str) -> None:
f"{system_id} is shutting down mode {mode!r} on compute unit {running.compute_unit!r}",
)
+ def launched_domain_id(self) -> Optional[int]:
+ """Domain identifier of the launched unit its system declares first, among the launched units having one."""
+ launched = {
+ (session.system.id, session.compute_unit): session for session in self.sessions.values() if session.active
+ }
+ for system in {session.system.id: session.system for session in launched.values()}.values():
+ for unit in system.compute_units():
+ if (system.id, unit["name"]) in launched and "domain_id" in unit:
+ return unit["domain_id"]
+ return None
+
async def start_rviz(self) -> jobs.Job:
- """RViz on the daemon's configuration as a job; one RViz per daemon (``conflict`` while it runs)."""
+ """RViz on the daemon's configuration as a job; one RViz per daemon (``conflict`` while it runs).
+
+ It joins the communication domain of the launched units, else the launch environment's.
+ """
self._require_ros()
rviz = shutil.which(RVIZ, path=self.env.get("PATH"))
if rviz is None:
@@ -523,14 +538,18 @@ async def start_rviz(self) -> jobs.Job:
argv = [rviz]
if self.rviz_config is not None:
argv += ["-d", str(self.rviz_config)]
+ domain_id = self.launched_domain_id()
spec = jobs.JobSpec(
key=RVIZ_JOB_KIND,
kind=RVIZ_JOB_KIND,
title="rviz",
argv=argv,
cwd=self._cwd,
- env=self.env,
- params={"config": None if self.rviz_config is None else str(self.rviz_config)},
+ env=self.env if domain_id is None else {**self.env, ROS_DOMAIN_ID_ENV: str(domain_id)},
+ params={
+ "config": None if self.rviz_config is None else str(self.rviz_config),
+ "domain_id": domain_id,
+ },
)
return await self._jobs.start(spec)
diff --git a/autoware_system_designer_studio/autoware_system_designer_studio/web/css/node_diagram.css b/autoware_system_designer_studio/autoware_system_designer_studio/web/css/node_diagram.css
index a90970b0..321bb73b 100644
--- a/autoware_system_designer_studio/autoware_system_designer_studio/web/css/node_diagram.css
+++ b/autoware_system_designer_studio/autoware_system_designer_studio/web/css/node_diagram.css
@@ -53,6 +53,22 @@
transition: all 0.2s;
}
+/* Domain bridge: cut-corner box in the colour of the links it carries */
+.node-rect.domain-bridge {
+ stroke: var(--state-warning);
+ stroke-dasharray: none;
+}
+
+/* Link between compute units of two communication domains */
+.edge-path.cross-domain {
+ stroke: var(--state-warning);
+}
+
+/* Cross-domain link no domain bridge carries */
+.edge-path.cross-domain.unbridged {
+ stroke: var(--error-color);
+}
+
/* Node group highlighting - similar to module-highlighted */
.node-group.highlighted {
stroke: none !important;
diff --git a/autoware_system_designer_studio/autoware_system_designer_studio/web/css/widgets.css b/autoware_system_designer_studio/autoware_system_designer_studio/web/css/widgets.css
index 943c4d73..0f7f2b3e 100644
--- a/autoware_system_designer_studio/autoware_system_designer_studio/web/css/widgets.css
+++ b/autoware_system_designer_studio/autoware_system_designer_studio/web/css/widgets.css
@@ -351,6 +351,12 @@
color: var(--state-failed);
}
+/* Communication domain of a compute unit */
+.unit-domain {
+ font-size: 11px;
+ color: var(--text-muted);
+}
+
/* Main view frame: head with title and trailing controls, body or empty message */
.main-view-head {
display: flex;
diff --git a/autoware_system_designer_studio/autoware_system_designer_studio/web/js/activities/launch/launch_control.js b/autoware_system_designer_studio/autoware_system_designer_studio/web/js/activities/launch/launch_control.js
index a5ab654f..73c9144c 100644
--- a/autoware_system_designer_studio/autoware_system_designer_studio/web/js/activities/launch/launch_control.js
+++ b/autoware_system_designer_studio/autoware_system_designer_studio/web/js/activities/launch/launch_control.js
@@ -70,6 +70,7 @@
let stateStatus = unitStatus;
// Unit -> record of the peer daemon serving it; no entry for a unit of this daemon.
let unitPeers = new Map();
+ let unitDomains = new Map();
// Units with a launch request the daemon has not answered yet.
const starting = new Set();
const ofMode = launch.scope(config.systemId, () => store.get("mode"));
@@ -383,6 +384,10 @@
"Drop the sessions the unit's daemon last reported, so the system can run another mode. The unit may still be running.";
actions.push(forget);
}
+ if (unitDomains.has(unit))
+ notes.push(
+ element("span", "unit-domain", `domain ${unitDomains.get(unit)}`),
+ );
const peer = unitPeers.get(unit);
if (peer) {
const chip = element(
@@ -455,6 +460,16 @@
unitPeers = new Map(
units.filter((u) => u.daemon).map((u) => [u.name, u.daemon]),
);
+ unitDomains = new Map(
+ units
+ .filter((u) => typeof u.communication_domain === "string")
+ .map((u) => [
+ u.name,
+ Number.isInteger(u.domain_id)
+ ? `${u.communication_domain} (${u.domain_id})`
+ : u.communication_domain,
+ ]),
+ );
stateStatus = unitStatus;
const running = stateSystem();
if (running !== config.systemId) {
diff --git a/autoware_system_designer_studio/autoware_system_designer_studio/web/js/diagrams/node_diagram.js b/autoware_system_designer_studio/autoware_system_designer_studio/web/js/diagrams/node_diagram.js
index 3a42cfad..50161564 100644
--- a/autoware_system_designer_studio/autoware_system_designer_studio/web/js/diagrams/node_diagram.js
+++ b/autoware_system_designer_studio/autoware_system_designer_studio/web/js/diagrams/node_diagram.js
@@ -17,6 +17,16 @@
// A box sits at most this many steps below the box holding it.
const STEP_DROP_LIMIT = 3;
+ // Topics and services a domain bridge carries, a service under its name as
+ // the topic, from the domain of its server to the domain of its client.
+ const carriedBy = (bridge) => [
+ ...(bridge?.topics || []),
+ ...(bridge?.services || []).map((entry) => ({
+ ...entry,
+ topic: entry.service,
+ })),
+ ];
+
// Direction priority of one link per pair of linked boxes. Cycle breaking
// weighs links by it, so the boxes are ordered by the peers they feed and
// are fed by; parallel links between one pair count once.
@@ -121,6 +131,7 @@
// ── Data transformation ─────────────────────────────────────────────────────
transformDataToElk(root) {
+ root = this._routeDomainBridges(root);
this._indexGateways(root);
this.elementData.clear();
this.portToEdges.clear();
@@ -297,6 +308,134 @@
return rootNode;
}
+ // Copy of the root whose bridged links pass through their domain bridge.
+ // A bridge is drawn once per direction it carries topics in; each box has
+ // an input and an output per topic, and a link between the two domains is
+ // one link into the box and one out of it.
+ _routeDomainBridges(root) {
+ const bridges = (root?.domain_bridges || [])
+ .map((bridge) => ({ ...bridge, topics: carriedBy(bridge) }))
+ .filter((bridge) => bridge.topics.length);
+ if (!bridges.length || !root.children?.length) return root;
+
+ const unitDomain = new Map(
+ (root.compute_units || []).map((unit) => [
+ unit.name,
+ unit.communication_domain,
+ ]),
+ );
+ const portDomain = new Map();
+ root.children.forEach((child) =>
+ [...(child.in_ports || []), ...(child.out_ports || [])].forEach(
+ (port) =>
+ portDomain.set(
+ String(port.unique_id),
+ unitDomain.get(child.compute_unit),
+ ),
+ ),
+ );
+
+ const children = [...root.children];
+ let links = [...(root.links || [])];
+ bridges.forEach((bridge) => {
+ const index = children.findIndex((c) => c.path === bridge.node);
+ if (index < 0) return;
+ const instance = children[index];
+ const label = (name) => {
+ const id = (bridge.domains || []).find((d) => d.name === name)?.id;
+ return Number.isInteger(id) ? `${name} (${id})` : name;
+ };
+ // Box of one direction: its id and the port pair of each topic.
+ const boxes = new Map();
+ const boxOf = (entry) => {
+ const direction = `${entry.from}>${entry.to}`;
+ if (!boxes.has(direction))
+ boxes.set(direction, {
+ id: boxes.size
+ ? `${instance.unique_id}__${direction}`
+ : String(instance.unique_id),
+ direction: `${label(entry.from)} \u2192 ${label(entry.to)}`,
+ pairs: new Map(),
+ });
+ return boxes.get(direction);
+ };
+ const pairOf = (entry) => {
+ const box = boxOf(entry);
+ if (!box.pairs.has(entry.topic)) {
+ // The input names the topic, the output the domain it leaves into.
+ const port = (side, peer) => ({
+ unique_id: `__bridge_${side}__${box.id}__${entry.topic}`,
+ bridge_peer: `__bridge_${peer}__${box.id}__${entry.topic}`,
+ name:
+ side === "in"
+ ? entry.topic
+ : `\u2192 ${entry.to}${entry.far_name ? ` ${entry.far_name}` : ""}`,
+ msg_type: entry.message_type,
+ topic: entry.topic.split("/").filter(Boolean),
+ communication_domain: side === "in" ? entry.from : entry.to,
+ domain_bridge: bridge.name,
+ });
+ box.pairs.set(entry.topic, {
+ in: port("in", "out"),
+ out: port("out", "in"),
+ });
+ }
+ return box.pairs.get(entry.topic);
+ };
+ const fed = new Set();
+ const routed = [];
+ links.forEach((link) => {
+ const from = portDomain.get(String(link.from_port?.unique_id));
+ const to = portDomain.get(String(link.to_port?.unique_id));
+ const entry = bridge.topics.find(
+ (t) =>
+ (t.topic === link.topic || t.far_name === link.topic) &&
+ t.from === from &&
+ t.to === to,
+ );
+ if (!entry) {
+ routed.push(link);
+ return;
+ }
+ const pair = pairOf(entry);
+ const mark = {
+ domain_bridge: bridge.name,
+ communication_domains: `${entry.from} \u2192 ${entry.to}`,
+ };
+ // Several subscribers of one publisher share the link into the bridge.
+ const feed = `${link.from_port.unique_id}>${entry.topic}`;
+ if (!fed.has(feed)) {
+ fed.add(feed);
+ routed.push({
+ ...link,
+ ...mark,
+ unique_id: `${link.unique_id}__into_bridge`,
+ to_port: pair.in,
+ });
+ }
+ routed.push({
+ ...link,
+ ...mark,
+ unique_id: `${link.unique_id}__out_of_bridge`,
+ from_port: pair.out,
+ });
+ });
+ links = routed;
+ const drawn = [...boxes.values()].map((box) => {
+ const ports = [...box.pairs.values()];
+ return {
+ ...instance,
+ unique_id: box.id,
+ domain_bridge: { type: bridge.type, direction: box.direction },
+ in_ports: ports.map((pair) => pair.in),
+ out_ports: ports.map((pair) => pair.out),
+ };
+ });
+ if (drawn.length) children.splice(index, 1, ...drawn);
+ });
+ return { ...root, children, links };
+ }
+
// Node path -> peripherals it is a gateway of: the hardware the node talks to.
_indexGateways(root) {
this.gateways = new Map();
@@ -586,7 +725,9 @@
// Top-level components are wrapped in one dashed cluster per compute unit,
// declared units first in declaration order. A cluster carries no ports:
// links inside one unit belong to its cluster, links across units stay at
- // the root and are routed across the cluster boundary.
+ // the root and are routed across the cluster boundary. A unit in a
+ // communication domain shows it over its name, and a link between units
+ // of two domains carries both, with the domain bridge its topic crosses by.
_groupByComputeUnit(rootNode, root) {
if (!rootNode?.children?.length) return;
@@ -597,6 +738,27 @@
);
const unitOf = (nodeId) =>
this.elementData.get(nodeId)?.compute_unit || "";
+ // "main (1)" of a unit in a communication domain with an identifier,
+ // "main" without one, "" of a unit in none.
+ const domainOf = (name) => {
+ const unit = declared.get(name);
+ if (typeof unit?.communication_domain !== "string") return "";
+ return Number.isInteger(unit.domain_id)
+ ? `${unit.communication_domain} (${unit.domain_id})`
+ : unit.communication_domain;
+ };
+
+ // Domain bridge that carries a topic between the domains of two units.
+ const bridgeOf = (fromUnit, toUnit, topic) => {
+ const from = declared.get(fromUnit)?.communication_domain;
+ const to = declared.get(toUnit)?.communication_domain;
+ const bridge = (root.domain_bridges || []).find((entry) =>
+ carriedBy(entry).some(
+ (t) => t.from === from && t.to === to && t.topic === topic,
+ ),
+ );
+ return bridge?.name || "";
+ };
const membersByUnit = new Map();
for (const name of declared.keys()) membersByUnit.set(name, []);
@@ -630,10 +792,14 @@
entity_type: "compute_unit",
kind,
description: unit.description || "",
+ ...(domainOf(name) ? { communication_domain: domainOf(name) } : {}),
members: members.map((m) => this.elementData.get(m.id)?.name || m.id),
});
this.steps.set(clusterId, rootStep);
- this.titles.set(clusterId, { caption: "", tokens: [name] });
+ this.titles.set(clusterId, {
+ caption: domainOf(name) ? `domain ${domainOf(name)}` : "",
+ tokens: [name],
+ });
const cluster = {
id: clusterId,
labels: [{ text: kind }, { text: name }],
@@ -668,6 +834,14 @@
fromUnit === toUnit ? clusterByUnit.get(fromUnit) : null;
if (cluster) cluster.edges.push(edge);
else rootEdges.push(edge);
+ const domains = [domainOf(fromUnit), domainOf(toUnit)];
+ const edgeData = this.elementData.get(edge.id);
+ if (edgeData?.domain_bridge) return;
+ if (edgeData && !domains.includes("") && domains[0] !== domains[1]) {
+ edgeData.communication_domains = `${domains[0]} \u2192 ${domains[1]}`;
+ const bridge = bridgeOf(fromUnit, toUnit, edgeData.topic);
+ if (bridge) edgeData.domain_bridge = bridge;
+ }
});
rootNode.children = [...clusters, ...ungrouped];
@@ -715,6 +889,9 @@
const name = instance.name || String(instance.unique_id) || "Unnamed";
if (instance.entity_type === "system")
return { caption: "", tokens: [name] };
+ // A domain bridge box shows the direction it carries over its name.
+ if (instance.domain_bridge)
+ return { caption: instance.domain_bridge.direction, tokens: [name] };
const segmentsOf = (text) =>
String(text || "")
.split("/")
@@ -841,7 +1018,10 @@
fontSize,
captionSize,
lines,
- width: Math.max(0, ...lines.map((entry) => entry.width)),
+ width: Math.max(
+ title.caption ? this.measureTextWidth(title.caption, captionSize) : 0,
+ ...lines.map((entry) => entry.width),
+ ),
height: fontSize * 0.5 + captionSize * TITLE_LINE_HEIGHT + top,
};
}
@@ -1219,10 +1399,38 @@
: defaults.light.stroke;
}
- const rect = document.createElementNS(SVG_NS, "rect");
- rect.setAttribute("width", node.width);
- rect.setAttribute("height", node.height);
- rect.setAttribute("rx", style.cornerR);
+ // A domain bridge is a box with cut corners; its ports stay on the
+ // straight sides.
+ const isBridge = !!userData.domain_bridge;
+ const rect = document.createElementNS(
+ SVG_NS,
+ isBridge ? "polygon" : "rect",
+ );
+ if (isBridge) {
+ const w = node.width;
+ const h = node.height;
+ const cut = Math.min(w, h) * 0.22;
+ rect.setAttribute(
+ "points",
+ [
+ [cut, 0],
+ [w - cut, 0],
+ [w, cut],
+ [w, h - cut],
+ [w - cut, h],
+ [cut, h],
+ [0, h - cut],
+ [0, cut],
+ ]
+ .map((point) => point.join(","))
+ .join(" "),
+ );
+ rect.classList.add("domain-bridge");
+ } else {
+ rect.setAttribute("width", node.width);
+ rect.setAttribute("height", node.height);
+ rect.setAttribute("rx", style.cornerR);
+ }
rect.setAttribute("fill", fillColor);
rect.setAttribute("stroke", strokeColor);
rect.setAttribute("stroke-width", style.borderW);
@@ -1243,7 +1451,7 @@
e.stopPropagation();
this.updateInfoPanel(
userData,
- isComputeUnit ? "Compute unit" : "Node",
+ isComputeUnit ? "Compute unit" : isBridge ? "Domain bridge" : "Node",
userData,
);
this.clearHighlights();
@@ -1560,6 +1768,10 @@
path.setAttribute("stroke-dasharray", `${ew} ${ew * 6}`);
path.setAttribute("stroke-linecap", "round");
}
+ if (edgeData.communication_domains) {
+ path.classList.add("cross-domain");
+ if (!edgeData.domain_bridge) path.classList.add("unbridged");
+ }
path.onclick = (e) => {
if (this.hasDragged) return;
@@ -1829,6 +2041,9 @@
if (this._isPort(data)) {
this._applyPortHighlight(currentId, colorPreset, direction);
+ // A topic entering a domain bridge leaves it on the paired port.
+ if (data.bridge_peer && !visited.has(data.bridge_peer))
+ queue.push(data.bridge_peer);
(this.portToEdges.get(currentId) || []).forEach((edgeId) => {
if (visited.has(edgeId)) return;
diff --git a/autoware_system_designer_studio/test/test_pages.py b/autoware_system_designer_studio/test/test_pages.py
index 453cd325..fdb16b5a 100644
--- a/autoware_system_designer_studio/test/test_pages.py
+++ b/autoware_system_designer_studio/test/test_pages.py
@@ -62,6 +62,22 @@ def test_data_script_carries_the_structure_with_vis_guides_and_units(tmp_path):
assert data["mode"] == "Runtime"
assert [u["name"] for u in data["compute_units"]] == ["main_ecu", "sub_ecu", "infra"]
assert "vis_guide" in data
+ assert data["domain_bridges"] == []
+
+
+def test_data_script_carries_the_domain_bridges_of_the_mode(tmp_path):
+ _, system = _system(tmp_path)
+ bridge = {
+ "name": "mrm_bridge",
+ "domains": [{"name": "main"}, {"name": "mrm", "id": 3}],
+ "topics": [{"topic": "/a", "message_type": "std_msgs/msg/Bool", "from": "main", "to": "mrm"}],
+ }
+ path = system.structure_path("Runtime")
+ structure = json.loads(path.read_text())
+ structure["metadata"]["domain_bridges"] = [bridge]
+ path.write_text(json.dumps(structure))
+ data = _script_object(Site([system]).render(f"{SITE}/data/Runtime.js"), assets.DATA_GLOBAL)
+ assert data["domain_bridges"] == [bridge]
def test_data_script_keeps_declaration_key_order():
@@ -484,3 +500,20 @@ def test_config_maps_each_deploy_to_the_e_e_architecture_it_names(tmp_path):
]
text = Site([system]).render(f"{SITE}/config.js")
assert json.loads(text.partition("deployArchitectures: ")[2].partition(",\n")[0]) == {"bridge": "Bridge"}
+
+
+def test_compute_units_carry_the_communication_domain_of_a_unit(tmp_path):
+ _, system = _system(tmp_path)
+ system.manifest["compute_units"] = [
+ {"name": "main_ecu", "kind": "onboard", "requires": [], "communication_domain": "main", "domain_id": 1},
+ {"name": "sub_ecu"},
+ {"name": "free_ecu", "communication_domain": "free"},
+ {"name": "odd_ecu", "communication_domain": "odd", "domain_id": "2"},
+ ]
+ units = {unit["name"]: unit for unit in system.compute_units()}
+ assert units["main_ecu"]["communication_domain"] == "main" and units["main_ecu"]["domain_id"] == 1
+ assert "communication_domain" not in units["sub_ecu"]
+ assert units["free_ecu"]["communication_domain"] == "free" and "domain_id" not in units["free_ecu"]
+ assert "domain_id" not in units["odd_ecu"]
+ view = {unit["name"]: unit for unit in system.to_view(None, {})["compute_units"]}
+ assert view["main_ecu"]["domain_id"] == 1 and view["main_ecu"]["status"] == "available"
diff --git a/autoware_system_designer_studio/test/test_serve_launch.py b/autoware_system_designer_studio/test/test_serve_launch.py
index f842e07b..3cf75ce9 100644
--- a/autoware_system_designer_studio/test/test_serve_launch.py
+++ b/autoware_system_designer_studio/test/test_serve_launch.py
@@ -751,6 +751,7 @@ def test_rviz_start_runs_rviz_once_on_the_configuration(tmp_path, run_dir):
assert status == 200, body
job = body["result"]
assert job["kind"] == launch.RVIZ_JOB_KIND and job["argv"] == [str(rviz), "-d", str(config)]
+ assert job["params"]["domain_id"] is None
status, body = running.rpc({"id": 2, "method": "rviz.start", "params": {}})
assert status == 409 and body["error"]["code"] == api.CONFLICT
running.rpc({"method": "jobs.cancel", "params": {"job": job["id"]}})
@@ -761,6 +762,27 @@ def test_rviz_start_runs_rviz_once_on_the_configuration(tmp_path, run_dir):
running.close()
+def test_rviz_joins_the_communication_domain_of_the_launched_units(tmp_path, run_dir):
+ units = [
+ {"name": "main_ecu", "communication_domain": "mrm", "domain_id": 3},
+ {"name": "sub_ecu", "communication_domain": "sub", "domain_id": 2},
+ ]
+ install = _install_tree(tmp_path, compute_units=units)
+ bin_dir = _fake_launcher(tmp_path)
+ _fake_rviz(bin_dir)
+ running = _Running(install, launch_env=_launch_env(bin_dir), heartbeat_s=60)
+ try:
+ assert running.daemon.launch.launched_domain_id() is None
+ status, body = _start(running)
+ assert status == 200, body
+ assert running.daemon.launch.launched_domain_id() == 3
+ status, body = running.rpc({"id": 2, "method": "rviz.start", "params": {}})
+ assert status == 200, body
+ assert body["result"]["params"]["domain_id"] == 3
+ finally:
+ running.close()
+
+
def test_rviz_start_without_a_configuration_or_rviz(tmp_path, run_dir):
install = _install_tree(tmp_path, compute_units=UNITS)
bin_dir = _fake_launcher(tmp_path)
diff --git a/demo/autoware_system_designer_demo_nodes/design/node/ControlDummy.node.yaml b/demo/autoware_system_designer_demo_nodes/design/node/ControlDummy.node.yaml
index 88477a19..7d6d0560 100644
--- a/demo/autoware_system_designer_demo_nodes/design/node/ControlDummy.node.yaml
+++ b/demo/autoware_system_designer_demo_nodes/design/node/ControlDummy.node.yaml
@@ -2,7 +2,7 @@ autoware_system_design_format: 0.4.1
name: ControlDummy.node
-description: Dummy control node that generates vehicle control, gear, hazard-light and turn-indicator commands from the planned route, reading queued kinematics.
+description: Dummy control node that generates vehicle control, gear, hazard-light and turn-indicator commands from the planned route, reading queued kinematics and the queued control command of the minimal risk maneuver.
package:
name: autoware_system_designer_demo_nodes
@@ -21,6 +21,8 @@ subscribers:
message_type: std_msgs/msg/Float64
- name: emergency_control_cmd
message_type: std_msgs/msg/Bool
+ - name: mrm_control_cmd
+ message_type: std_msgs/msg/Float32
publishers:
- name: command/control_cmd
@@ -42,11 +44,17 @@ processes:
- on_input: kinematics
outcomes:
- to_queue: kinematics
+ - name: queue_mrm_control_cmd
+ trigger_conditions:
+ - on_input: mrm_control_cmd
+ outcomes:
+ - to_queue: mrm_control_cmd
- name: vehicle_control
trigger_conditions:
- and:
- on_input: mission_planning/route
reads:
- from_queue: kinematics
+ - from_queue: mrm_control_cmd
outcomes:
- to_output: command/control_cmd
diff --git a/demo/autoware_system_designer_demo_nodes/design/node/system/MrmDummy.node.yaml b/demo/autoware_system_designer_demo_nodes/design/node/system/MrmDummy.node.yaml
new file mode 100644
index 00000000..56665b4e
--- /dev/null
+++ b/demo/autoware_system_designer_demo_nodes/design/node/system/MrmDummy.node.yaml
@@ -0,0 +1,41 @@
+autoware_system_design_format: 0.4.1
+
+name: MrmDummy.node
+
+description: Dummy minimal risk maneuver node that turns the emergency request into a control command of its own, reading queued kinematics.
+
+package:
+ name: autoware_system_designer_demo_nodes
+ provider: dummy
+
+launch:
+ plugin: autoware::system_designer_demo_nodes::Mrm
+ executable: mrm_node
+
+subscribers:
+ - name: kinematics
+ message_type: std_msgs/msg/Float64MultiArray
+ - name: emergency_control_cmd
+ message_type: std_msgs/msg/Bool
+
+publishers:
+ - name: control_cmd
+ message_type: std_msgs/msg/Float32
+
+param_files: []
+param_values: []
+
+# processes
+processes:
+ - name: queue_kinematics
+ trigger_conditions:
+ - on_input: kinematics
+ outcomes:
+ - to_queue: kinematics
+ - name: maneuver
+ trigger_conditions:
+ - on_input: emergency_control_cmd
+ reads:
+ - from_queue: kinematics
+ outcomes:
+ - to_output: control_cmd
diff --git a/demo/autoware_system_designer_demo_systems/design/ee_architecture/TypeAlphaBridge.ee_architecture.yaml b/demo/autoware_system_designer_demo_systems/design/ee_architecture/TypeAlphaBridge.ee_architecture.yaml
index 5156055a..dbc0a93d 100644
--- a/demo/autoware_system_designer_demo_systems/design/ee_architecture/TypeAlphaBridge.ee_architecture.yaml
+++ b/demo/autoware_system_designer_demo_systems/design/ee_architecture/TypeAlphaBridge.ee_architecture.yaml
@@ -144,6 +144,8 @@ bindings:
environment: ecu_c/host
- compute_unit: vehicle_system
environment: ecu_d/host
+ - compute_unit: mrm
+ environment: ecu_d/host
- peripheral: lidar_top
device: lidar_top
- peripheral: lidar_left
diff --git a/demo/autoware_system_designer_demo_systems/design/ee_architecture/TypeAlphaHost.ee_architecture.yaml b/demo/autoware_system_designer_demo_systems/design/ee_architecture/TypeAlphaHost.ee_architecture.yaml
index ada48a8a..dc49823e 100644
--- a/demo/autoware_system_designer_demo_systems/design/ee_architecture/TypeAlphaHost.ee_architecture.yaml
+++ b/demo/autoware_system_designer_demo_systems/design/ee_architecture/TypeAlphaHost.ee_architecture.yaml
@@ -106,6 +106,8 @@ bindings:
environment: ecu/planning_control
- compute_unit: vehicle_system
environment: ecu/vehicle_system
+ - compute_unit: mrm
+ environment: ecu/vehicle_system
- peripheral: lidar_top
device: lidar_top
- peripheral: lidar_left
diff --git a/demo/autoware_system_designer_demo_systems/design/system/TypeAlpha.system.yaml b/demo/autoware_system_designer_demo_systems/design/system/TypeAlpha.system.yaml
index 3a894a9f..7a0a047a 100644
--- a/demo/autoware_system_designer_demo_systems/design/system/TypeAlpha.system.yaml
+++ b/demo/autoware_system_designer_demo_systems/design/system/TypeAlpha.system.yaml
@@ -2,7 +2,7 @@ autoware_system_design_format: 0.5.0
name: TypeAlpha.system
-description: Demo system Type Alpha - dummy sensing, map, localization, perception, planning, control, vehicle and system components spread over four onboard ECUs, with a simulation mode that swaps the perception module.
+description: Demo system Type Alpha - dummy sensing, map, localization, perception, planning, control, vehicle and system components spread over four onboard ECUs, a minimal risk maneuver unit in a communication domain of its own bridged to the main one, and a simulation mode that swaps the perception module.
arguments:
- name: vehicle_id
@@ -24,15 +24,38 @@ modes:
- name: simulation
description: Simulation mode
+communication_domains:
+ - name: main
+ description: Driving stack.
+ id: 1
+ prefix: /main
+ - name: mrm
+ description: Minimal risk maneuver, joined to the main domain by the mrm bridge.
+ id: 3
+ prefix: /mrm
+
compute_units:
- name: sensing_perception
description: Sensing and perception.
+ communication_domain: main
- name: map_localization
description: Map and localization.
+ communication_domain: main
- name: planning_control
description: Planning and control.
+ communication_domain: main
- name: vehicle_system
- description: Vehicle interface and system monitoring.
+ description: Vehicle interface, system monitoring and the bridge to the minimal risk maneuver.
+ communication_domain: main
+ - name: mrm
+ description: Minimal risk maneuver.
+ communication_domain: mrm
+
+domain_bridges:
+ - name: mrm_bridge
+ type: ros2_domain_bridge
+ compute_unit: mrm
+ domains: [main, mrm]
peripherals:
- name: lidar_top
@@ -120,6 +143,9 @@ components:
- name: robot_state_publisher
entity: RobotStatePublisherDummy.node
compute_unit: sensing_perception
+ - name: mrm
+ entity: MrmDummy.node
+ compute_unit: mrm
node_groups:
- name: pointcloud_container
@@ -173,6 +199,13 @@ connections:
- system.subscriber.control_cmd
- - system.publisher.emergency_control_cmd
- control.subscriber.emergency_control_cmd
+ # the minimal risk maneuver hears the main domain and answers into it; the mrm bridge carries these
+ - - localization.publisher.kinematic_state
+ - mrm.subscriber.kinematics
+ - - system.publisher.emergency_control_cmd
+ - mrm.subscriber.emergency_control_cmd
+ - - mrm.publisher.control_cmd
+ - control.subscriber.mrm_control_cmd
# mode configuration
simulation:
diff --git a/demo/autoware_system_designer_demo_systems/package.xml b/demo/autoware_system_designer_demo_systems/package.xml
index 4fa5e930..086fa8eb 100644
--- a/demo/autoware_system_designer_demo_systems/package.xml
+++ b/demo/autoware_system_designer_demo_systems/package.xml
@@ -16,6 +16,7 @@
xacro
autoware_system_designer_demo_nodes
+ domain_bridge
rclcpp_components
robot_state_publisher
diff --git a/demo/docker_multi_unit/Dockerfile b/demo/docker_multi_unit/Dockerfile
index 263944bc..dab53113 100644
--- a/demo/docker_multi_unit/Dockerfile
+++ b/demo/docker_multi_unit/Dockerfile
@@ -12,6 +12,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
python3-jinja2 \
python3-jsonschema \
python3-yaml \
+ ros-${ROS_DISTRO}-domain-bridge \
ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \
ros-${ROS_DISTRO}-robot-state-publisher \
ros-${ROS_DISTRO}-xacro \
diff --git a/demo/docker_multi_unit/README.md b/demo/docker_multi_unit/README.md
index 8b830b39..91816070 100644
--- a/demo/docker_multi_unit/README.md
+++ b/demo/docker_multi_unit/README.md
@@ -4,7 +4,7 @@ One studio daemon per execution environment of the compute units, each in its ow
standing in for a multi-ECU bench.
The containers build the system designer packages of this checkout and run the demo system
`autoware_system_designer_demo_systems:TypeAlpha`: the nodes of
-[`autoware_system_designer_demo_nodes`](../autoware_system_designer_demo_nodes/README.md) on four onboard
+[`autoware_system_designer_demo_nodes`](../autoware_system_designer_demo_nodes/README.md) on five onboard
units, exchanging `std_msgs` messages, every unit subscribing topics published on the others.
| Unit | Components | Daemon port |
@@ -12,7 +12,13 @@ units, exchanging `std_msgs` messages, every unit subscribing topics published o
| `sensing_perception` | sensing, perception, robot state publisher | 8781 |
| `map_localization` | map, localization | 8782 |
| `planning_control` | planning, control | 8783 |
-| `vehicle_system` | vehicle, system monitor | 8784 |
+| `vehicle_system` | vehicle, system monitor, mrm bridge | 8784 |
+| `mrm` | minimal risk maneuver | 8784 |
+
+The units run in the communication domains of the system design, `main` (1) and `mrm` (3), whatever
+`ASD_ROS_DOMAIN_ID` is. `mrm` runs in the environment of `vehicle_system`; the
+domain bridge `mrm_bridge` on `vehicle_system` carries its inputs and its control command between the
+domains.
In `TypeAlphaSharedEnvironment` one daemon on port 8782 serves `map_localization` and `planning_control`.
@@ -114,7 +120,7 @@ curl -s http://127.0.0.1:8781/api/rpc -H 'Content-Type: application/json' -H 'X-
| Variable | Default | Role |
| ------------------------ | ----------------------------------- | ----------------------------------------------- |
| `ASD_ROS_DISTRO` | `humble` | ROS distribution of the image |
-| `ASD_ROS_DOMAIN_ID` | `87` | DDS domain of the units |
+| `ASD_ROS_DOMAIN_ID` | `1` | DDS domain of the containers' own tools |
| `ASD_RMW_IMPLEMENTATION` | the distribution's | RMW implementation, e.g. `rmw_cyclonedds_cpp` |
| `ASD_UID`, `ASD_GID` | the calling user's | ids of the container user |
| `ASD_STATE_DIR` | `$XDG_RUNTIME_DIR/asd-multi-unit` | keys, known hosts, exports, derived projects |
diff --git a/demo/docker_multi_unit/compose.base.yaml b/demo/docker_multi_unit/compose.base.yaml
index e21a7c6b..a4a4d349 100644
--- a/demo/docker_multi_unit/compose.base.yaml
+++ b/demo/docker_multi_unit/compose.base.yaml
@@ -28,7 +28,7 @@ services:
init: true
stop_grace_period: 20s
environment:
- ROS_DOMAIN_ID: ${ASD_ROS_DOMAIN_ID:-87}
+ ROS_DOMAIN_ID: ${ASD_ROS_DOMAIN_ID:-1}
ASD_RMW_IMPLEMENTATION: ${ASD_RMW_IMPLEMENTATION:-}
ASD_SSHD_PORT: ${ASD_SSHD_PORT:-2222}
volumes:
diff --git a/demo/docker_multi_unit/run.py b/demo/docker_multi_unit/run.py
index 8d4fed10..b329b535 100755
--- a/demo/docker_multi_unit/run.py
+++ b/demo/docker_multi_unit/run.py
@@ -62,7 +62,7 @@
BASE_FILE = HERE / "compose.base.yaml"
BUILD_PROJECT = "asd-multi-unit-build"
ROS_DISTRO = os.environ.get("ASD_ROS_DISTRO") or "humble"
-ROS_DOMAIN_ID = os.environ.get("ASD_ROS_DOMAIN_ID") or "87"
+ROS_DOMAIN_ID = os.environ.get("ASD_ROS_DOMAIN_ID") or "1"
# Mounted read-only into every environment: authorized_keys and the key a daemon reaches its peers with.
SITE_DIR = STATE_DIR / "site"
diff --git a/demo/docker_multi_unit/test/test_multi_unit.py b/demo/docker_multi_unit/test/test_multi_unit.py
index 526172fb..a2ab1d5d 100644
--- a/demo/docker_multi_unit/test/test_multi_unit.py
+++ b/demo/docker_multi_unit/test/test_multi_unit.py
@@ -36,10 +36,11 @@
"map_localization": ("/localization", "/sensing/lidar/concatenated/pointcloud"),
"planning_control": ("/planning", "/perception/object_recognition/objects"),
"vehicle_system": ("/system", "/localization/kinematic_state"),
+ "mrm": ("/mrm", "/localization/kinematic_state"),
}
MIN_RATE_HZ = 5.0 # the inputs arrive at 10 Hz or more
# Processes a launch of the units leaves behind when it does not end cleanly.
-NODES = "autoware_system_designer_demo_nodes|component_container|robot_state_publisher"
+NODES = "autoware_system_designer_demo_nodes|component_container|robot_state_publisher|domain_bridge"
# An SSH forward gone silent ends within 15 s and is tried again within 15 s.
LINK_TIMEOUT_S = 90
# Fast DDS participants frozen past their discovery lease do not always match their peers again.