Skip to content

Commit b676f5c

Browse files
authored
feat: enhance launch configuration with intra-process communication support (#49)
* feat: enhance launch configuration with intra-process communication support - Added a new parameter `use_intra_process_comms` to the `LaunchManager` and `LaunchConfig` classes to enable intra-process communication for composable nodes. - Updated the `update` method in `LaunchManager` to handle the new parameter, allowing for dynamic configuration of intra-process communication. - Introduced new node group specifications in `node_groups.py` to support component containers with intra-process communication enabled. - Modified the XML template in `component_launcher.xml.jinja2` to conditionally include the `use_intra_process_comms` argument based on the node configuration. These changes improve the flexibility and performance of the Autoware System Designer by allowing for more efficient communication between nodes. Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp> * fix: update launch manager and node group specifications for clarity - Added `Optional` type hint for `use_intra_process_comms` in the `update` method of `LaunchManager`, allowing for clearer handling of IPC settings. - Renamed node group specifications in `node_groups.py` from `ros2_component_container_mt_icp` to `ros2_component_container_mt_ipc` and from `ros2_component_container_icp` to `ros2_component_container_ipc` for consistency and clarity. These changes enhance the maintainability and readability of the codebase, improving the overall clarity of launch configurations in the Autoware System Designer. Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp> * fix: update intra-process communication handling in XML template Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp> * fix: integrate intra-process communication parameter into LaunchConfig Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp> --------- Signed-off-by: Taekjin LEE <taekjin.lee@tier4.jp>
1 parent 5d5faa6 commit b676f5c

4 files changed

Lines changed: 39 additions & 4 deletions

File tree

autoware_system_designer/autoware_system_designer/building/config/launch_manager.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
from typing import TYPE_CHECKING, Any, Dict
15+
from typing import TYPE_CHECKING, Any, Dict, Optional
1616

1717
from ..runtime.execution import LaunchConfig, LaunchState
1818

@@ -37,11 +37,13 @@ def from_config(cls, config: Any) -> "LaunchManager":
3737
launch_config = LaunchConfig.from_config(config)
3838
return cls(launch_config=launch_config)
3939

40-
def update(self, container_target: str = ""):
41-
"""Update launch configuration with new container target and/or launch type."""
40+
def update(self, container_target: str = "", use_intra_process_comms: Optional[bool] = None):
41+
"""Update launch configuration with a new container target and/or IPC setting."""
4242
if container_target:
4343
self.launch_config.container_target = container_target
4444
self.launch_config.launch_state = LaunchState.COMPOSABLE_NODE
45+
if use_intra_process_comms is not None:
46+
self.launch_config.use_intra_process_comms = use_intra_process_comms
4547

4648
@property
4749
def package_name(self) -> str:
@@ -70,6 +72,7 @@ def get_launcher_data(self, instance: "Instance") -> Dict[str, Any]:
7072
case LaunchState.COMPOSABLE_NODE:
7173
launcher_data["container_target"] = cfg.container_target
7274
launcher_data["plugin"] = cfg.plugin
75+
launcher_data["use_intra_process_comms"] = cfg.use_intra_process_comms
7376
case _: # SINGLE_NODE
7477
launcher_data["executable"] = cfg.executable
7578

autoware_system_designer/autoware_system_designer/building/instances/node_groups.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,24 @@
3030
"type": "node_container",
3131
},
3232
},
33+
"ros2_component_container_mt_ipc": {
34+
"package_name": "rclcpp_components",
35+
"package_provider": "ros2",
36+
"launch": {
37+
"executable": "component_container_mt",
38+
"type": "node_container",
39+
"use_intra_process_comms": True,
40+
},
41+
},
42+
"ros2_component_container_ipc": {
43+
"package_name": "rclcpp_components",
44+
"package_provider": "ros2",
45+
"launch": {
46+
"executable": "component_container",
47+
"type": "node_container",
48+
"use_intra_process_comms": True,
49+
},
50+
},
3351
}
3452

3553

@@ -92,6 +110,8 @@ def apply_node_groups(instance: "Instance") -> None:
92110
)
93111
container_target_path = container_instance.path
94112

113+
use_ipc = NODE_GROUP_CONTAINER_SPECS[group_type]["launch"].get("use_intra_process_comms", False)
114+
95115
for node_instance in matched_nodes:
96116
previous_target = node_instance.launch_manager.launch_config.container_target
97117
if previous_target and previous_target != container_target_path:
@@ -102,7 +122,10 @@ def apply_node_groups(instance: "Instance") -> None:
102122
container_target_path,
103123
)
104124

105-
node_instance.launch_manager.update(container_target=container_target_path)
125+
node_instance.launch_manager.update(
126+
container_target=container_target_path,
127+
use_intra_process_comms=use_ipc,
128+
)
106129

107130

108131
def _resolve_group_compute_unit(

autoware_system_designer/autoware_system_designer/building/runtime/execution.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def __init__(
5858
executable: str = "",
5959
container_target: str = "",
6060
launch_state: LaunchState = LaunchState.SINGLE_NODE,
61+
use_intra_process_comms: bool = False,
6162
):
6263
self.package_name = package_name
6364
self.ros2_launch_file = ros2_launch_file
@@ -67,6 +68,7 @@ def __init__(
6768
self.executable = executable
6869
self.container_target = container_target
6970
self.launch_state = launch_state
71+
self.use_intra_process_comms = use_intra_process_comms
7072

7173
@classmethod
7274
def from_config(cls, config: Any) -> "LaunchConfig":
@@ -81,6 +83,7 @@ def from_config(cls, config: Any) -> "LaunchConfig":
8183
executable = launch.get("executable", "")
8284
container_target = launch.get("container_target", launch.get("container_name", ""))
8385
launch_state = LaunchState.from_config(launch)
86+
use_intra_process_comms = bool(launch.get("use_intra_process_comms", False))
8487

8588
return cls(
8689
package_name=package_name,
@@ -91,6 +94,7 @@ def from_config(cls, config: Any) -> "LaunchConfig":
9194
executable=executable,
9295
container_target=container_target,
9396
launch_state=launch_state,
97+
use_intra_process_comms=use_intra_process_comms,
9498
)
9599

96100
def apply_override(self, override: Dict[str, Any]) -> None:
@@ -105,6 +109,8 @@ def apply_override(self, override: Dict[str, Any]) -> None:
105109
self.args = override["args"]
106110
if "container_target" in override:
107111
self.container_target = override["container_target"]
112+
if "use_intra_process_comms" in override:
113+
self.use_intra_process_comms = bool(override["use_intra_process_comms"])
108114

109115
override_launch_state: Optional[LaunchState] = self.launch_state
110116
if "launch_state" in override and override["launch_state"] in LaunchState._value2member_map_:

autoware_system_designer/autoware_system_designer/ros2_launcher/templates/component_launcher.xml.jinja2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@
7575
<load_composable_node target="{{ node.container_target }}">
7676
<composable_node pkg="{{ node.package }}" plugin="{{ node.plugin }}" name="{{ node.name }}" namespace="{{ node.namespace }}">
7777
{{ node_configuration(node)|indent(6) }}
78+
{% if node.use_intra_process_comms|default(false) %}
79+
<extra_arg name="use_intra_process_comms" value="true"/>
80+
{% endif %}
7881
</composable_node>
7982
</load_composable_node>
8083
{% elif node.launch_state == 'node_container' %}

0 commit comments

Comments
 (0)