Skip to content

Commit

Permalink
Add global_params.launch.py (tier4#260)
Browse files Browse the repository at this point in the history
Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>
  • Loading branch information
kenji-miyake authored Jul 8, 2021
1 parent d7992fe commit 30125e1
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 12 deletions.
5 changes: 2 additions & 3 deletions autoware_launch/launch/autoware.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
<arg name="pointcloud_map_file" default="pointcloud_map.pcd" />

<!-- Global parameters -->
<!-- Vehicle info -->
<include file="$(find-pkg-share vehicle_launch)/launch/vehicle_info.launch.py">
<arg name="config_file" value="$(find-pkg-share $(var vehicle_model)_description)/config/vehicle_info.param.yaml"/>
<include file="$(find-pkg-share autoware_launch)/launch/global_params.launch.py">
<arg name="vehicle_model" value="$(var vehicle_model)"/>
</include>

<!-- Vehicle -->
Expand Down
52 changes: 52 additions & 0 deletions autoware_launch/launch/global_params.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright 2021 Tier IV, Inc. All rights reserved.
#
# 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.

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.actions import IncludeLaunchDescription
from launch.actions import OpaqueFunction
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import SetParameter
from launch_ros.substitutions import FindPackageShare


def launch_setup(context, *args, **kwargs):
# use_sim_time
set_use_sim_time = SetParameter(name='use_sim_time', value=LaunchConfiguration('use_sim_time'))

# vehicle_info
vehicle_description_pkg = FindPackageShare([
LaunchConfiguration('vehicle_model'), '_description']).perform(context)

load_vehicle_info = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[FindPackageShare('vehicle_launch'), '/launch/vehicle_info.launch.py']
),
launch_arguments={
'config_file': [vehicle_description_pkg, '/config/vehicle_info.param.yaml']
}.items()
)

return [
set_use_sim_time,
load_vehicle_info,
]


def generate_launch_description():
return LaunchDescription([
DeclareLaunchArgument('use_sim_time', default_value='false'),
OpaqueFunction(function=launch_setup),
])
7 changes: 3 additions & 4 deletions autoware_launch/launch/logging_simulator.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@
<arg name="rviz" default="true" description="launch rviz" />
<arg name="lanelet2_map_file" default="lanelet2_map.osm" />
<arg name="pointcloud_map_file" default="pointcloud_map.pcd" />
<set_parameter name="use_sim_time" value="true" />

<!-- Global parameters -->
<!-- Vehicle info -->
<include file="$(find-pkg-share vehicle_launch)/launch/vehicle_info.launch.py">
<arg name="config_file" value="$(find-pkg-share $(var vehicle_model)_description)/config/vehicle_info.param.yaml"/>
<include file="$(find-pkg-share autoware_launch)/launch/global_params.launch.py">
<arg name="use_sim_time" value="true" />
<arg name="vehicle_model" value="$(var vehicle_model)"/>
</include>

<!-- Vehicle -->
Expand Down
7 changes: 2 additions & 5 deletions autoware_launch/launch/planning_simulator.launch.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@
<arg name="perception/enable_object_recognition" default="true"/>
<arg name="sensing/visible_range" default="300.0"/>
<arg name="scenario_simulation" default="false"/>
<arg name="use_sim_time" default="false" />
<set_parameter name="use_sim_time" value="$(var use_sim_time)" />
<!-- Optional parameters for vcu emulation -->
<arg name="vehicle_simulation" default="true"/>

<!-- Global parameters -->
<!-- Vehicle info -->
<include file="$(find-pkg-share vehicle_launch)/launch/vehicle_info.launch.py">
<arg name="config_file" value="$(find-pkg-share $(var vehicle_model)_description)/config/vehicle_info.param.yaml"/>
<include file="$(find-pkg-share autoware_launch)/launch/global_params.launch.py">
<arg name="vehicle_model" value="$(var vehicle_model)"/>
</include>

<!-- Vehicle -->
Expand Down

0 comments on commit 30125e1

Please sign in to comment.