Skip to content

Commit

Permalink
test(static_centerline_generator): add launch test with autoware_samp…
Browse files Browse the repository at this point in the history
…le_vehicle_launch pakcage

Signed-off-by: Takayuki Murooka <takayuki5168@gmail.com>
  • Loading branch information
takayuki5168 committed Jan 8, 2025
1 parent 7782ea7 commit d4c37a6
Showing 8 changed files with 118 additions and 15 deletions.
9 changes: 9 additions & 0 deletions common/autoware_sample_vehicle_launch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.14)
project(autoware_sample_vehicle_launch)

find_package(autoware_cmake REQUIRED)
autoware_package()

ament_auto_package(INSTALL_TO_SHARE
launch
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<launch/>
18 changes: 18 additions & 0 deletions common/autoware_sample_vehicle_launch/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0"?>
<package format="2">
<name>autoware_sample_vehicle_launch</name>
<version>0.1.0</version>
<description>The autoware_sample_vehicle_launch package</description>

<maintainer email="temkei.kem@tier4.jp">Temkei Kem</maintainer>
<maintainer email="kosuke.takeuchi@tier4.jp">Kosuke Takeuchi</maintainer>
<maintainer email="takayuki.murooka@tier4.jp">Takayuki Murooka</maintainer>
<license>Apache2</license>

<buildtool_depend>ament_cmake_auto</buildtool_depend>
<buildtool_depend>autoware_cmake</buildtool_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
4 changes: 4 additions & 0 deletions planning/autoware_static_centerline_generator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -52,6 +52,10 @@ if(BUILD_TESTING)
test/test_static_centerline_generator.test.py
TIMEOUT "30"
)
add_launch_test(
test/test_static_centerline_generator_launch.test.py
TIMEOUT "30"
)
install(DIRECTORY
test/data/
DESTINATION share/${PROJECT_NAME}/test/data/
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<launch>
<!-- mandatory arguments for planning-->
<arg name="vehicle_model"/>
<arg name="vehicle_model" default="autoware_sample_vehicle"/>

<!-- flag -->
<arg name="mode" default="AUTO" description="select from AUTO, GUI, and VMB"/>
@@ -35,20 +35,20 @@

<!-- Global parameters (for PathFootprint in tier4_planning_rviz_plugin) -->
<!-- Do not add "group" in order to propagate global parameters -->
<include file="$(find-pkg-share autoware_global_parameter_loader)/launch/global_params.launch.py">
<include file="$(find-pkg-share global_parameter_loader)/launch/global_params.launch.py">
<arg name="vehicle_model" value="$(var vehicle_model)"/>
</include>

<!-- generate tf from "viewer" to "map" -->
<node pkg="autoware_map_tf_generator" exec="autoware_vector_map_tf_generator" name="vector_map_tf_generator">
<node pkg="map_tf_generator" exec="vector_map_tf_generator" name="vector_map_tf_generator">
<remap from="vector_map" to="$(var lanelet2_map_topic)"/>

<param name="map_frame" value="map"/>
<param name="viewer_frame" value="viewer"/>
</node>

<!-- visualize map -->
<node pkg="autoware_lanelet2_map_visualizer" exec="lanelet2_map_visualization" name="lanelet2_map_visualization">
<node pkg="map_loader" exec="lanelet2_map_visualization" name="lanelet2_map_visualization">
<remap from="input/lanelet2_map" to="$(var lanelet2_map_topic)"/>
<remap from="output/lanelet2_map_marker" to="$(var lanelet2_map_marker_topic)"/>
</node>
8 changes: 4 additions & 4 deletions planning/autoware_static_centerline_generator/package.xml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>autoware_static_centerline_generator</name>
<version>0.40.0</version>
<version>0.38.0</version>
<description>The autoware_static_centerline_generator package</description>
<maintainer email="takayuki.murooka@tier4.jp">Takayuki Murooka</maintainer>
<maintainer email="kosuke.takeuchi@tier4.jp">Kosuke Takeuchi</maintainer>
@@ -17,14 +17,11 @@

<depend>autoware_behavior_path_planner_common</depend>
<depend>autoware_geography_utils</depend>
<depend>autoware_global_parameter_loader</depend>
<depend>autoware_interpolation</depend>
<depend>autoware_lanelet2_extension</depend>
<depend>autoware_lanelet2_map_visualizer</depend>
<depend>autoware_map_loader</depend>
<depend>autoware_map_msgs</depend>
<depend>autoware_map_projection_loader</depend>
<depend>autoware_map_tf_generator</depend>
<depend>autoware_mission_planner</depend>
<depend>autoware_motion_utils</depend>
<depend>autoware_osqp_interface</depend>
@@ -36,8 +33,10 @@
<depend>autoware_universe_utils</depend>
<depend>autoware_vehicle_info_utils</depend>
<depend>geometry_msgs</depend>
<depend>global_parameter_loader</depend>
<depend>rclcpp</depend>
<depend>rclcpp_components</depend>
<depend>tier4_map_msgs</depend>

<exec_depend>python3-flask-cors</exec_depend>
<exec_depend>rosidl_default_runtime</exec_depend>
@@ -47,6 +46,7 @@
<test_depend>autoware_behavior_path_planner</test_depend>
<test_depend>autoware_behavior_velocity_planner</test_depend>
<test_depend>autoware_lint_common</test_depend>
<test_depend>autoware_sample_vehicle_launch</test_depend>
<test_depend>ros_testing</test_depend>

<member_of_group>rosidl_interface_packages</member_of_group>
Original file line number Diff line number Diff line change
@@ -27,21 +27,20 @@

@pytest.mark.launch_test
def generate_test_description():
lanelet2_map_path = os.path.join(
get_package_share_directory("autoware_static_centerline_generator"),
"test/data/lanelet2_map.osm",
)

static_centerline_generator_node = Node(
package="autoware_static_centerline_generator",
executable="main",
output="screen",
parameters=[
{"lanelet2_map_path": lanelet2_map_path},
{"mode": "AUTO"},
{"rviz": False},
{"centerline_source": "optimization_trajectory_base"},
{"lanelet2_input_file_path": lanelet2_map_path},
{
"lanelet2_input_file_path": os.path.join(
get_package_share_directory("autoware_static_centerline_generator"),
"test/data/lanelet2_map.osm",
)
},
{"lanelet2_output_file_path": "/tmp/lanelet2_map.osm"},
{"start_lanelet_id": 215},
{"end_lanelet_id": 216},
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env python3

# Copyright 2024 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 os
import unittest

from ament_index_python import get_package_share_directory
import launch
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import AnyLaunchDescriptionSource
import launch_testing
import pytest


@pytest.mark.launch_test
def generate_test_description():
test_static_centerline_generator_launch_file = os.path.join(
get_package_share_directory("autoware_static_centerline_generator"),
"launch",
"static_centerline_generator.launch.xml",
)

static_centerline_generator = IncludeLaunchDescription(
AnyLaunchDescriptionSource(test_static_centerline_generator_launch_file),
)

return LaunchDescription(
[
DeclareLaunchArgument(
"lanelet2_input_file_path",
default_value=os.path.join(
get_package_share_directory("autoware_static_centerline_generator"),
"test/data/lanelet2_map.osm",
),
),
DeclareLaunchArgument(
"lanelet2_output_file_path", default_value="/tmp/lanelet2_map.osm"
),
DeclareLaunchArgument("rviz", default_value="false"),
DeclareLaunchArgument("start_lanelet_id", default_value="215"),
DeclareLaunchArgument("end_lanelet_id", default_value="216"),
DeclareLaunchArgument(
"centerline_source", default_value="optimization_trajectory_base"
),
static_centerline_generator,
# Start test after 1s - gives time for the autoware_static_centerline_generator to finish initialization
launch.actions.TimerAction(period=1.0, actions=[launch_testing.actions.ReadyToTest()]),
]
)


@launch_testing.post_shutdown_test()
class TestProcessOutput(unittest.TestCase):
def test_exit_code(self, proc_info):
# Check that process exits with code 0: no error
launch_testing.asserts.assertExitCodes(proc_info)

0 comments on commit d4c37a6

Please sign in to comment.