Skip to content

Commit aa576c0

Browse files
authored
feat(tier4_autoware_api_launch): add some arguments (autowarefoundation#1324)
* feat(tier4_autoware_api_launch): add some arguments Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * fix launch py Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * deal with review Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * deal with review Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com> * deal with review Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
1 parent 99a4ea6 commit aa576c0

File tree

2 files changed

+48
-5
lines changed

2 files changed

+48
-5
lines changed

launch/tier4_autoware_api_launch/launch/autoware_api.launch.xml

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<launch>
22
<arg name="respawn_rosbridge" default="true"/>
3+
<arg name="launch_image_base64_converter" default="false"/>
4+
<arg name="launch_path_distance_calculator" default="false"/>
5+
<!-- external api adaptor -->
6+
<arg name="launch_calibration_status_api" default="false"/>
7+
<arg name="launch_start_api" default="true"/>
38

49
<!-- awapi (deprecated) -->
510
<group>
@@ -9,11 +14,21 @@
914
<!-- autoware api adaptor -->
1015
<group>
1116
<push-ros-namespace namespace="autoware_api"/>
12-
<include file="$(find-pkg-share tier4_autoware_api_launch)/launch/include/external_api_adaptor.launch.py"/>
17+
<include file="$(find-pkg-share tier4_autoware_api_launch)/launch/include/external_api_adaptor.launch.py">
18+
<arg name="launch_calibration_status_api" value="$(var launch_calibration_status_api)"/>
19+
<arg name="launch_start_api" value="$(var launch_start_api)"/>
20+
</include>
1321
<include file="$(find-pkg-share tier4_autoware_api_launch)/launch/include/internal_api_adaptor.launch.py"/>
1422
<include file="$(find-pkg-share tier4_autoware_api_launch)/launch/include/internal_api_relay.launch.xml"/>
1523
</group>
1624

25+
<!-- autoware api utils -->
26+
<group>
27+
<push-ros-namespace namespace="autoware_api/utils"/>
28+
<include file="$(find-pkg-share path_distance_calculator)/launch/path_distance_calculator.launch.xml" if="$(var launch_path_distance_calculator)"/>
29+
<include file="$(find-pkg-share image_base64_converter)/launch/image_base64_converter.launch.xml" if="$(var launch_image_base64_converter)"/>
30+
</group>
31+
1732
<!-- rosbridge -->
1833
<!-- TODO: respawn will work once https://github.com/ros2/launch/pull/569 is released. I'll delete this comment when it's done. -->
1934
<group>

launch/tier4_autoware_api_launch/launch/include/external_api_adaptor.launch.py

+32-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313
# limitations under the License.
1414

1515
import launch
16+
from launch.actions import DeclareLaunchArgument
17+
from launch.conditions import IfCondition
18+
from launch.substitutions import LaunchConfiguration
1619
from launch_ros.actions import ComposableNodeContainer
20+
from launch_ros.actions import LoadComposableNodes
1721
from launch_ros.descriptions import ComposableNode
1822

1923

@@ -28,7 +32,17 @@ def _create_api_node(node_name, class_name, **kwargs):
2832

2933

3034
def generate_launch_description():
31-
components = [
35+
launch_arguments = []
36+
37+
def add_launch_arg(name: str, default_value=None, description=None):
38+
launch_arguments.append(
39+
DeclareLaunchArgument(name, default_value=default_value, description=description)
40+
)
41+
42+
add_launch_arg("launch_calibration_status_api", None, "launch calibration status api")
43+
add_launch_arg("launch_start_api", None, "launch start api")
44+
45+
default_components = [
3246
_create_api_node("cpu_usage", "CpuUsage"),
3347
_create_api_node("diagnostics", "Diagnostics"),
3448
_create_api_node("door", "Door"),
@@ -41,7 +55,6 @@ def generate_launch_description():
4155
_create_api_node("metadata_packages", "MetadataPackages"),
4256
_create_api_node("route", "Route"),
4357
_create_api_node("service", "Service"),
44-
_create_api_node("start", "Start"),
4558
_create_api_node("vehicle_status", "VehicleStatus"),
4659
_create_api_node("velocity", "Velocity"),
4760
_create_api_node("version", "Version"),
@@ -51,7 +64,22 @@ def generate_launch_description():
5164
name="autoware_iv_adaptor",
5265
package="rclcpp_components",
5366
executable="component_container_mt",
54-
composable_node_descriptions=components,
67+
composable_node_descriptions=default_components,
5568
output="screen",
5669
)
57-
return launch.LaunchDescription([container])
70+
71+
calibration_status_loader = LoadComposableNodes(
72+
composable_node_descriptions=[_create_api_node("calibration_status", "CalibrationStatus")],
73+
target_container=container,
74+
condition=IfCondition(LaunchConfiguration("launch_calibration_status_api")),
75+
)
76+
77+
start_loader = LoadComposableNodes(
78+
composable_node_descriptions=[_create_api_node("start", "Start")],
79+
target_container=container,
80+
condition=IfCondition(LaunchConfiguration("launch_start_api")),
81+
)
82+
83+
return launch.LaunchDescription(
84+
launch_arguments + [container, calibration_status_loader, start_loader]
85+
)

0 commit comments

Comments
 (0)