Skip to content

Commit

Permalink
feat: add autoware_global_parameter_loader (autowarefoundation#127)
Browse files Browse the repository at this point in the history
* Move autoware_global_parameter_loader to the appropriate place (autowarefoundation#1701)

* Move autoware_global_parameter_loader to the appropriate place

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Fix package name

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Rename vehicle_info param arg to avoid conflicts (autowarefoundation#2074)

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Change formatter to clang-format and black (autowarefoundation#2332)

* Revert "Temporarily comment out pre-commit hooks"

This reverts commit 748e9cdb145ce12f8b520bcbd97f5ff899fc28a3.

* Replace ament_lint_common with autoware_lint_common

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Remove ament_cmake_uncrustify and ament_clang_format

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Apply Black

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Apply clang-format

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Fix build errors

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Fix for cpplint

* Fix include double quotes to angle brackets

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Apply clang-format

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Fix build errors

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* Add COLCON_IGNORE (autowarefoundation#500)

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>

* remove COLCON_IGNORE (autowarefoundation#510)

Co-authored-by: Takayuki Murooka <takayuki.murooka@tier4.jp>

* Auto/add readme common pkg (autowarefoundation#567)

* add description to global paraemeter loader

* add readme to rosbag recorde

* fix typo

Co-authored-by: Kazuki Miyahara <kmiya@outlook.com>

* Fix Format

Co-authored-by: Kazuki Miyahara <kmiya@outlook.com>

* Clarify the description

Co-authored-by: Kazuki Miyahara <kmiya@outlook.com>

* Fix Typo

Co-authored-by: tkimura4 <tomoya.kimura@tier4.jp>

* proper description

Co-authored-by: Kazuki Miyahara <kmiya@outlook.com>
Co-authored-by: tkimura4 <tomoya.kimura@tier4.jp>

Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com>
Co-authored-by: Takayuki Murooka <takayuki5168@gmail.com>
Co-authored-by: Takayuki Murooka <takayuki.murooka@tier4.jp>
Co-authored-by: taikitanaka3 <65527974+taikitanaka3@users.noreply.github.com>
Co-authored-by: Kazuki Miyahara <kmiya@outlook.com>
Co-authored-by: Takeshi Miura <57553950+1222-takeshi@users.noreply.github.com>
Signed-off-by: 1222-takeshi <m.takeshi1995@gmail.com>
  • Loading branch information
7 people committed Dec 8, 2021
1 parent d65c231 commit 56a5e31
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 0 deletions.
15 changes: 15 additions & 0 deletions common/autoware_global_parameter_loader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.5)
project(autoware_global_parameter_loader)

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
)
18 changes: 18 additions & 0 deletions common/autoware_global_parameter_loader/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Autoware Global Parameter Loader

This package is to set common ROS parameters to each node.

## Usage

Add the following lines to the launch file of the node in which you want to get global parameters.

```xml
<!-- Global parameters -->
<include file="$(find-pkg-share autoware_global_parameter_loader)/launch/global_params.launch.py">
<arg name="vehicle_model" value="$(var vehicle_model)"/>
</include>
```

## Assumptions / Known limits

Currently only vehicle_info is loaded by this launcher.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# 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_info_util"), "/launch/vehicle_info.launch.py"]
),
launch_arguments={
"vehicle_info_param_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),
]
)
19 changes: 19 additions & 0 deletions common/autoware_global_parameter_loader/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<package format="3">
<name>autoware_global_parameter_loader</name>
<version>0.1.0</version>
<description>The autoware_global_parameter_loader package</description>
<maintainer email="kenji.miyake@tier4.jp">Kenji Miyake</maintainer>
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake_auto</buildtool_depend>

<exec_depend>vehicle_info_util</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 56a5e31

Please sign in to comment.