Skip to content

Commit

Permalink
feat(tier4_autoware_api_launch): add tier4_autoware_api_launch package (
Browse files Browse the repository at this point in the history
tier4#658)

* feat(tier4_autoware_api_launch): add tier4_autoware_api_launch package

Signed-off-by: mitsudome-r <ryohsuke.mitsudome@tier4.jp>

* ci(pre-commit): autofix

* fix(tier4_autoware_api_launch): fix the command in the README instructions

Signed-off-by: mitsudome-r <ryohsuke.mitsudome@tier4.jp>

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
2 people authored and boyali committed Oct 3, 2022
1 parent 69eb0d4 commit b89e2a7
Show file tree
Hide file tree
Showing 7 changed files with 209 additions and 0 deletions.
12 changes: 12 additions & 0 deletions launch/tier4_autoware_api_launch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.5)
project(tier4_autoware_api_launch)

find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
endif()

ament_auto_package(INSTALL_TO_SHARE launch)
24 changes: 24 additions & 0 deletions launch/tier4_autoware_api_launch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# tier4_autoware_api_launch

## Description

This package contains launch files that run nodes to convert Autoware internal topics into consistent API used by external software (e.g., fleet management system, simulator).

## Package Dependencies

Please see `<exec_depend>` in `package.xml`.

## Usage

You can include as follows in `*.launch.xml` to use `control.launch.py`.

```xml
<include file="$(find-pkg-share tier4_autoware_api_launch)/launch/autoware_api.launch.xml">
<arg name="init_simulator_pose" value="true"/>
<arg name="init_localization_pose" value="false"/>
</include>
```

## Notes

For reducing processing load, we use the [Component](https://docs.ros.org/en/galactic/Concepts/About-Composition.html) feature in ROS2 (similar to Nodelet in ROS1 )
14 changes: 14 additions & 0 deletions launch/tier4_autoware_api_launch/launch/autoware_api.launch.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<launch>
<!-- awapi (deprecated) -->
<group>
<include file="$(find-pkg-share awapi_awiv_adapter)/launch/awapi_awiv_adapter.launch.xml"/>
</group>

<!-- autoware api adaptor -->
<group>
<push-ros-namespace namespace="autoware_api"/>
<include file="$(find-pkg-share tier4_autoware_api_launch)/launch/include/external_api_adaptor.launch.py"/>
<include file="$(find-pkg-share tier4_autoware_api_launch)/launch/include/internal_api_adaptor.launch.py"/>
<include file="$(find-pkg-share tier4_autoware_api_launch)/launch/include/internal_api_relay.launch.xml"/>
</group>
</launch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# 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("cpu_usage", "CpuUsage"),
_create_api_node("diagnostics", "Diagnostics"),
_create_api_node("door", "Door"),
_create_api_node("emergency", "Emergency"),
_create_api_node("engage", "Engage"),
_create_api_node("fail_safe_state", "FailSafeState"),
_create_api_node("initial_pose", "InitialPose"),
_create_api_node("map", "Map"),
_create_api_node("operator", "Operator"),
_create_api_node("metadata_packages", "MetadataPackages"),
_create_api_node("route", "Route"),
_create_api_node("service", "Service"),
_create_api_node("start", "Start"),
_create_api_node("vehicle_status", "VehicleStatus"),
_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])
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("iv_msgs", "IVMsgs"),
_create_api_node("operator", "Operator"),
_create_api_node("route", "Route"),
_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])
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_signals">
<param name="input_topic" value="/api/autoware/set/traffic_signals"/>
<param name="output_topic" value="/external/traffic_light_recognition/traffic_signals"/>
<param name="type" value="autoware_auto_perception_msgs/msg/TrafficSignalArray"/>
</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="tier4_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="tier4_api_msgs/msg/CrosswalkStatus"/>
</node>
<!-- TODO(Takagi, Isamu): workaround for topic check -->
<node pkg="topic_tools" exec="relay" name="initial_pose_2d">
<param name="input_topic" value="/initialpose"/>
<param name="output_topic" value="/initialpose2d"/>
<param name="type" value="geometry_msgs/msg/PoseWithCovarianceStamped"/>
</node>
</group>
</launch>
25 changes: 25 additions & 0 deletions launch/tier4_autoware_api_launch/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>tier4_autoware_api_launch</name>
<version>0.0.0</version>
<description>The tier4_autoware_api_launch package</description>
<maintainer email="isamu.takagi@tier4.jp">Takagi, Isamu</maintainer>
<maintainer email="ryohsuke.mitsudome@tier4.jp">Ryohsuke, Mitsudome</maintainer>
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake_auto</buildtool_depend>

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

<test_depend>ament_lint_auto</test_depend>
<test_depend>autoware_lint_common</test_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>

0 comments on commit b89e2a7

Please sign in to comment.