From b1c815073c92a1dc8e8692cb0d2514b14f92ae8d Mon Sep 17 00:00:00 2001 From: Akihito Ohsato Date: Tue, 28 Nov 2023 11:39:04 +0900 Subject: [PATCH] fix: pre-commit and spell checking (#34) --- .ansible-galaxy-requirements.yaml | 3 + .cspell.json | 157 ++++++++++++++++++++++ .github/workflows/pre-commit-ansible.yaml | 4 + README.md | 14 +- ansible/roles/ros2/README.md | 2 +- ansible/roles/ros2/tasks/main.yaml | 22 +-- build.sh | 2 +- 7 files changed, 184 insertions(+), 20 deletions(-) create mode 100644 .ansible-galaxy-requirements.yaml create mode 100644 .cspell.json diff --git a/.ansible-galaxy-requirements.yaml b/.ansible-galaxy-requirements.yaml new file mode 100644 index 0000000..73966e9 --- /dev/null +++ b/.ansible-galaxy-requirements.yaml @@ -0,0 +1,3 @@ +collections: + - name: ansible.posix + - name: community.general diff --git a/.cspell.json b/.cspell.json new file mode 100644 index 0000000..029bb7c --- /dev/null +++ b/.cspell.json @@ -0,0 +1,157 @@ +{ + "version": "0.2", + "language": "en", + "allowCompoundWords": false, + "ignorePaths": [ + "**/*.caffemodel", + "**/*.cpr", + "**/*.cspell.json", + "**/*.css", + "**/*.cu", + "**/*.dae", + "**/*.html", + "**/*.m4a", + "**/*.mp3", + "**/*.onnx", + "**/*.osm", + "**/*.pcd", + "**/*.pt", + "**/*.stl", + "**/*.wav", + "**/*.zip", + "**/*.zst", + "**/.git/**", + "**/.gitignore", + "**/.idea/**", + "**/.mypy_cache/**", + "**/.vscode/**", + "**/__pycache__/**", + "**/build/**", + "**/CPPLINT.cfg", + "**/dist/**", + "**/external/**", + "**/install/**", + "**/log/**", + "**/package-lock.json", + "**/public/**", + "**/reports*/**" + ], + "ignoreRegExpList": [ + "\\[.*/.*\\]\\(https://github.com", + "github.com[/:][\\w._\\-]+(/[\\w._\\-]+)?" + ], + "overrides": [ + { + "filename": "**/*.md", + "ignoreRegExpList": [ + "\\(Contribution by .+?\\)", + "\\]\\(#.+?\\)", + "^\\| GPU Name.+$", + "^gdown .+$", + "uses: .+/.+@.+" + ] + }, + { + "filename": "**/*.py", + "ignoreRegExpList": ["author(_email)?=.*$", "maintainer(_email)?=.*$"] + }, + { + "filename": "**/*.rst", + "ignoreRegExpList": [ + "^.*Co-authored-by:.+$", + "^.*Contributors:.+$", + "^.*Merge branch.+$", + "^.*Merge pull request .*$" + ] + }, + { + "filename": "**/*.toml", + "ignoreRegExpList": ["authors = .*?$", "maintainers = .*?$"] + }, + { + "filename": "**/*.txt", + "ignoreRegExpList": ["download\\(.+\\)"] + }, + { + "filename": "**/*.xosc", + "ignoreRegExpList": ["author=\".*?\""] + }, + { + "filename": "**/*.yaml", + "ignoreRegExpList": ["author: .+$", "git_email: .+$", "git_user: .+$", "uses: .+$"] + }, + { + "filename": "**/package.json", + "ignoreRegExpList": ["\"author\": .*"] + }, + { + "filename": "**/package.xml", + "ignoreRegExpList": ["", ""] + }, + { + "filename": "**/sync-files.yaml", + "ignoreRegExpList": ["dest: .*", "repository: .*", "source: .*"] + }, + { + "filename": "**/{*.cpp,*.hpp,*.py,*.sh,*.xml,*.yaml,CMakeLists.txt}", + "ignoreRegExpList": ["Copyright (\\(c\\))?.+$", "FIXME( )?\\(.+?\\)", "TODO( )?\\(.+?\\)"] + }, + { + "filename": "**/{*.cpp,*.hpp}", + "ignoreRegExpList": ["@author .*$", "\\author .*$", "Author(s)?( )?: .*$"] + }, + { + "filename": "**/{*.drawio,*.svg}", + "ignoreRegExpList": [ + ".*?\\.\\.\\.", + "^.*?\\.\\.\\.()?$", + "data:image/png,.*;", + "etag="[a-zA-Z0-9 +-/_]+"", + "filter=\"[a-zA-Z0-9 +-/_#()]+\"", + "id=\"[a-zA-Z0-9 +-/_]+\"", + "id="[a-zA-Z0-9 +-/_]+"", + "name="[^>]+" + ] + }, + { + "filename": "**/{*.js,*.ts}", + "ignoreRegExpList": ["owner: .*$", "repo:: .*$"] + } + ], + "flagWords": [], + "words": [ + "ADLINK", + "apriltags", + "arcyhive", + "backrefs", + "connextdds", + "DBUILD", + "ddirectory", + "debhelper", + "debmake", + "devscripts", + "DRANGE", + "drirections", + "gmsl", + "GMSL", + "imgproc", + "ipfrag", + "kitware", + "libasio", + "libbullet", + "libcunit", + "libflann", + "libpython", + "libtinyxml", + "libyaml", + "linuxptp", + "pyside", + "rmem", + "rosinstall", + "ruamel", + "soruce", + "TIERIV", + "txqueue", + "txqueuelen" + ] +} diff --git a/.github/workflows/pre-commit-ansible.yaml b/.github/workflows/pre-commit-ansible.yaml index db34b0c..3d62c9a 100644 --- a/.github/workflows/pre-commit-ansible.yaml +++ b/.github/workflows/pre-commit-ansible.yaml @@ -10,6 +10,10 @@ jobs: - name: Check out repository uses: actions/checkout@v4 + - name: Install Ansible Galaxy depends for ansible-lint + run: | + ansible-galaxy collection install -f -r .ansible-galaxy-requirements.yaml + - name: Run pre-commit uses: autowarefoundation/autoware-github-actions/pre-commit@v1 with: diff --git a/README.md b/README.md index a49690b..a8196b6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # edge-auto-jetson -This repository provides a sample ROS2 environment working on a Jetson-based ECU and GMSL2-compatible cameras. +This repository provides a sample ROS 2 environment working on a Jetson-based ECU and GMSL2-compatible cameras. As a sample application, the following images show object detection results using the contents of this repository. Various perception applications will be added in the future and you can develop them in this provided environment. @@ -9,11 +9,11 @@ the future and you can develop them in this provided environment. ![object detection example](docs/sample.png "edge-auto-jetson object detection example") -# Prerequisites +## Prerequisites ### System Overview -This repository is based on a natively built ROS2 environment. The system overview is shown below. +This repository is based on a natively built ROS 2 environment. The system overview is shown below. ![system overview](docs/overview.drawio.svg "edge-auto-jetson overview") @@ -22,7 +22,7 @@ This repository is based on a natively built ROS2 environment. The system overvi - Camera: v4l2 compatible cameras, including [TIER IV Automotive HDR Camera C1](https://sensor.tier4.jp/automotive-hdr-camera) - ECU: Jetson AGX Xavier based ECU, including [RQX-58G](https://www.adlinktech.com/Products/ROS2_Solution/ROS2_Controller/RQX-580_58G) from ADLINK Technology Inc. and [Developer Kit](https://www.nvidia.com/ja-jp/autonomous-machines/embedded-systems/jetson-agx-xavier) from NVIDIA Corp. - NVIDIA L4T: R32.6.1 (including Ubuntu 18.04) -- ROS: ROS2 Humble (native build) +- ROS: ROS 2 Humble (native build) ## Getting Started @@ -41,13 +41,13 @@ Please see [Tutorials](https://github.com/tier4/edge-auto/tree/main/docs/tutoria - [tier4/edge_auto_individual_params](https://github.com/tier4/edge_auto_individual_params) - Repository for managing system parameters including camera parameters, driver parameters, etc. - [tier4/nebula](https://github.com/tier4/nebula) - - ROS2 package for unified ethernet-based LiDAR driver. + - ROS 2 package for unified ethernet-based LiDAR driver. - [tier4/tier4_automotive_hdr_camera](https://github.com/tier4/tier4_automotive_hdr_camera) - Kernel driver for using TIER IV cameras with Video4Linux2 interface. - [tier4/ros2_v4l2_camera](https://github.com/tier4/ros2_v4l2_camera) - - ROS2 package for camera driver using Video4Linux2. + - ROS 2 package for camera driver using Video4Linux2. - [tier4/sensor_trigger](https://github.com/tier4/sensor_trigger) - - ROS2 package for generating sensor trigger signals. + - ROS 2 package for generating sensor trigger signals. - [tier4/calibration_tools](https://github.com/tier4/CalibrationTools) - Repository for calibration tools to estimate parameters on autonomous driving systems. - [autowarefoundation/autoware.universe](https://github.com/autowarefoundation/autoware.universe) diff --git a/ansible/roles/ros2/README.md b/ansible/roles/ros2/README.md index c5435eb..51f2fb5 100644 --- a/ansible/roles/ros2/README.md +++ b/ansible/roles/ros2/README.md @@ -1,4 +1,4 @@ -# ROS2 +# ROS 2 This role installs [ROS 2](https://docs.ros.org) under `/opt/ros`. Because apt binaries for the latest ROS 2 distribution are not available on some NVIDIA L4T environments, such as L4T R32.6.1 (based on Ubuntu18.04), this role installs dependencies, clones ROS 2 source codes, and builds them. diff --git a/ansible/roles/ros2/tasks/main.yaml b/ansible/roles/ros2/tasks/main.yaml index bcf68f2..9672e3c 100644 --- a/ansible/roles/ros2/tasks/main.yaml +++ b/ansible/roles/ros2/tasks/main.yaml @@ -17,7 +17,7 @@ - apt-transport-https install_recommends: false update_cache: true - - name: Add ROS2 source list + - name: Add ROS 2 source list shell: echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null - name: Download gpg key ansible.builtin.uri: @@ -54,7 +54,7 @@ - name: add CUDA into PATH set_fact: environment: - PATH: "/usr/local/cuda/bin:{{ ansible_env.PATH }}" + PATH: /usr/local/cuda/bin:{{ ansible_env.PATH }} - name: Python parts ansible.builtin.pip: @@ -98,7 +98,7 @@ ansible.builtin.unarchive: src: https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.gz dest: "{{ source_build_dir }}" - remote_src: yes + remote_src: true - name: "{{ block_name }}: Build boost" shell: ./bootstrap.sh --prefix=/usr/local --with-python=python3 && ./b2 install -j7 args: @@ -119,7 +119,7 @@ ansible.builtin.unarchive: src: https://github.com/PointCloudLibrary/pcl/releases/download/pcl-1.12.1/source.tar.gz dest: "{{ source_build_dir }}" - remote_src: yes + remote_src: true - set_fact: pcl_build_dir: "{{ source_build_dir }}/pcl/build" - name: "{{ block_name }}: Create build directory" @@ -131,7 +131,7 @@ args: chdir: "{{ pcl_build_dir }}" environment: - PATH: "/usr/local/cuda/bin:{{ ansible_env.PATH }}" + PATH: /usr/local/cuda/bin:{{ ansible_env.PATH }} - name: "{{ block_name }}: build" shell: make -j7 install args: @@ -152,7 +152,7 @@ ansible.builtin.unarchive: src: https://github.com/fmtlib/fmt/archive/refs/tags/8.1.1.tar.gz dest: "{{ source_build_dir }}" - remote_src: yes + remote_src: true - set_fact: fmt_build_dir: "{{ source_build_dir }}/fmt-8.1.1/build" - name: "{{ block_name }}: Create build directory" @@ -268,7 +268,7 @@ # Follow drirections here: https://apt.kitware.com/ - name: "{{ block_name }}: update repository info" ansible.builtin.apt_repository: - repo: "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ {{ ansible_distribution_release }} main" + repo: deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ {{ ansible_distribution_release }} main filename: kitware - name: "{{ block_name }}: apt update" ansible.builtin.apt: @@ -325,7 +325,7 @@ - name: Build ROS block: - set_fact: - ros_base_dir: "/opt/ros/{{ ros_distro }}" + ros_base_dir: /opt/ros/{{ ros_distro }} - set_fact: ros_src_dir: "{{ ros_base_dir }}/src" - name: "{{ block_name }}: Create base directory" @@ -339,14 +339,14 @@ state: directory become: true - name: "{{ block_name }}: generate repository list using rosinstall_generator" - shell: "rosinstall_generator --deps --rosdistro {{ ros_distro }} ros_base launch_xml launch_yaml launch_testing launch_testing_ament_cmake demo_nodes_cpp demo_nodes_py example_interfaces camera_calibration_parsers camera_info_manager cv_bridge vision_opencv vision_msgs image_geometry image_pipeline image_transport compressed_image_transport compressed_depth_image_transport pcl_msgs perception_pcl --exclude rmw_connextdds > /tmp/ros2.{{ ros_distro }}.ros_base.rosinstall" + shell: rosinstall_generator --deps --rosdistro {{ ros_distro }} ros_base launch_xml launch_yaml launch_testing launch_testing_ament_cmake demo_nodes_cpp demo_nodes_py example_interfaces camera_calibration_parsers camera_info_manager cv_bridge vision_opencv vision_msgs image_geometry image_pipeline image_transport compressed_image_transport compressed_depth_image_transport pcl_msgs perception_pcl --exclude rmw_connextdds > /tmp/ros2.{{ ros_distro }}.ros_base.rosinstall - name: "{{ block_name }}: copy repository list to target ddirectory" ansible.builtin.copy: - src: "/tmp/ros2.{{ ros_distro }}.ros_base.rosinstall" + src: /tmp/ros2.{{ ros_distro }}.ros_base.rosinstall dest: "{{ ros_base_dir }}/ros2.{{ ros_distro }}.ros_base.rosinstall" become: true - name: "{{ block_name }}: clone all repositories via vcs" - shell: "vcs import src < ros2.{{ ros_distro }}.ros_base.rosinstall" + shell: vcs import src < ros2.{{ ros_distro }}.ros_base.rosinstall args: chdir: "{{ ros_base_dir }}" become: true diff --git a/build.sh b/build.sh index d1222ab..5a34676 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,5 @@ #!/bin/bash colcon build \ --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release \ - -DPython3_EXECUTABLE=$(which python3.6) -DCMAKE_CUDA_STANDARD=14 \ + -DPython3_EXECUTABLE="$(which python3.6)" -DCMAKE_CUDA_STANDARD=14 \ --packages-up-to edge_auto_jetson_launch