From c7e8e06762f597ffd7d7a8abfbd07f05fc3fb38e Mon Sep 17 00:00:00 2001 From: Tomoya Kimura Date: Sun, 5 Dec 2021 19:11:41 +0900 Subject: [PATCH] feat: add autoware_version package (#11) * Add autoware version node (#394) * Add autoware version node Signed-off-by: Takagi, Isamu * Remove todo Signed-off-by: Takagi, Isamu * Remove unused variable Signed-off-by: Takagi, Isamu * Fix node name Signed-off-by: Takagi, Isamu * Modify autoware_version not to use transient_local (workaround) (#403) * Modify autoware_version not to use transient_local Signed-off-by: Takagi, Isamu * Add todo comment Signed-off-by: Takagi, Isamu * Fix for lint Signed-off-by: Takagi, Isamu * Revert "Modify autoware_version not to use transient_local (workaround) (#403)" (#418) This reverts commit 39b7ef232a3d21c619d28935fa122abf23891961. Signed-off-by: Takagi, Isamu * Fix -Wunused-parameter (#1836) * Fix -Wunused-parameter Signed-off-by: Kenji Miyake * Fix mistake Signed-off-by: Kenji Miyake * fix spell * Fix lint issues Signed-off-by: Kenji Miyake * Ignore flake8 warnings Signed-off-by: Kenji Miyake Co-authored-by: Hiroki OTA * Add package version API (#2150) * Add package version API * Fix format * Fix message type * Change formatter to clang-format and black (#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 * Remove ament_cmake_uncrustify and ament_clang_format Signed-off-by: Kenji Miyake * Apply Black Signed-off-by: Kenji Miyake * Apply clang-format Signed-off-by: Kenji Miyake * Fix build errors Signed-off-by: Kenji Miyake * Fix for cpplint * Fix include double quotes to angle brackets Signed-off-by: Kenji Miyake * Apply clang-format Signed-off-by: Kenji Miyake * Fix build errors Signed-off-by: Kenji Miyake * Add COLCON_IGNORE (#500) Signed-off-by: Kenji Miyake * remove COLCON_IGNORE in autoware_version (#530) * Add readme of autoware_version (#612) * change type * add readme * ci(pre-commit): autofix Co-authored-by: Takagi, Isamu <43976882+isamu-takagi@users.noreply.github.com> Co-authored-by: Kenji Miyake <31987104+kenji-miyake@users.noreply.github.com> Co-authored-by: Hiroki OTA Co-authored-by: Takeshi Miura <57553950+1222-takeshi@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- system/autoware_version/CMakeLists.txt | 17 +++++++++++++++++ system/autoware_version/README.md | 9 +++++++++ system/autoware_version/package.xml | 20 ++++++++++++++++++++ system/autoware_version/script/print | 14 ++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 system/autoware_version/CMakeLists.txt create mode 100644 system/autoware_version/README.md create mode 100644 system/autoware_version/package.xml create mode 100755 system/autoware_version/script/print diff --git a/system/autoware_version/CMakeLists.txt b/system/autoware_version/CMakeLists.txt new file mode 100644 index 0000000000000..9182a3b8bda20 --- /dev/null +++ b/system/autoware_version/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.5) +project(autoware_version) + +find_package(ament_cmake_auto REQUIRED) +ament_auto_find_build_dependencies() + +install(PROGRAMS + script/print + DESTINATION lib/${PROJECT_NAME} +) + +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + ament_lint_auto_find_test_dependencies() +endif() + +ament_auto_package() diff --git a/system/autoware_version/README.md b/system/autoware_version/README.md new file mode 100644 index 0000000000000..82e6760f64c14 --- /dev/null +++ b/system/autoware_version/README.md @@ -0,0 +1,9 @@ +# autoware_version + +This package provides a command line tool to know the architecture version. This feature is temporary and will be removed when the interface is unified in the future. + +## How to use + +```sh +ros2 run autoware_version print arch {full,type,version} +``` diff --git a/system/autoware_version/package.xml b/system/autoware_version/package.xml new file mode 100644 index 0000000000000..f0ed975d24f56 --- /dev/null +++ b/system/autoware_version/package.xml @@ -0,0 +1,20 @@ + + + + + autoware_version + 0.0.0 + The autoware_version package + Takagi, Isamu + Apache License 2.0 + + ament_cmake_auto + + ament_lint_auto + autoware_lint_common + + + ament_cmake + + + diff --git a/system/autoware_version/script/print b/system/autoware_version/script/print new file mode 100755 index 0000000000000..7b796ab791b9b --- /dev/null +++ b/system/autoware_version/script/print @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +# TODO(Takagi, Isamu): this is a temporary script and may change in the future +import argparse + +parser = argparse.ArgumentParser() +parser.add_argument("target", choices=["arch"]) +parser.add_argument("format", choices=["full", "type", "version"], default="full", nargs="?") +args = parser.parse_args() +data = {"arch": {"type": "universe", "version": "1.0.0"}} + +if args.format == "full": + print("{type} {version}".format(**data[args.target])) +else: + print(data[args.target][args.format])