Skip to content

Commit

Permalink
Move autoware api launch files (autowarefoundation#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
isamu-takagi committed Sep 3, 2021
1 parent 1a0b6bc commit 2d149ca
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 7 deletions.
6 changes: 3 additions & 3 deletions autoware_api_launch/launch/autoware_api.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<!-- autoware api adaptor -->
<group>
<push-ros-namespace namespace="autoware_api"/>
<include file="$(find-pkg-share autoware_iv_external_api_adaptor)/launch/external_api_adaptor.launch.py"/>
<include file="$(find-pkg-share autoware_iv_internal_api_adaptor)/launch/internal_api_adaptor.launch.py"/>
<include file="$(find-pkg-share autoware_iv_internal_api_adaptor)/launch/internal_api_relay.launch.xml"/>
<include file="$(find-pkg-share autoware_api_launch)/launch/include/external_api_adaptor.launch.py"/>
<include file="$(find-pkg-share autoware_api_launch)/launch/include/internal_api_adaptor.launch.py"/>
<include file="$(find-pkg-share autoware_api_launch)/launch/include/internal_api_relay.launch.xml"/>
</group>

<!-- autoware api utils -->
Expand Down
52 changes: 52 additions & 0 deletions autoware_api_launch/launch/include/external_api_adaptor.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright 2021 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.

import launch
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode


def _create_api_node(node_name, class_name, **kwargs):
return ComposableNode(
namespace='external',
name=node_name,
package='autoware_iv_external_api_adaptor',
plugin='external_api::' + class_name,
**kwargs
)


def generate_launch_description():
components = [
_create_api_node('diagnostics', 'Diagnostics'),
_create_api_node('door', 'Door'),
_create_api_node('emergency', 'Emergency'),
_create_api_node('engage', 'Engage'),
_create_api_node('initial_pose', 'InitialPose'),
_create_api_node('map', 'Map'),
_create_api_node('operator', 'Operator'),
_create_api_node('route', 'Route'),
_create_api_node('service', 'Service'),
_create_api_node('velocity', 'Velocity'),
_create_api_node('version', 'Version'),
]
container = ComposableNodeContainer(
namespace='external',
name='autoware_iv_adaptor',
package='rclcpp_components',
executable='component_container_mt',
composable_node_descriptions=components,
output='screen',
)
return launch.LaunchDescription([container])
51 changes: 51 additions & 0 deletions autoware_api_launch/launch/include/internal_api_adaptor.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Copyright 2021 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.

import launch
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import ComposableNodeContainer
from launch_ros.descriptions import ComposableNode


def _create_api_node(node_name, class_name, **kwargs):
return ComposableNode(
namespace='internal',
name=node_name,
package='autoware_iv_internal_api_adaptor',
plugin='internal_api::' + class_name,
**kwargs
)


def generate_launch_description():
param_initial_pose = {
'init_simulator_pose': LaunchConfiguration('init_simulator_pose'),
'init_localization_pose': LaunchConfiguration('init_localization_pose'),
}
components = [
_create_api_node('initial_pose', 'InitialPose', parameters=[param_initial_pose]),
_create_api_node('operator', 'Operator'),
_create_api_node('route', 'Route'),
_create_api_node('start', 'Start'),
_create_api_node('velocity', 'Velocity'),
]
container = ComposableNodeContainer(
namespace='internal',
name='autoware_iv_adaptor',
package='rclcpp_components',
executable='component_container_mt',
composable_node_descriptions=components,
output='screen',
)
return launch.LaunchDescription([container])
26 changes: 26 additions & 0 deletions autoware_api_launch/launch/include/internal_api_relay.launch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<launch>
<group>
<push-ros-namespace namespace="internal"/>
<node pkg="topic_tools" exec="relay" name="traffic_light_states">
<param name="input_topic" value="/api/autoware/set/traffic_light_states"/>
<param name="output_topic" value="/external/traffic_light_recognition/traffic_light_states"/>
<param name="type" value="autoware_perception_msgs/msg/TrafficLightStateArray"/>
</node>
<node pkg="topic_tools" exec="relay" name="intersection_states">
<param name="input_topic" value="/api/autoware/set/intersection_states"/>
<param name="output_topic" value="/planning/scenario_planning/lane_driving/behavior_planning/behavior_velocity_planner/input/external_intersection_states"/>
<param name="type" value="autoware_api_msgs/msg/IntersectionStatus"/>
</node>
<node pkg="topic_tools" exec="relay" name="crosswalk_states">
<param name="input_topic" value="/api/autoware/set/crosswalk_states"/>
<param name="output_topic" value="/planning/scenario_planning/lane_driving/behavior_planning/behavior_velocity_planner/input/external_crosswalk_states"/>
<param name="type" value="autoware_api_msgs/msg/CrosswalkStatus"/>
</node>
<!-- TODO(Takagi, Isamu): workaround for topic check -->
<node pkg="topic_tools" exec="relay" name="initialpose">
<param name="input_topic" value="/initialpose"/>
<param name="output_topic" value="/initialpose2d"/>
<param name="type" value="geometry_msgs/msg/PoseWithCovarianceStamped"/>
</node>
</group>
</launch>
2 changes: 2 additions & 0 deletions autoware_api_launch/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@

<buildtool_depend>ament_cmake_auto</buildtool_depend>

<exec_depend>awapi_awiv_adapter</exec_depend>
<exec_depend>autoware_iv_external_api_adaptor</exec_depend>
<exec_depend>autoware_iv_internal_api_adaptor</exec_depend>
<exec_depend>path_distance_calculator</exec_depend>
<exec_depend>topic_tools</exec_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
Expand Down
5 changes: 1 addition & 4 deletions autoware_launch/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<buildtool_depend>ament_cmake_auto</buildtool_depend>

<!-- launch -->
<exec_depend>autoware_api_launch</exec_depend>
<exec_depend>control_launch</exec_depend>
<exec_depend>localization_launch</exec_depend>
<exec_depend>map_launch</exec_depend>
Expand All @@ -30,10 +31,6 @@
<exec_depend condition="$ROS_PYTHON_VERSION == 2">python-bson</exec_depend>
<exec_depend condition="$ROS_PYTHON_VERSION == 3">python3-bson</exec_depend>

<!-- api adaptor -->
<exec_depend>awapi_awiv_adapter</exec_depend>
<exec_depend>autoware_iv_external_api_adaptor</exec_depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>

Expand Down

0 comments on commit 2d149ca

Please sign in to comment.