diff --git a/.clang-format b/.clang-format index b41fae91..cd54eb45 100644 --- a/.clang-format +++ b/.clang-format @@ -1,3 +1,7 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + # Modified from https://github.com/ament/ament_lint/blob/master/ament_clang_format/ament_clang_format/configuration/.clang-format Language: Cpp BasedOnStyle: Google diff --git a/.github/ISSUE_TEMPLATE/bug.yaml b/.github/ISSUE_TEMPLATE/bug.yaml index 12a85799..5c74f7c5 100644 --- a/.github/ISSUE_TEMPLATE/bug.yaml +++ b/.github/ISSUE_TEMPLATE/bug.yaml @@ -1,3 +1,7 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + name: Bug description: Report a bug body: diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 48765c24..deccbf33 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,3 +1,7 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + blank_issues_enabled: false contact_links: - name: Question diff --git a/.github/ISSUE_TEMPLATE/task.yaml b/.github/ISSUE_TEMPLATE/task.yaml index cd8322f5..58307325 100644 --- a/.github/ISSUE_TEMPLATE/task.yaml +++ b/.github/ISSUE_TEMPLATE/task.yaml @@ -1,3 +1,7 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + name: Task description: Plan a task body: diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 00000000..8e2d7193 --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,15 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#scheduleinterval + schedule: + interval: monthly + open-pull-requests-limit: 1 + labels: + - tag:bot + - type:github-actions diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 7aedefd0..4c4081a6 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,50 +1,11 @@ ## Description - - -## Related links - - - -## Tests performed - - +## How was this PR tested? ## Notes for reviewers - - -## Interface changes - - +None. ## Effects on system behavior - - -## Pre-review checklist for the PR author - -The PR author **must** check the checkboxes below when creating the PR. - -- [ ] I've confirmed the [contribution guidelines]. -- [ ] The PR follows the [pull request guidelines]. - -## In-review checklist for the PR reviewers - -The PR reviewers **must** check the checkboxes below before approval. - -- [ ] The PR follows the [pull request guidelines]. -- [ ] The PR has been properly tested. -- [ ] The PR has been reviewed by the code owners. - -## Post-review checklist for the PR author - -The PR author **must** check the checkboxes below before merging. - -- [ ] There are no open discussions or they are tracked via tickets. -- [ ] The PR is ready for merge. - -After all checkboxes are checked, anyone who has write access can merge the PR. - -[contribution guidelines]: https://autowarefoundation.github.io/autoware-documentation/main/contributing/ -[pull request guidelines]: https://autowarefoundation.github.io/autoware-documentation/main/contributing/pull-request-guidelines/ +None. diff --git a/.github/stale.yml b/.github/stale.yml index bc99e438..ffce036c 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -1,3 +1,7 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + # Modified from https://github.com/probot/stale#usage # Number of days of inactivity before an Issue or Pull Request with the stale label is closed diff --git a/.github/sync-files.yaml b/.github/sync-files.yaml index 5b60a371..94e00009 100644 --- a/.github/sync-files.yaml +++ b/.github/sync-files.yaml @@ -1,4 +1,5 @@ -- repository: autowarefoundation/autoware +- repository: autowarefoundation/sync-file-templates + source-dir: sources files: - source: CODE_OF_CONDUCT.md - source: CONTRIBUTING.md @@ -7,12 +8,11 @@ - source: .github/ISSUE_TEMPLATE/bug.yaml - source: .github/ISSUE_TEMPLATE/config.yml - source: .github/ISSUE_TEMPLATE/task.yaml - - source: .github/PULL_REQUEST_TEMPLATE.md - - source: .github/PULL_REQUEST_TEMPLATE/small-change.md - - source: .github/PULL_REQUEST_TEMPLATE/standard-change.md + - source: .github/pull_request_template.md - source: .github/dependabot.yaml - source: .github/stale.yml - source: .github/workflows/cancel-previous-workflows.yaml + - source: .github/workflows/comment-on-pr.yaml - source: .github/workflows/github-release.yaml - source: .github/workflows/pre-commit.yaml - source: .github/workflows/pre-commit-optional.yaml @@ -22,65 +22,21 @@ - source: .clang-format - source: .markdown-link-check.json - source: .markdownlint.yaml + - source: .pre-commit-config.yaml - source: .pre-commit-config-optional.yaml - source: .prettierignore - source: .prettierrc.yaml - source: .yamllint.yaml - source: CPPLINT.cfg - source: setup.cfg - -- repository: autowarefoundation/autoware_common - files: - - source: .github/workflows/build-and-test.yaml - pre-commands: | - sd "container: ros:(\w+)" "container: ghcr.io/autowarefoundation/autoware-universe:\$1-latest" {source} - - sd -s 'container: ${{ matrix.container }}' 'container: ${{ matrix.container }}${{ matrix.container-suffix }}' {source} - sd -- \ - " include:" \ - " container-suffix: - - \"\" - - -cuda - include:" {source} - - source: .github/workflows/build-and-test-differential-self-hosted.yaml - pre-commands: | - sd "container: ros:(\w+)" "container: ghcr.io/autowarefoundation/autoware-universe:\$1-latest" {source} - - sd -s 'container: ${{ matrix.container }}' 'container: ${{ matrix.container }}${{ matrix.container-suffix }}' {source} - sd -- \ - " include:" \ - " container-suffix: - - \"\" - - -cuda - include:" {source} - - source: .github/workflows/build-and-test-self-hosted.yaml - pre-commands: | - sd "container: ros:(\w+)" "container: ghcr.io/autowarefoundation/autoware-universe:\$1-latest" {source} - - sd -s 'container: ${{ matrix.container }}' 'container: ${{ matrix.container }}${{ matrix.container-suffix }}' {source} - sd -- \ - " include:" \ - " container-suffix: - - \"\" - - -cuda - include:" {source} - - source: .github/workflows/check-build-depends.yaml - - source: .github/workflows/clang-tidy-pr-comments.yaml - - source: .github/workflows/clang-tidy-pr-comments-manually.yaml - - source: .github/workflows/update-codeowners-from-packages.yaml - - source: .pre-commit-config.yaml - - source: codecov.yaml - -- repository: autowarefoundation/autoware-documentation - files: - source: .github/workflows/deploy-docs.yaml - source: .github/workflows/delete-closed-pr-docs.yaml - source: mkdocs-base.yaml dest: mkdocs.yaml pre-commands: | - sd "Autoware Documentation" "Autoware Universe Documentation" {source} - sd "autoware-documentation" "autoware.universe" {source} - sd "repo_url: .*" "repo_url: https://github.com/autowarefoundation/autoware.universe" {source} + sd "Autoware Documentation" "Autoware Tools Documentation" {source} + sd "autoware-documentation" "autoware-tools-documentation" {source} + sd "repo_url: .*" "repo_url: https://github.com/autowarefoundation/autoware_tools" {source} sd "/edit/main/docs/" "/edit/main/" {source} sd "docs_dir: .*" "docs_dir: ." {source} sd "assets/(\w+)" "docs/assets/\$1" {source} diff --git a/.github/workflows/cancel-previous-workflows.yaml b/.github/workflows/cancel-previous-workflows.yaml index 91b91556..ee79ce0e 100644 --- a/.github/workflows/cancel-previous-workflows.yaml +++ b/.github/workflows/cancel-previous-workflows.yaml @@ -1,3 +1,7 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + name: cancel-previous-workflows on: @@ -8,7 +12,7 @@ jobs: runs-on: ubuntu-22.04 steps: - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.12.0 + uses: styfle/cancel-workflow-action@0.12.1 with: workflow_id: all all_but_latest: true diff --git a/.github/workflows/comment-on-pr.yaml b/.github/workflows/comment-on-pr.yaml new file mode 100644 index 00000000..0f2ecf51 --- /dev/null +++ b/.github/workflows/comment-on-pr.yaml @@ -0,0 +1,29 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + +name: comment-on-pr +on: + pull_request_target: + +jobs: + comment-on-pr: + runs-on: ubuntu-22.04 + permissions: + pull-requests: write + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Initial PR comment + uses: marocchino/sticky-pull-request-comment@v2 + with: + message: | + Thank you for contributing to the Autoware project! + + 🚧 If your pull request is in progress, [switch it to draft mode](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request#converting-a-pull-request-to-a-draft). + + Please ensure: + - You've checked our [contribution guidelines](https://autowarefoundation.github.io/autoware-documentation/main/contributing/). + - Your PR follows our [pull request guidelines](https://autowarefoundation.github.io/autoware-documentation/main/contributing/pull-request-guidelines/). + - All required CI checks pass before [marking the PR ready for review](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request#marking-a-pull-request-as-ready-for-review). diff --git a/.github/workflows/delete-closed-pr-docs.yaml b/.github/workflows/delete-closed-pr-docs.yaml index 192e138a..b8ff4f6d 100644 --- a/.github/workflows/delete-closed-pr-docs.yaml +++ b/.github/workflows/delete-closed-pr-docs.yaml @@ -1,3 +1,7 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + name: delete-closed-pr-docs on: diff --git a/.github/workflows/deploy-docs.yaml b/.github/workflows/deploy-docs.yaml index 771b4bd3..47009a25 100644 --- a/.github/workflows/deploy-docs.yaml +++ b/.github/workflows/deploy-docs.yaml @@ -1,3 +1,7 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + name: deploy-docs on: @@ -22,7 +26,7 @@ jobs: prevent-no-label-execution: uses: autowarefoundation/autoware-github-actions/.github/workflows/prevent-no-label-execution.yaml@v1 with: - label: tag:deploy-docs + label: run:deploy-docs deploy-docs: needs: prevent-no-label-execution diff --git a/.github/workflows/github-release.yaml b/.github/workflows/github-release.yaml index 4b1d7f47..bbe2ac51 100644 --- a/.github/workflows/github-release.yaml +++ b/.github/workflows/github-release.yaml @@ -1,3 +1,7 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + name: github-release on: diff --git a/.github/workflows/pre-commit-optional.yaml b/.github/workflows/pre-commit-optional.yaml index 12f536c5..3d086702 100644 --- a/.github/workflows/pre-commit-optional.yaml +++ b/.github/workflows/pre-commit-optional.yaml @@ -1,3 +1,7 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + name: pre-commit-optional on: diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index 13d069d9..15c8e86c 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -1,3 +1,7 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + name: pre-commit on: @@ -10,7 +14,7 @@ jobs: steps: - name: Generate token id: generate-token - uses: tibdex/github-app-token@v1 + uses: tibdex/github-app-token@v2 with: app_id: ${{ secrets.APP_ID }} private_key: ${{ secrets.PRIVATE_KEY }} diff --git a/.github/workflows/semantic-pull-request.yaml b/.github/workflows/semantic-pull-request.yaml index 71224c22..b56040b0 100644 --- a/.github/workflows/semantic-pull-request.yaml +++ b/.github/workflows/semantic-pull-request.yaml @@ -1,3 +1,7 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + name: semantic-pull-request on: diff --git a/.github/workflows/spell-check-differential.yaml b/.github/workflows/spell-check-differential.yaml new file mode 100644 index 00000000..e3af4327 --- /dev/null +++ b/.github/workflows/spell-check-differential.yaml @@ -0,0 +1,23 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + +name: spell-check-differential + +on: + pull_request: + +jobs: + spell-check-differential: + runs-on: ubuntu-22.04 + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Run spell-check + uses: autowarefoundation/autoware-github-actions/spell-check@v1 + with: + cspell-json-url: https://raw.githubusercontent.com/autowarefoundation/autoware-spell-check-dict/main/.cspell.json + dict-packages: | + https://github.com/autowarefoundation/autoware-spell-check-dict + https://github.com/tier4/cspell-dicts diff --git a/.github/workflows/spell-check-partial.yaml b/.github/workflows/spell-check-partial.yaml deleted file mode 100644 index b39c7241..00000000 --- a/.github/workflows/spell-check-partial.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: spell-check-partial - -on: - pull_request: - -jobs: - spell-check-partial: - runs-on: ubuntu-22.04 - steps: - - name: Check out repository - uses: actions/checkout@v3 - - - name: Run spell-check - uses: autowarefoundation/autoware-github-actions/spell-check@v1 - with: - cspell-json-url: https://raw.githubusercontent.com/autowarefoundation/autoware-spell-check-dict/main/.cspell.json - local-cspell-json: .cspell-partial.json - incremental-files-only: false diff --git a/.github/workflows/sync-files.yaml b/.github/workflows/sync-files.yaml index c6926fb7..9224c150 100644 --- a/.github/workflows/sync-files.yaml +++ b/.github/workflows/sync-files.yaml @@ -1,3 +1,7 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + name: sync-files on: @@ -18,7 +22,7 @@ jobs: steps: - name: Generate token id: generate-token - uses: tibdex/github-app-token@v1 + uses: tibdex/github-app-token@v2 with: app_id: ${{ secrets.APP_ID }} private_key: ${{ secrets.PRIVATE_KEY }} diff --git a/.github/workflows/update-codeowners-from-packages.yaml b/.github/workflows/update-codeowners-from-packages.yaml index e3b459a4..760a647f 100644 --- a/.github/workflows/update-codeowners-from-packages.yaml +++ b/.github/workflows/update-codeowners-from-packages.yaml @@ -18,7 +18,7 @@ jobs: steps: - name: Generate token id: generate-token - uses: tibdex/github-app-token@v1 + uses: tibdex/github-app-token@v2 with: app_id: ${{ secrets.APP_ID }} private_key: ${{ secrets.PRIVATE_KEY }} diff --git a/.gitignore b/.gitignore index 34187790..92424f92 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ # Visual Studio Code .vscode/ *.code-workspace + +/node_modules/ diff --git a/.markdownlint.yaml b/.markdownlint.yaml index babaaa1f..584154b2 100644 --- a/.markdownlint.yaml +++ b/.markdownlint.yaml @@ -1,3 +1,7 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + # See https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md for all rules. default: true MD013: false @@ -7,5 +11,6 @@ MD029: style: ordered MD033: false MD041: false +MD045: false MD046: false MD049: false diff --git a/.pre-commit-config-optional.yaml b/.pre-commit-config-optional.yaml index 3b43f9ae..56000d93 100644 --- a/.pre-commit-config-optional.yaml +++ b/.pre-commit-config-optional.yaml @@ -1,6 +1,10 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + repos: - repo: https://github.com/tcort/markdown-link-check - rev: v3.11.2 + rev: v3.13.6 hooks: - id: markdown-link-check args: [--quiet, --config=.markdown-link-check.json] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1e61f5e7..48a97c13 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,9 +1,17 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + +# https://pre-commit.ci/#configuration ci: autofix_commit_msg: "style(pre-commit): autofix" + # we already have our own daily update mechanism, we set this to quarterly + autoupdate_schedule: quarterly + autoupdate_commit_msg: "ci(pre-commit): quarterly autoupdate" repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v5.0.0 hooks: - id: check-json - id: check-merge-conflict @@ -18,23 +26,23 @@ repos: args: [--markdown-linebreak-ext=md] - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.33.0 + rev: v0.43.0 hooks: - id: markdownlint args: [-c, .markdownlint.yaml, --fix] - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.6 + rev: v4.0.0-alpha.8 hooks: - id: prettier - repo: https://github.com/adrienverge/yamllint - rev: v1.30.0 + rev: v1.35.1 hooks: - id: yamllint - repo: https://github.com/tier4/pre-commit-hooks-ros - rev: v0.9.0 + rev: v0.10.0 hooks: - id: flake8-ros - id: prettier-xacro @@ -44,42 +52,42 @@ repos: - id: sort-package-xml - repo: https://github.com/shellcheck-py/shellcheck-py - rev: v0.9.0.2 + rev: v0.10.0.1 hooks: - id: shellcheck - repo: https://github.com/scop/pre-commit-shfmt - rev: v3.6.0-2 + rev: v3.10.0-2 hooks: - id: shfmt args: [-w, -s, -i=4] - repo: https://github.com/pycqa/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 24.10.0 hooks: - id: black args: [--line-length=100] - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v16.0.0 + rev: v19.1.5 hooks: - id: clang-format types_or: [c++, c, cuda] - repo: https://github.com/cpplint/cpplint - rev: 1.6.1 + rev: 2.0.0 hooks: - id: cpplint args: [--quiet] exclude: .cu - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.23.2 + rev: 0.30.0 hooks: - id: check-metaschema files: ^.+/schema/.*schema\.json$ @@ -93,3 +101,9 @@ repos: language: node files: .svg$ additional_dependencies: [prettier@2.7.1, "@prettier/plugin-xml@2.2.0"] + + - repo: https://github.com/AleksaC/hadolint-py + rev: v2.12.1b3 + hooks: + - id: hadolint + exclude: .svg$ diff --git a/.prettierignore b/.prettierignore index a3c34d00..3e96aace 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,2 +1,6 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + *.param.yaml *.rviz diff --git a/.prettierrc.yaml b/.prettierrc.yaml index e29bf327..fe476936 100644 --- a/.prettierrc.yaml +++ b/.prettierrc.yaml @@ -1,3 +1,7 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + printWidth: 100 tabWidth: 2 overrides: diff --git a/.yamllint.yaml b/.yamllint.yaml index 2c7bd088..e0be62db 100644 --- a/.yamllint.yaml +++ b/.yamllint.yaml @@ -1,3 +1,7 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + extends: default ignore: | diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..8dbcfb85 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,132 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +- The use of sexualized language or imagery, and sexual attention or advances of + any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, + without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][mozilla coc]. + +For answers to common questions about this code of conduct, see the FAQ at +[https://www.contributor-covenant.org/faq][faq]. Translations are available at +[https://www.contributor-covenant.org/translations][translations]. + +[homepage]: https://www.contributor-covenant.org +[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html +[mozilla coc]: https://github.com/mozilla/diversity +[faq]: https://www.contributor-covenant.org/faq +[translations]: https://www.contributor-covenant.org/translations diff --git a/CPPLINT.cfg b/CPPLINT.cfg index ba6bdf08..159042db 100644 --- a/CPPLINT.cfg +++ b/CPPLINT.cfg @@ -1,12 +1,18 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + # Modified from https://github.com/ament/ament_lint/blob/ebd524bb9973d5ec1dc48a670ce54f958a5a0243/ament_cpplint/ament_cpplint/main.py#L64-L120 set noparent linelength=100 includeorder=standardcfirst filter=-build/c++11 # we do allow C++11 +filter=-build/c++17 # we allow filter=-build/namespaces_literals # we allow using namespace for literals filter=-runtime/references # we consider passing non-const references to be ok filter=-whitespace/braces # we wrap open curly braces for namespaces, classes and functions filter=-whitespace/indent # we don't indent keywords like public, protected and private with one space +filter=-whitespace/newline # we allow the developer to decide about newline at the end of file (it's clashing with clang-format) filter=-whitespace/parens # we allow closing parenthesis to be on the next line filter=-whitespace/semicolon # we allow the developer to decide about whitespace after a semicolon filter=-build/header_guard # we automatically fix the names of header guards using pre-commit diff --git a/common/autoware_debug_tools/README.md b/common/autoware_debug_tools/README.md index 23b29776..f06c3540 100644 --- a/common/autoware_debug_tools/README.md +++ b/common/autoware_debug_tools/README.md @@ -107,3 +107,15 @@ ros2 run autoware_debug_tools cpu_usage_plotter -n 20 ``` ![cpu_usage_plot_example](images/cpu_usage_plot_example.png) + +## Rosout Log Reconstructor + +This script shows the log from the `/rosout` topic on the terminal. + +### Usage + +```bash +ros2 run autoware_debug_tools rosout_log_reconstructor +``` + +![rosout_log_example](images/rosout_log_example.png) diff --git a/common/autoware_debug_tools/autoware_debug_tools/rosout_log_reconstructor.py b/common/autoware_debug_tools/autoware_debug_tools/rosout_log_reconstructor.py new file mode 100755 index 00000000..4007c669 --- /dev/null +++ b/common/autoware_debug_tools/autoware_debug_tools/rosout_log_reconstructor.py @@ -0,0 +1,89 @@ +#!/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 sys + +import rcl_interfaces +from rcl_interfaces.msg import Log +import rclpy +from rclpy.node import Node + + +def get_rosout_format(): + try: + rosout_format = os.environ["RCUTILS_CONSOLE_OUTPUT_FORMAT"] + if rosout_format != "": + return rosout_format + except KeyError: + pass + + # use default rosout format + return "[{severity} {time}] [{name}]: {message} ({function_name}():{line_number})" + + +def get_logger_level_name(level): + if level == int.from_bytes(rcl_interfaces.msg.Log.DEBUG, byteorder="big"): + return "DEBUG" + if level == int.from_bytes(rcl_interfaces.msg.Log.INFO, byteorder="big"): + return "INFO" + if level == int.from_bytes(rcl_interfaces.msg.Log.WARN, byteorder="big"): + return "WARN" + if level == int.from_bytes(rcl_interfaces.msg.Log.ERROR, byteorder="big"): + return "ERROR" + return "FATAL" + + +class RosoutLogReconstructor(Node): + def __init__(self): + super().__init__("rosout_log_reconstructor") + + self.rosout_format = get_rosout_format() + + transient_local = rclpy.qos.DurabilityPolicy.TRANSIENT_LOCAL + transient_local_profile = rclpy.qos.QoSProfile(depth=1, durability=transient_local) + self.sub_rosout = self.create_subscription( + Log, "/rosout", self.on_rosout, transient_local_profile + ) + + def on_rosout(self, msg): + severity = get_logger_level_name(msg.level) + + text = self.rosout_format.format( + time=msg.stamp, + name=msg.name, + severity=severity, + function_name=msg.function, + message=msg.msg, + file_name=msg.file, + line_number=msg.line, + ) + if severity == "WARN": + sys.stderr.write("\x1b[33m" + text + "\x1b[0m" + "\n") + elif severity == "ERROR": + sys.stderr.write("\x1b[1;31m" + text + "\x1b[0m" + "\n") + else: + print(text) + + +def main(): + rclpy.init() + node = RosoutLogReconstructor() + rclpy.spin(node) + + +if __name__ == "__main__": + main() diff --git a/common/autoware_debug_tools/autoware_debug_tools/topic_connection_checker/launch_file_analyse/launch_xml_parser.py b/common/autoware_debug_tools/autoware_debug_tools/topic_connection_checker/launch_file_analyse/launch_xml_parser.py index fd253d94..695ab85f 100644 --- a/common/autoware_debug_tools/autoware_debug_tools/topic_connection_checker/launch_file_analyse/launch_xml_parser.py +++ b/common/autoware_debug_tools/autoware_debug_tools/topic_connection_checker/launch_file_analyse/launch_xml_parser.py @@ -223,9 +223,9 @@ def process_include_tag( local_context, base_namespace, ) - temp_context[ - name - ] = value # temp_context is used to pass arguments to the included file and updated on the fly for each argument + temp_context[name] = ( + value # temp_context is used to pass arguments to the included file and updated on the fly for each argument + ) for key in argument_dict: temp_context[key] = argument_dict[key] if included_file: diff --git a/common/autoware_debug_tools/autoware_debug_tools/topic_connection_checker/launch_file_analyse/string_utils.py b/common/autoware_debug_tools/autoware_debug_tools/topic_connection_checker/launch_file_analyse/string_utils.py index 1d2b7148..ec956508 100644 --- a/common/autoware_debug_tools/autoware_debug_tools/topic_connection_checker/launch_file_analyse/string_utils.py +++ b/common/autoware_debug_tools/autoware_debug_tools/topic_connection_checker/launch_file_analyse/string_utils.py @@ -22,9 +22,9 @@ def find_package(package_name) -> str: BASE_PROJECT_MAPPING[package_name] = get_package_share_directory(package_name) else: - BASE_PROJECT_MAPPING[ - package_name - ] = f"/opt/ros/humble/share/{package_name}" # use this for temporal solution; + BASE_PROJECT_MAPPING[package_name] = ( + f"/opt/ros/humble/share/{package_name}" # use this for temporal solution; + ) return BASE_PROJECT_MAPPING[package_name] diff --git a/common/autoware_debug_tools/images/rosout_log_example.png b/common/autoware_debug_tools/images/rosout_log_example.png new file mode 100644 index 00000000..f367b690 Binary files /dev/null and b/common/autoware_debug_tools/images/rosout_log_example.png differ diff --git a/common/autoware_debug_tools/setup.py b/common/autoware_debug_tools/setup.py index b61d4a8e..bd2fb9d0 100644 --- a/common/autoware_debug_tools/setup.py +++ b/common/autoware_debug_tools/setup.py @@ -27,6 +27,7 @@ "memory_usage_plotter = autoware_debug_tools.system_performance_plotter.memory_usage_plotter:main", "topic_connection_checker = autoware_debug_tools.topic_connection_checker.topic_connection_checker_node:main", "topic_localizer = autoware_debug_tools.topic_connection_checker.localize_topic:main", + "rosout_log_reconstructor = autoware_debug_tools.rosout_log_reconstructor:main", ], }, ) diff --git a/common/rtc_manager_rviz_plugin/src/rtc_manager_panel.cpp b/common/rtc_manager_rviz_plugin/src/rtc_manager_panel.cpp index 749819c0..a217ccef 100644 --- a/common/rtc_manager_rviz_plugin/src/rtc_manager_panel.cpp +++ b/common/rtc_manager_rviz_plugin/src/rtc_manager_panel.cpp @@ -23,6 +23,10 @@ #include +#include +#include +#include + namespace rviz_plugins { inline std::string Bool2String(const bool var) diff --git a/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_panel.cpp b/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_panel.cpp index 86374ab4..e2232341 100644 --- a/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_panel.cpp +++ b/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_panel.cpp @@ -18,6 +18,9 @@ #include +#include +#include + namespace rviz_plugins { AutowareAutomaticGoalPanel::AutowareAutomaticGoalPanel(QWidget * parent) diff --git a/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_sender.cpp b/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_sender.cpp index e6036672..a35cc5fb 100644 --- a/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_sender.cpp +++ b/common/tier4_automatic_goal_rviz_plugin/src/automatic_goal_sender.cpp @@ -13,6 +13,11 @@ // limitations under the License. #include "automatic_goal_sender.hpp" +#include +#include +#include +#include + namespace automatic_goal { AutowareAutomaticGoalSender::AutowareAutomaticGoalSender() : Node("automatic_goal_sender") diff --git a/common/tier4_debug_rviz_plugin/include/tier4_debug_rviz_plugin/string_stamped.hpp b/common/tier4_debug_rviz_plugin/include/tier4_debug_rviz_plugin/string_stamped.hpp index 0960875d..b154d3eb 100644 --- a/common/tier4_debug_rviz_plugin/include/tier4_debug_rviz_plugin/string_stamped.hpp +++ b/common/tier4_debug_rviz_plugin/include/tier4_debug_rviz_plugin/string_stamped.hpp @@ -61,12 +61,12 @@ #endif -#include +#include namespace rviz_plugins { class StringStampedOverlayDisplay -: public rviz_common::RosTopicDisplay +: public rviz_common::RosTopicDisplay { Q_OBJECT @@ -84,7 +84,8 @@ private Q_SLOTS: protected: void update(float wall_dt, float ros_dt) override; - void processMessage(const tier4_debug_msgs::msg::StringStamped::ConstSharedPtr msg_ptr) override; + void processMessage( + const autoware_internal_debug_msgs::msg::StringStamped::ConstSharedPtr msg_ptr) override; jsk_rviz_plugins::OverlayObject::Ptr overlay_; rviz_common::properties::ColorProperty * property_text_color_; rviz_common::properties::IntProperty * property_left_; @@ -100,7 +101,7 @@ private Q_SLOTS: static constexpr int hand_width_ = 4; std::mutex mutex_; - tier4_debug_msgs::msg::StringStamped::ConstSharedPtr last_msg_ptr_; + autoware_internal_debug_msgs::msg::StringStamped::ConstSharedPtr last_msg_ptr_; }; } // namespace rviz_plugins diff --git a/common/tier4_debug_rviz_plugin/package.xml b/common/tier4_debug_rviz_plugin/package.xml index 45b73d5b..7e15e1a3 100644 --- a/common/tier4_debug_rviz_plugin/package.xml +++ b/common/tier4_debug_rviz_plugin/package.xml @@ -10,6 +10,7 @@ ament_cmake autoware_cmake + autoware_internal_debug_msgs libqt5-core libqt5-gui libqt5-widgets diff --git a/common/tier4_debug_rviz_plugin/plugins/plugin_description.xml b/common/tier4_debug_rviz_plugin/plugins/plugin_description.xml index e18900af..72864327 100644 --- a/common/tier4_debug_rviz_plugin/plugins/plugin_description.xml +++ b/common/tier4_debug_rviz_plugin/plugins/plugin_description.xml @@ -7,6 +7,6 @@ - Display drivable area of tier4_debug_msgs::msg::StringStamped + Display drivable area of autoware_internal_debug_msgs::msg::StringStamped diff --git a/common/tier4_debug_rviz_plugin/src/float32_multi_array_stamped_pie_chart.cpp b/common/tier4_debug_rviz_plugin/src/float32_multi_array_stamped_pie_chart.cpp index 0187cc3e..460a00a6 100644 --- a/common/tier4_debug_rviz_plugin/src/float32_multi_array_stamped_pie_chart.cpp +++ b/common/tier4_debug_rviz_plugin/src/float32_multi_array_stamped_pie_chart.cpp @@ -50,6 +50,9 @@ #include #include +#include +#include + namespace rviz_plugins { diff --git a/common/tier4_debug_rviz_plugin/src/string_stamped.cpp b/common/tier4_debug_rviz_plugin/src/string_stamped.cpp index 538dc0cb..b4e2d032 100644 --- a/common/tier4_debug_rviz_plugin/src/string_stamped.cpp +++ b/common/tier4_debug_rviz_plugin/src/string_stamped.cpp @@ -170,7 +170,7 @@ void StringStampedOverlayDisplay::update(float wall_dt, float ros_dt) } void StringStampedOverlayDisplay::processMessage( - const tier4_debug_msgs::msg::StringStamped::ConstSharedPtr msg_ptr) + const autoware_internal_debug_msgs::msg::StringStamped::ConstSharedPtr msg_ptr) { if (!isEnabled()) { return; diff --git a/common/tier4_logging_level_configure_rviz_plugin/include/tier4_logging_level_configure_rviz_plugin/logging_level_configure.hpp b/common/tier4_logging_level_configure_rviz_plugin/include/tier4_logging_level_configure_rviz_plugin/logging_level_configure.hpp index 37d70b49..044966e3 100644 --- a/common/tier4_logging_level_configure_rviz_plugin/include/tier4_logging_level_configure_rviz_plugin/logging_level_configure.hpp +++ b/common/tier4_logging_level_configure_rviz_plugin/include/tier4_logging_level_configure_rviz_plugin/logging_level_configure.hpp @@ -51,9 +51,9 @@ struct LoggerNamespaceInfo }; class LoggingLevelConfigureRvizPlugin : public rviz_common::Panel { - Q_OBJECT // This macro is needed for Qt to handle slots and signals +Q_OBJECT // This macro is needed for Qt to handle slots and signals - public : LoggingLevelConfigureRvizPlugin(QWidget * parent = nullptr); + public : LoggingLevelConfigureRvizPlugin(QWidget * parent = nullptr); void onInitialize() override; void save(rviz_common::Config config) const override; void load(const rviz_common::Config & config) override; diff --git a/common/tier4_logging_level_configure_rviz_plugin/src/logging_level_configure.cpp b/common/tier4_logging_level_configure_rviz_plugin/src/logging_level_configure.cpp index 72ecf361..5186aafb 100644 --- a/common/tier4_logging_level_configure_rviz_plugin/src/logging_level_configure.cpp +++ b/common/tier4_logging_level_configure_rviz_plugin/src/logging_level_configure.cpp @@ -21,7 +21,13 @@ #include #include +#include #include +#include +#include +#include +#include +#include namespace rviz_plugin { diff --git a/common/tier4_screen_capture_rviz_plugin/src/screen_capture_panel.cpp b/common/tier4_screen_capture_rviz_plugin/src/screen_capture_panel.cpp index e780678a..fa86fc34 100644 --- a/common/tier4_screen_capture_rviz_plugin/src/screen_capture_panel.cpp +++ b/common/tier4_screen_capture_rviz_plugin/src/screen_capture_panel.cpp @@ -17,8 +17,10 @@ #include #include +#include #include #include +#include namespace rviz_plugins { diff --git a/common/tier4_string_viewer_rviz_plugin/README.md b/common/tier4_string_viewer_rviz_plugin/README.md index fba6e508..d7c19419 100644 --- a/common/tier4_string_viewer_rviz_plugin/README.md +++ b/common/tier4_string_viewer_rviz_plugin/README.md @@ -2,7 +2,7 @@ ## Purpose -This plugin displays the ROS message whose topic type is `tier4_debug_msgs::msg::StringStamped` in rviz. +This plugin displays the ROS message whose topic type is `autoware_internal_debug_msgs::msg::StringStamped` in rviz. ## Assumptions / Known limits diff --git a/common/tier4_string_viewer_rviz_plugin/package.xml b/common/tier4_string_viewer_rviz_plugin/package.xml index 2f196167..554b74e8 100644 --- a/common/tier4_string_viewer_rviz_plugin/package.xml +++ b/common/tier4_string_viewer_rviz_plugin/package.xml @@ -10,13 +10,13 @@ ament_cmake_auto autoware_cmake + autoware_internal_debug_msgs libqt5-core libqt5-gui libqt5-widgets qtbase5-dev rclcpp rviz_common - tier4_debug_msgs ament_lint_auto autoware_lint_common diff --git a/common/tier4_string_viewer_rviz_plugin/src/string_viewer_panel.hpp b/common/tier4_string_viewer_rviz_plugin/src/string_viewer_panel.hpp index 22ce760f..d02743c1 100644 --- a/common/tier4_string_viewer_rviz_plugin/src/string_viewer_panel.hpp +++ b/common/tier4_string_viewer_rviz_plugin/src/string_viewer_panel.hpp @@ -22,12 +22,12 @@ #include #include -#include +#include namespace tier4_string_viewer_rviz_plugin { -using tier4_debug_msgs::msg::StringStamped; +using autoware_internal_debug_msgs::msg::StringStamped; class QLineEdit; diff --git a/common/tier4_target_object_type_rviz_plugin/src/target_object_type_panel.cpp b/common/tier4_target_object_type_rviz_plugin/src/target_object_type_panel.cpp index e0143079..51ba87ff 100644 --- a/common/tier4_target_object_type_rviz_plugin/src/target_object_type_panel.cpp +++ b/common/tier4_target_object_type_rviz_plugin/src/target_object_type_panel.cpp @@ -20,6 +20,9 @@ #include #include +#include +#include + TargetObjectTypePanel::TargetObjectTypePanel(QWidget * parent) : rviz_common::Panel(parent) { node_ = std::make_shared("matrix_display_node"); diff --git a/control_data_collecting_tool/README.md b/control_data_collecting_tool/README.md index 0a3c1427..16980de9 100644 --- a/control_data_collecting_tool/README.md +++ b/control_data_collecting_tool/README.md @@ -82,7 +82,7 @@ This package provides tools for automatically collecting data using pure pursuit - `/data_collecting_lookahead_marker_array` - Type: MarkerArray -6. The following actions differ depending on the selected course. If you select the trajectory from [`eight_course`, `u_shaped_return`, `straight_line_positive`, `straight_line_negative`, `reversal_loop_circle`], proceed to 6.1. If you select the trajectory from [`along_road`], please proceed to 6.2. +6. The following actions differ depending on the selected course. If you select the trajectory from [`eight_course`, `u_shaped_return`, `straight_line_positive`, `straight_line_negative`, `reversal_loop_circle`], please proceed to 6.1. If you select the trajectory from [`along_road`], please proceed to 6.2. - 6.1 If you choose the trajectory from [`eight_course`, `u_shaped_return`, `straight_line_positive`, `straight_line_negative`, `reversal_loop_circle`], select `DataCollectingAreaSelectionTool` plugin. @@ -90,7 +90,7 @@ This package provides tools for automatically collecting data using pure pursuit Highlight the data collecting area by dragging the mouse over it. - + > [!NOTE] > You cannot change the data collecting area while driving. @@ -112,7 +112,7 @@ This package provides tools for automatically collecting data using pure pursuit > You cannot change the goal pose while driving. > In cases where course generation fails, which can happen under certain conditions, please reposition the vehicle or redraw the goal pose. -7. Click the `LOCAL` button on `OperationMode` in `AutowareStatePanel`. +7. Click the `LOCAL` button in `AutowareStatePanel`. @@ -120,6 +120,14 @@ This package provides tools for automatically collecting data using pure pursuit + You can monitor the data collection status in real-time through the window that pops up when this node is launched. + (From top to bottom: the speed-acceleration phase diagram, the speed-acceleration heatmap, the speed-steering angle heatmap, the speed-steer rate heatmap, and the speed-jerk heatmap.) + + + + For the speed-acceleration heatmap, speed-steering angle heatmap, and speed-steer rate heatmap, the collection range can be specified by the masks located in the folder `config/masks/MASK_NAME` where `MASK_NAME` is a parameter specifying mask name (Please also see `config/common_param.yaml`). + The specified heatmap cells are designed to change from blue to green once a certain amount of data (`VEL_ACC_THRESHOLD`, `VEL_STEER_THRESHOLD`, `VEL_ABS_STEER_RATE_THRESHOLD` ) is collected. It is recommended to collect data until as many cells as possible turn green. + 8. If you want to stop data collecting automatic driving, run the following command ```bash @@ -137,6 +145,134 @@ This package provides tools for automatically collecting data using pure pursuit +## Specify data collection range + +You can create an original mask to specify the data collection range for the heatmap explained in step 7 of the "How to Use" section. + +1. Change the `MASK_NAME` parameter in `config/common_param.yaml` from its default value of `default` to any name you prefer. + +2. Modify parameters such as `VEL_ACC_THRESHOLD`, `VEL_STEER_THRESHOLD`, and `VEL_ABS_STEER_RATE_THRESHOLD` to determine the desired amount of data for each cell in the speed-acceleration heatmap, speed-steering angle heatmap, and speed-steer rate heatmap. + +3. In the `scripts/masks` directory, run + + ```Python3 + python3 mask_selector.py + ``` + + then, matplotlib windows for selecting the collection range of the speed-acceleration heatmap, speed-steering angle heatmap, and speed-steer rate heatmap will be displayed, one for each. + + + + In these windows, you can modify the heatmaps by clicking or dragging within them. Once you've made your changes, pressing `Ctrl+C` in the terminal will automatically save the updated maps. + + Afterward, rebuild the `control_data_collecting_tool` using the following command + + ```bash + colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-w" --symlink-install --continue-on-error --packages-up-to control_data_collecting_tool + ``` + + and relaunch the control_data_collecting_tool with + + ```bash + ros2 launch control_data_collecting_tool control_data_collecting_tool.launch.py map_path:=$HOME/autoware_map/sample-map-planning + ``` + + This will allow you to see the selected mask applied. + + + +## Trajectory generation and data collection logic + +- ### Data collection logic common to all courses + + In `control_data_collection_tool`, all courses collect velocity and acceleration data in a similar manner. + + By appropriately adjusting the `target_velocity` provided to the pure pursuit algorithm, speed and acceleration data are efficiently collected. Data collection consists of four phases: selection of target speed and acceleration, acceleration phase, constant speed phase, the deceleration phase. A general method for collecting speed and acceleration data is described below, though it does not strictly adhere to the outlined steps. + + 1. Selection of target speed and acceleration + + In the speed-acceleration heatmap, the speed and acceleration with fewer data points are set as the target speed and acceleration, which are then defined here as `target_velocity_on_section` and `target_acceleration_on_section`. + + 2. Acceleration phase + The vehicle accelerates by setting `target_velocity` as follows until its speed exceeds `target_velocity_on_section`. + + ```Python3 + # sine_curve is derived from appropriate amplitude and period, defined separately + target_velocity = current_velocity + abs(target_acceleration_on_section) / acc_kp + sine_curve + ``` + + `current_velocity` is a current velocity of vehicle and `acc_kp` accel command proportional gain in pure pursuit algorithm. `sine_curve` is a sine wave added to partially mitigate situations where the vehicle fails to achieve the target acceleration. + + 3. Constant speed phase + When the vehicle reaches `target_velocity_on_section`, `target_velocity` is defined as follows to allow the vehicle to run around the target speed for a certain period of time. + + ```Python3 + # sine_curve is derived from appropriate amplitude and period, defined separately + target_velocity = target_velocity_on_section + sine_curve + sine_curve + ``` + + 4. Deceleration phase + In the deceleration phase, similar to the acceleration phase, `target_velocity` is defined as follows to ensure the vehicle decelerates. + + ```Python3 + # sine_curve is derived from appropriate amplitude and period, defined separately + target_velocity = current_velocity - abs(target_acceleration_on_section) / acc_kp + sine_curve + ``` + + After decelerating to a sufficiently low speed, return to step i. + +- ### Trajectory generation and data collection logic specific to `reversal_loop_circle` + + In the `reversal_loop_circle` course, sections are sequentially added to the course while collecting various data on speed, acceleration, and steering angle. + +- #### Trajectory generation logic for `reversal_loop_circle` + + The `reversal_loop_circle` aims to generate a trajectory with the largest possible radius of curvature within a radius `trajectory_radius`, allowing data collection in a confined area without significantly reducing speed. + + The `reversal_loop_circle` is primarily generated by connecting the following three components, `common tangent`, `circumscribing_circle` and `boundary` as shown in the following picture. + + + + All the components listed below are available in both clockwise and counterclockwise versions. The rationale for having two versions is to ensure data collection for both right-hand drive and left-hand drive configurations. + + - `common tangent` + + The `common tangent` is generated by drawing a common tangent to two inscribed circles. In this section, a sine curve is added in the normal direction to generate a trajectory for collecting data with larger steering angles. + The amplitude of the sine curve is determined based on the desired steering angle data. + + + + + + - `circumscribing_circle` + + The `circumscribing_circle` part is created by drawing the common circumscribed circle of the circles. + This section is generated to achieve nearly straight movement within the outer circle while minimizing the increase in curvature. + + + + + + - `boundary` + + The `boundary` part is used to connect the `common tangent` and the `circumscribing_circle` sections. + + + + + +- #### Velocity and steering angle data collection logic for `reversal_loop_circle` + + Speed and steering angle data are gathered in the `common tangent` section of the trajectory. The common tangent section is particularly effective for collecting steering angle data because a trajectory with minimal data is intentionally created by adding a sine wave of suitable amplitude to the curvature. + + The following two steps are taken to obtain steering angle data. + + 1. Starting from the ego vehicle's current position, the system examines a segment of the trajectory ahead, covering a distance defined by looking_ahead_distance, to identify the point of maximum curvature. + + 2. This maximum curvature determines the steering angle the vehicle will use. The vehicle then adjusts its speed toward the speed associated with the sparsest steering angle data. + + + ## Parameter There are parameters that are common to all trajectories and parameters that are specific to each trajectory. @@ -152,14 +288,25 @@ ROS 2 parameters which are common in all trajectories (`/config/common_param.yam | `NUM_BINS_V` | `int` | Number of bins of velocity in heatmap | 10 | | `NUM_BINS_STEER` | `int` | Number of bins of steer in heatmap | 20 | | `NUM_BINS_A` | `int` | Number of bins of acceleration in heatmap | 10 | +| `NUM_BINS_ABS_STEER_RATE` | `int` | Number of bins of absolute value of steer rate in heatmap | 5 | +| `NUM_BINS_JERK` | `int` | Number of bins of jerk in heatmap | 10 | | `V_MIN` | `double` | Minimum velocity in heatmap [m/s] | 0.0 | | `V_MAX` | `double` | Maximum velocity in heatmap [m/s] | 11.5 | | `STEER_MIN` | `double` | Minimum steer in heatmap [rad] | -0.6 | | `STEER_MAX` | `double` | Maximum steer in heatmap [rad] | 0.6 | -| `A_MIN` | `double` | Minimum acceleration in heatmap [m/ss] | -1.0 | -| `A_MAX` | `double` | Maximum acceleration in heatmap [m/ss] | 1.0 | -| `max_lateral_accel` | `double` | Max lateral acceleration limit [m/ss] | 2.00 | -| `lateral_error_threshold` | `double` | Lateral error threshold where applying velocity limit [m/s] | 1.50 | +| `A_MIN` | `double` | Minimum acceleration in heatmap [m/s^2] | -1.0 | +| `A_MAX` | `double` | Maximum acceleration in heatmap [m/s^2] | 1.0 | +| `max_lateral_accel` | `double` | Max lateral acceleration limit [m/s^2] | 2.70 | +| `ABS_STEER_RATE_MIN` | `double` | Minimum absolute value of steer rate in heatmap [rad/s] | 0.0 | +| `ABS_STEER_RATE_MAX` | `double` | Maximum absolute value of steer rate in heatmap [rad/s] | 0.3 | +| `JERK_MIN` | `double` | Minimum jerk in heatmap [m/s^3] | -0.5 | +| `JERK_MAX` | `double` | Maximum jerk in heatmap [m/s^3] | 0.5 | +| `MASK_NAME` | `string` | Directory name of masks for data collection | `default` | +| `VEL_ACC_THRESHOLD` | `int` | Threshold of velocity-and-acc heatmap in data collection | 40 | +| `VEL_STEER_THRESHOLD` | `int` | Threshold of velocity-and-steer heatmap in data collection | 20 | +| `VEL_ABS_STEER_RATE_THRESHOLD` | `int` | Threshold of velocity-and-abs_steer_rate heatmap in data collection | 20 | +| `max_lateral_accel` | `double` | Max lateral acceleration limit [m/s^2] | 2.00 | +| `lateral_error_threshold` | `double` | Lateral error threshold where applying velocity limit [m] | 1.50 | | `yaw_error_threshold` | `double` | Yaw error threshold where applying velocity limit [rad] | 0.75 | | `velocity_limit_by_tracking_error` | `double` | Velocity limit applied when tracking error exceeds threshold [m/s] | 1.0 | | `mov_ave_window` | `int` | Moving average smoothing window size | 50 | @@ -171,29 +318,30 @@ ROS 2 parameters which are common in all trajectories (`/config/common_param.yam | `min_lookahead` | `double` | Pure pursuit minimum lookahead length [m] | 2.0 | | `linearized_pure_pursuit_steer_kp_param` | `double` | Linearized pure pursuit steering P gain parameter | 2.0 | | `linearized_pure_pursuit_steer_kd_param` | `double` | Linearized pure pursuit steering D gain parameter | 2.0 | -| `stop_acc` | `double` | Accel command for stopping data collecting driving [m/ss] | -2.0 | -| `stop_jerk_lim` | `double` | Jerk limit for stopping data collecting driving [m/sss] | 5.0 | -| `lon_acc_lim` | `double` | Longitudinal acceleration limit [m/ss] | 1.5 | -| `lon_jerk_lim` | `double` | Longitudinal jerk limit [m/sss] | 0.5 | +| `stop_acc` | `double` | Accel command for stopping data collecting driving [m/s^2] | -2.0 | +| `stop_jerk_lim` | `double` | Jerk limit for stopping data collecting driving [m/s^3] | 5.0 | +| `lon_acc_lim` | `double` | Longitudinal acceleration limit [m/s^2] | 1.5 | +| `lon_jerk_lim` | `double` | Longitudinal jerk limit [m/s^3] | 0.5 | | `steer_lim` | `double` | Steering angle limit [rad] | 0.6 | | `steer_rate_lim` | `double` | Steering angle rate limit [rad/s] | 0.6 | The following parameters are common to all trajectories but can be defined individually for each trajectory. (`/config/course_param/COURSE_NAME_param.yaml`): -| Name | Type | Description | Default value | -| :--------------------------------------- | :------- | :-------------------------------------------------------------------------------------------------- | :------------- | -| `COLLECTING_DATA_V_MIN` | `double` | Minimum velocity for data collection [m/s] | 0.5 | -| `COLLECTING_DATA_V_MAX` | `double` | Maximum velocity for data collection [m/s] | 8.0 | -| `COLLECTING_DATA_A_MIN` | `double` | Minimum velocity for data collection [m/ss] | 1.0 | -| `COLLECTING_DATA_A_MAX` | `double` | Maximum velocity for data collection [m/ss] | -1.0 | -| `longitudinal_velocity_noise_amp` | `double` | Target longitudinal velocity additional sine noise amplitude [m/s] | 0.01 | -| `longitudinal_velocity_noise_min_period` | `double` | Target longitudinal velocity additional sine noise minimum period [s] | 5.0 | -| `longitudinal_velocity_noise_max_period` | `double` | Target longitudinal velocity additional sine noise maximum period [s] | 20.0 | -| `acc_noise_amp` | `double` | Accel command additional sine noise amplitude [m/ss] | 0.01 | -| `acc_noise_min_period` | `double` | Accel command additional sine noise minimum period [s] | 5.0 | -| `acc_noise_max_period` | `double` | Accel command additional sine noise maximum period [s] | 20.0 | -| `steer_noise_amp` | `double` | Steer command additional sine noise amplitude [rad] | 0.01 | -| `steer_noise_max_period` | `double` | Steer command additional sine noise maximum period [s] | 5.0 | -| `steer_noise_min_period` | `double` | Steer command additional sine noise minimum period [s] | 20.0 | + +| Name | Type | Description | Default value | +| :--------------------------------------- | :------- | :-------------------------------------------------------------------- | :------------ | +| `COLLECTING_DATA_V_MIN` | `double` | Minimum velocity for data collection [m/s] | 0.5 | +| `COLLECTING_DATA_V_MAX` | `double` | Maximum velocity for data collection [m/s] | 8.0 | +| `COLLECTING_DATA_A_MIN` | `double` | Minimum velocity for data collection [m/s^2] | 1.0 | +| `COLLECTING_DATA_A_MAX` | `double` | Maximum velocity for data collection [m/s^2] | -1.0 | +| `longitudinal_velocity_noise_amp` | `double` | Target longitudinal velocity additional sine noise amplitude [m/s] | 0.01 | +| `longitudinal_velocity_noise_min_period` | `double` | Target longitudinal velocity additional sine noise minimum period [s] | 5.0 | +| `longitudinal_velocity_noise_max_period` | `double` | Target longitudinal velocity additional sine noise maximum period [s] | 20.0 | +| `acc_noise_amp` | `double` | Accel command additional sine noise amplitude [m/ss] | 0.01 | +| `acc_noise_min_period` | `double` | Accel command additional sine noise minimum period [s] | 5.0 | +| `acc_noise_max_period` | `double` | Accel command additional sine noise maximum period [s] | 20.0 | +| `steer_noise_amp` | `double` | Steer command additional sine noise amplitude [rad] | 0.01 | +| `steer_noise_max_period` | `double` | Steer command additional sine noise maximum period [s] | 5.0 | +| `steer_noise_min_period` | `double` | Steer command additional sine noise minimum period [s] | 20.0 | ### Course-Specific Parameters @@ -224,7 +372,7 @@ Each trajectory has specific ROS 2 parameters. | :-------------------- | :------- | :---------------------------------------------------------------------------------- | :------------ | | `trajectory_radius` | `double` | Radius of the circle where trajectories are generated [m] | 35.0 | | `enclosing_radius` | `double` | Radius of the circle enclosing the generated trajectories [m] | 40.0 | -| `look_ahead_distance` | `double` | The distance referenced ahead of the vehicle for collecting steering angle data [m] | 15.0 | +| `look_ahead_distance` | `double` | The distance referenced ahead of the vehicle for collecting steering angle data [m] | 35.0 | - `COURSE_NAME: along_road` diff --git a/control_data_collecting_tool/config/common_param.yaml b/control_data_collecting_tool/config/common_param.yaml index e9221547..3e5c12c4 100644 --- a/control_data_collecting_tool/config/common_param.yaml +++ b/control_data_collecting_tool/config/common_param.yaml @@ -12,14 +12,25 @@ NUM_BINS_V: 10 NUM_BINS_STEER: 20 NUM_BINS_A: 10 + NUM_BINS_ABS_STEER_RATE: 5 + NUM_BINS_JERK: 10 V_MIN: 0.0 V_MAX: 11.5 STEER_MIN: -0.6 STEER_MAX: 0.6 A_MIN: -1.0 A_MAX: 1.0 + ABS_STEER_RATE_MIN: 0.0 + ABS_STEER_RATE_MAX: 0.3 + JERK_MIN: -0.5 + JERK_MAX: 0.5 - max_lateral_accel: 2.00 + MASK_NAME: default + VEL_ACC_THRESHOLD: 40 + VEL_STEER_THRESHOLD: 20 + VEL_ABS_STEER_RATE_THRESHOLD: 20 + + max_lateral_accel: 2.70 lateral_error_threshold: 1.50 yaw_error_threshold: 0.75 velocity_limit_by_tracking_error: 1.0 diff --git a/control_data_collecting_tool/config/course_param/reversal_loop_circle_param.yaml b/control_data_collecting_tool/config/course_param/reversal_loop_circle_param.yaml index 09621529..55939b39 100644 --- a/control_data_collecting_tool/config/course_param/reversal_loop_circle_param.yaml +++ b/control_data_collecting_tool/config/course_param/reversal_loop_circle_param.yaml @@ -3,7 +3,7 @@ # Course Specific Parameters trajectory_radius: 35.0 enclosing_radius: 40.0 - look_ahead_distance: 15.0 + look_ahead_distance: 35.0 # Data Collection Range COLLECTING_DATA_V_MIN: 0.5 diff --git a/control_data_collecting_tool/config/masks/default/default_Velocity_Acceleration.txt b/control_data_collecting_tool/config/masks/default/default_Velocity_Acceleration.txt new file mode 100644 index 00000000..d91fe222 --- /dev/null +++ b/control_data_collecting_tool/config/masks/default/default_Velocity_Acceleration.txt @@ -0,0 +1,10 @@ +1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 +0 1 1 1 1 1 1 1 1 0 +0 0 1 1 1 1 1 1 0 0 +0 0 0 1 1 1 1 0 0 0 diff --git a/control_data_collecting_tool/config/masks/default/default_Velocity_Steering.txt b/control_data_collecting_tool/config/masks/default/default_Velocity_Steering.txt new file mode 100644 index 00000000..e40069b7 --- /dev/null +++ b/control_data_collecting_tool/config/masks/default/default_Velocity_Steering.txt @@ -0,0 +1,10 @@ +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 +0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 diff --git a/control_data_collecting_tool/config/masks/default/default_Velocity_Steering_Rate.txt b/control_data_collecting_tool/config/masks/default/default_Velocity_Steering_Rate.txt new file mode 100644 index 00000000..60fc5087 --- /dev/null +++ b/control_data_collecting_tool/config/masks/default/default_Velocity_Steering_Rate.txt @@ -0,0 +1,10 @@ +1 1 1 1 1 +1 1 1 1 1 +1 1 1 1 1 +1 1 1 1 1 +1 1 1 1 1 +1 1 1 1 1 +1 1 0 0 0 +1 1 0 0 0 +1 1 0 0 0 +1 1 0 0 0 diff --git a/control_data_collecting_tool/resource/boundary.png b/control_data_collecting_tool/resource/boundary.png new file mode 100644 index 00000000..8cc3b88e Binary files /dev/null and b/control_data_collecting_tool/resource/boundary.png differ diff --git a/control_data_collecting_tool/resource/boundary_counter_clockwise.png b/control_data_collecting_tool/resource/boundary_counter_clockwise.png new file mode 100644 index 00000000..dbdd2178 Binary files /dev/null and b/control_data_collecting_tool/resource/boundary_counter_clockwise.png differ diff --git a/control_data_collecting_tool/resource/circumscribing_circle.png b/control_data_collecting_tool/resource/circumscribing_circle.png new file mode 100644 index 00000000..2c1996f9 Binary files /dev/null and b/control_data_collecting_tool/resource/circumscribing_circle.png differ diff --git a/control_data_collecting_tool/resource/circumscribing_circle_counter_clockwise.png b/control_data_collecting_tool/resource/circumscribing_circle_counter_clockwise.png new file mode 100644 index 00000000..be54aaf9 Binary files /dev/null and b/control_data_collecting_tool/resource/circumscribing_circle_counter_clockwise.png differ diff --git a/control_data_collecting_tool/resource/common_tangent.png b/control_data_collecting_tool/resource/common_tangent.png new file mode 100644 index 00000000..77af0f3f Binary files /dev/null and b/control_data_collecting_tool/resource/common_tangent.png differ diff --git a/control_data_collecting_tool/resource/common_tangent_counter_clockwise.png b/control_data_collecting_tool/resource/common_tangent_counter_clockwise.png new file mode 100644 index 00000000..b1208b25 Binary files /dev/null and b/control_data_collecting_tool/resource/common_tangent_counter_clockwise.png differ diff --git a/control_data_collecting_tool/resource/data_collection_status.png b/control_data_collecting_tool/resource/data_collection_status.png new file mode 100644 index 00000000..adfaa979 Binary files /dev/null and b/control_data_collecting_tool/resource/data_collection_status.png differ diff --git a/control_data_collecting_tool/resource/looking_ahead.png b/control_data_collecting_tool/resource/looking_ahead.png new file mode 100644 index 00000000..10d0dcad Binary files /dev/null and b/control_data_collecting_tool/resource/looking_ahead.png differ diff --git a/control_data_collecting_tool/resource/mask_selection.png b/control_data_collecting_tool/resource/mask_selection.png new file mode 100644 index 00000000..cdfcaf04 Binary files /dev/null and b/control_data_collecting_tool/resource/mask_selection.png differ diff --git a/control_data_collecting_tool/resource/original.png b/control_data_collecting_tool/resource/original.png new file mode 100644 index 00000000..448ce3af Binary files /dev/null and b/control_data_collecting_tool/resource/original.png differ diff --git a/control_data_collecting_tool/resource/whole_trajectory.png b/control_data_collecting_tool/resource/whole_trajectory.png new file mode 100644 index 00000000..5830d522 Binary files /dev/null and b/control_data_collecting_tool/resource/whole_trajectory.png differ diff --git a/control_data_collecting_tool/scripts/courses/along_road.py b/control_data_collecting_tool/scripts/courses/along_road.py index eed4f7b6..c9374e7d 100644 --- a/control_data_collecting_tool/scripts/courses/along_road.py +++ b/control_data_collecting_tool/scripts/courses/along_road.py @@ -75,14 +75,14 @@ def declare_along_road_params(node): "longitude", 139.6503, ParameterDescriptor( - description="The longitude of the origin specified when loading the map" + description="The longitude of the origin specified when loading the map [degree]" ), ) node.declare_parameter( "latitude", 35.6762, ParameterDescriptor( - description="The latitude of the origin specified when loading the map" + description="The latitude of the origin specified when loading the map [degree]" ), ) node.declare_parameter( @@ -250,6 +250,8 @@ def get_target_velocity( current_acc, collected_data_counts_of_vel_acc, collected_data_counts_of_vel_steer, + mask_vel_acc, + mask_vel_steer, ): part = self.parts[nearestIndex] achievement_rate = self.achievement_rates[nearestIndex] @@ -261,7 +263,7 @@ def get_target_velocity( or (part == "straight" and achievement_rate < 0.05) ) and not self.set_target_velocity_on_straight_line: self.acc_idx, self.vel_idx = self.choose_target_velocity_acc( - collected_data_counts_of_vel_acc + collected_data_counts_of_vel_acc, mask_vel_acc ) self.target_acc_on_straight_line = self.params.a_bin_centers[self.acc_idx] self.target_vel_on_straight_line = self.params.v_bin_centers[self.vel_idx] diff --git a/control_data_collecting_tool/scripts/courses/base_course.py b/control_data_collecting_tool/scripts/courses/base_course.py index 3866aee4..5d4ccf92 100644 --- a/control_data_collecting_tool/scripts/courses/base_course.py +++ b/control_data_collecting_tool/scripts/courses/base_course.py @@ -48,7 +48,7 @@ def get_trajectory_points( ): pass - def choose_target_velocity_acc(self, collected_data_counts_of_vel_acc): + def choose_target_velocity_acc(self, collected_data_counts_of_vel_acc, mask_vel_acc): min_num_data = 1e12 min_data_num_margin = 20 min_index_list = [] @@ -57,13 +57,16 @@ def choose_target_velocity_acc(self, collected_data_counts_of_vel_acc): for j in range( self.params.collecting_data_min_n_a, self.params.collecting_data_max_n_a ): - if min_num_data - min_data_num_margin > collected_data_counts_of_vel_acc[i, j]: - min_num_data = collected_data_counts_of_vel_acc[i, j] - min_index_list.clear() - min_index_list.append((j, i)) + if mask_vel_acc[i, j] == 1: + if min_num_data - min_data_num_margin > collected_data_counts_of_vel_acc[i, j]: + min_num_data = collected_data_counts_of_vel_acc[i, j] + min_index_list.clear() + min_index_list.append((j, i)) - elif min_num_data + min_data_num_margin > collected_data_counts_of_vel_acc[i, j]: - min_index_list.append((j, i)) + elif ( + min_num_data + min_data_num_margin > collected_data_counts_of_vel_acc[i, j] + ): + min_index_list.append((j, i)) return min_index_list[np.random.randint(0, len(min_index_list))] @@ -75,6 +78,8 @@ def get_target_velocity( current_acc, collected_data_counts_of_vel_acc, collected_data_counts_of_vel_steer, + mask_vel_acc, + mask_vel_steer, ): pass diff --git a/control_data_collecting_tool/scripts/courses/figure_eight.py b/control_data_collecting_tool/scripts/courses/figure_eight.py index 1bb20b52..71e4e2fe 100644 --- a/control_data_collecting_tool/scripts/courses/figure_eight.py +++ b/control_data_collecting_tool/scripts/courses/figure_eight.py @@ -177,6 +177,8 @@ def get_target_velocity( current_acc, collected_data_counts_of_vel_acc, collected_data_counts_of_vel_steer, + mask_vel_acc, + mask_vel_steer, ): part = self.parts[nearestIndex] achievement_rate = self.achievement_rates[nearestIndex] @@ -188,7 +190,7 @@ def get_target_velocity( or (part == "straight" and achievement_rate < 0.05) ) and not self.set_target_velocity_on_straight_line: self.acc_idx, self.vel_idx = self.choose_target_velocity_acc( - collected_data_counts_of_vel_acc + collected_data_counts_of_vel_acc, mask_vel_acc ) self.target_acc_on_straight_line = self.params.a_bin_centers[self.acc_idx] self.target_vel_on_straight_line = self.params.v_bin_centers[self.vel_idx] diff --git a/control_data_collecting_tool/scripts/courses/reversal_loop_circle.py b/control_data_collecting_tool/scripts/courses/reversal_loop_circle.py index 3650e3a5..108df22d 100644 --- a/control_data_collecting_tool/scripts/courses/reversal_loop_circle.py +++ b/control_data_collecting_tool/scripts/courses/reversal_loop_circle.py @@ -752,7 +752,7 @@ def declare_reversal_loop_circle_params(node): node.declare_parameter( "look_ahead_distance", - 15.0, + 35.0, ParameterDescriptor( description="The distance referenced ahead of the vehicle for collecting steering angle data" ), @@ -818,9 +818,9 @@ def __init__(self, step: float, param_dict): self.trajectory_nearly_straight_clock_wise[self.steer_list[i]] = trajectory # Generate and store counterclockwise trajectories by reversing the clockwise trajectory. - self.trajectory_nearly_straight_counter_clock_wise[ - self.steer_list[i] - ] = reverse_trajectory_segment(trajectory) + self.trajectory_nearly_straight_counter_clock_wise[self.steer_list[i]] = ( + reverse_trajectory_segment(trajectory) + ) # Generate trajectories for changing directions (turning). @@ -1011,6 +1011,8 @@ def get_target_velocity( current_acc, collected_data_counts_of_vel_acc, collected_data_counts_of_vel_steer, + mask_vel_acc, + mask_vel_steer, ): # Calculate the target velocity for the vehicle based on its current state, trajectory phase, and constraints such as acceleration limits and trajectory curvature. @@ -1018,7 +1020,7 @@ def get_target_velocity( if not self.updated_target_velocity: # Choose velocity and acceleration bins based on collected data self.acc_idx, self.vel_idx = self.choose_target_velocity_acc( - collected_data_counts_of_vel_acc + collected_data_counts_of_vel_acc, mask_vel_acc ) self.target_acc_on_segmentation = self.params.a_bin_centers[self.acc_idx] self.target_vel_on_segmentation = self.params.v_bin_centers[self.vel_idx] @@ -1028,74 +1030,81 @@ def get_target_velocity( self.vehicle_phase = "acceleration" self.updated_target_velocity = True + self.alpha = 0.5 + np.random.randint(0, 2) * 0.5 + acc_kp_of_pure_pursuit = self.params.acc_kp # Proportional gain for acceleration control - T = 10.0 # Period of the sine wave used to modulate velocity + # Period should be parameterized + T = 5.0 # Period of the sine wave used to modulate velocity sine = np.sin(2 * np.pi * current_time / T) # Sine wave for smooth velocity modulation + target_acc = 0.0 # Handle acceleration phase if self.vehicle_phase == "acceleration": if current_vel < self.target_vel_on_segmentation - 1.0 * abs( self.target_acc_on_segmentation ): # Increase velocity with a maximum allowable acceleration - target_vel = current_vel + self.params.a_max / acc_kp_of_pure_pursuit * ( - 1.25 + 0.50 * sine + target_acc = ( + self.alpha * self.params.a_max / acc_kp_of_pure_pursuit * (0.4 + 0.6 * sine) ) else: # Increase velocity with a absolute target acceleration - target_vel = current_vel + abs( - self.target_acc_on_segmentation - ) / acc_kp_of_pure_pursuit * (1.25 + 0.50 * sine) + target_acc = ( + abs(self.target_acc_on_segmentation) / acc_kp_of_pure_pursuit + 0.1 * sine + ) # Transition to "constant speed" phase once the target velocity is reached if current_vel > self.target_vel_on_segmentation: self.vehicle_phase = "constant_speed" self.const_velocity_start_time = current_time - # Handle constant speed phase - if self.vehicle_phase == "constant_speed": - # Modulate velocity around the target with a sine wave - target_vel = self.target_vel_on_segmentation + 2.0 * (-0.5 + 1.0 * sine) - - # Transition to "deceleration" phase after a fixed duration - if current_time - self.const_velocity_start_time > T: - self.vehicle_phase = "deceleration" - # Handle deceleration phase if self.vehicle_phase == "deceleration": if current_vel < self.target_vel_on_segmentation - 1.0 * abs( self.target_acc_on_segmentation ): # Decrease velocity with a maximum deceleration - target_vel = current_vel - self.params.a_max / acc_kp_of_pure_pursuit * ( - 1.25 + 0.50 * sine + target_acc = ( + -self.alpha * self.params.a_max / acc_kp_of_pure_pursuit * (0.4 + 0.6 * sine) ) else: # Decrease velocity with a absolute target acceleration - target_vel = current_vel - abs( - self.target_acc_on_segmentation - ) / acc_kp_of_pure_pursuit * (1.25 + 0.50 * sine) + target_acc = ( + -abs(self.target_acc_on_segmentation) / acc_kp_of_pure_pursuit + 0.1 * sine + ) # Reset velocity update flag when deceleration is complete - if ( - current_vel - < self.target_vel_on_segmentation - - 1.0 * abs(self.target_acc_on_segmentation) / acc_kp_of_pure_pursuit - ): + if current_vel < self.target_vel_on_segmentation / 4.0: self.updated_target_velocity = False # Maintain a smoothed velocity by averaging recent values + # 10.0 should be parameterized + target_vel = current_vel + target_acc + 10.0 * (target_acc - current_acc) + + # Handle constant speed phase + if self.vehicle_phase == "constant_speed": + # Modulate velocity around the target with a sine wave + target_vel = ( + self.target_vel_on_segmentation + + 2.0 + * np.sin(2 * np.pi * current_time / 5.0) + * np.sin(2 * np.pi * current_time / 10.0) + - 2.0 + ) + if current_time - self.const_velocity_start_time > 20.0: + self.vehicle_phase = "deceleration" + self.vel_hist.append(target_vel) target_vel = np.mean(self.vel_hist) # Special handling for trajectory direction changes if self.trajectory_list[2].in_direction is not self.trajectory_list[2].out_direction: # Set a fixed target velocity during direction transitions - target_vel = 3.0 + 1.0 * sine + target_vel = 2.0 + 2.0 * sine # Adjust velocity based on trajectory curvature and lateral acceleration constraints - if (self.trajectory_list[1].in_direction is not self.trajectory_list[1].out_direction) or ( - self.trajectory_list[2].in_direction is not self.trajectory_list[2].out_direction + if (self.trajectory_list[0].in_direction is not self.trajectory_list[0].out_direction) or ( + self.trajectory_list[1].in_direction is not self.trajectory_list[1].out_direction ): max_curvature_on_segment = 1e-9 # Initialize to a small value to avoid division by zero max_lateral_vel_on_segment = 1e9 # Initialize to a large value as a placeholder @@ -1138,10 +1147,7 @@ def get_target_velocity( max_vel_from_lateral_acc_on_segment = np.sqrt( self.params.max_lateral_accel / max_curvature_on_segment ) - target_vel = np.min([target_vel_ + 0.5 * sine, max_vel_from_lateral_acc_on_segment]) - - # Ensure the target velocity remains above a minimum threshold - target_vel = np.max([target_vel, 0.5]) + target_vel = np.min([target_vel_ + 1.0 * sine**2, max_vel_from_lateral_acc_on_segment]) return target_vel diff --git a/control_data_collecting_tool/scripts/courses/straight_line_negative.py b/control_data_collecting_tool/scripts/courses/straight_line_negative.py index 07edb09e..74270236 100644 --- a/control_data_collecting_tool/scripts/courses/straight_line_negative.py +++ b/control_data_collecting_tool/scripts/courses/straight_line_negative.py @@ -75,6 +75,8 @@ def get_target_velocity( current_acc, collected_data_counts_of_vel_acc, collected_data_counts_of_vel_steer, + mask_vel_acc, + mask_vel_steer, ): part = self.parts[nearestIndex] achievement_rate = self.achievement_rates[nearestIndex] @@ -83,7 +85,7 @@ def get_target_velocity( # Check and update target velocity on straight line if part == "straight" and achievement_rate < 0.05: self.acc_idx, self.vel_idx = self.choose_target_velocity_acc( - collected_data_counts_of_vel_acc + collected_data_counts_of_vel_acc, mask_vel_acc ) self.target_acc_on_straight_line = self.params.a_bin_centers[self.acc_idx] self.target_vel_on_straight_line = self.params.v_bin_centers[self.vel_idx] diff --git a/control_data_collecting_tool/scripts/courses/straight_line_positive.py b/control_data_collecting_tool/scripts/courses/straight_line_positive.py index b90a2dec..c07fda1a 100644 --- a/control_data_collecting_tool/scripts/courses/straight_line_positive.py +++ b/control_data_collecting_tool/scripts/courses/straight_line_positive.py @@ -75,6 +75,8 @@ def get_target_velocity( current_acc, collected_data_counts_of_vel_acc, collected_data_counts_of_vel_steer, + mask_vel_acc, + mask_vel_steer, ): part = self.parts[nearestIndex] achievement_rate = self.achievement_rates[nearestIndex] @@ -83,7 +85,7 @@ def get_target_velocity( # Check and update target velocity on straight line if part == "straight" and achievement_rate < 0.05: self.acc_idx, self.vel_idx = self.choose_target_velocity_acc( - collected_data_counts_of_vel_acc + collected_data_counts_of_vel_acc, mask_vel_acc ) self.target_acc_on_straight_line = self.params.a_bin_centers[self.acc_idx] self.target_vel_on_straight_line = self.params.v_bin_centers[self.vel_idx] diff --git a/control_data_collecting_tool/scripts/courses/u_shaped.py b/control_data_collecting_tool/scripts/courses/u_shaped.py index bca37ca5..ac33b1e7 100644 --- a/control_data_collecting_tool/scripts/courses/u_shaped.py +++ b/control_data_collecting_tool/scripts/courses/u_shaped.py @@ -145,6 +145,8 @@ def get_target_velocity( current_acc, collected_data_counts_of_vel_acc, collected_data_counts_of_vel_steer, + mask_vel_acc, + mask_vel_steer, ): part = self.parts[nearestIndex] achievement_rate = self.achievement_rates[nearestIndex] @@ -156,7 +158,7 @@ def get_target_velocity( or (part == "straight" and achievement_rate < 0.05) ) and not self.set_target_velocity_on_straight_line: self.acc_idx, self.vel_idx = self.choose_target_velocity_acc( - collected_data_counts_of_vel_acc + collected_data_counts_of_vel_acc, mask_vel_acc ) self.target_acc_on_straight_line = self.params.a_bin_centers[self.acc_idx] self.target_vel_on_straight_line = self.params.v_bin_centers[self.vel_idx] diff --git a/control_data_collecting_tool/scripts/data_collecting_base_node.py b/control_data_collecting_tool/scripts/data_collecting_base_node.py index 28d0a404..ec6c1f48 100644 --- a/control_data_collecting_tool/scripts/data_collecting_base_node.py +++ b/control_data_collecting_tool/scripts/data_collecting_base_node.py @@ -14,6 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os + +from ament_index_python.packages import get_package_share_directory from autoware_adapi_v1_msgs.msg import OperationModeState from autoware_vehicle_msgs.msg import ControlModeReport from geometry_msgs.msg import AccelWithCovarianceStamped @@ -28,6 +31,22 @@ def __init__(self, node_name): super().__init__(node_name) # common params + self.declare_parameter( + "COURSE_NAME", + "eight_course", + ParameterDescriptor( + description="Course name [`eight_course`, `u_shaped_return`, `straight_line_positive`, `straight_line_negative`, `reversal_loop_circle`, `along_road`]" + ), + ) + # set course name + self.COURSE_NAME = self.get_parameter("COURSE_NAME").value + + self.declare_parameter( + "MASK_NAME", + "default", + ParameterDescriptor(description="Masks for Data collection"), + ) + self.declare_parameter( "wheel_base", 2.79, @@ -52,6 +71,20 @@ def __init__(self, node_name): ParameterDescriptor(description="Number of bins of acceleration in heatmap"), ) + self.declare_parameter( + "NUM_BINS_ABS_STEER_RATE", + 5, + ParameterDescriptor( + description="Number of bins of absolute value of steer rate in heatmap" + ), + ) + + self.declare_parameter( + "NUM_BINS_JERK", + 5, + ParameterDescriptor(description="Number of bins of jerk in heatmap"), + ) + self.declare_parameter( "V_MIN", 0.0, @@ -79,13 +112,37 @@ def __init__(self, node_name): self.declare_parameter( "A_MIN", -1.0, - ParameterDescriptor(description="Minimum acceleration in heatmap [m/ss]"), + ParameterDescriptor(description="Minimum acceleration in heatmap [m/s^2]"), ) self.declare_parameter( "A_MAX", 1.0, - ParameterDescriptor(description="Maximum acceleration in heatmap [m/ss]"), + ParameterDescriptor(description="Maximum acceleration in heatmap [m/s^2]"), + ) + + self.declare_parameter( + "ABS_STEER_RATE_MIN", + 0.0, + ParameterDescriptor(description="Minimum steer in heatmap [rad]"), + ) + + self.declare_parameter( + "ABS_STEER_RATE_MAX", + 0.3, + ParameterDescriptor(description="Maximum steer in heatmap [rad]"), + ) + + self.declare_parameter( + "JERK_MIN", + -0.5, + ParameterDescriptor(description="Minimum jerk in heatmap [m/s^3]"), + ) + + self.declare_parameter( + "JERK_MAX", + 0.5, + ParameterDescriptor(description="Maximum jerk in heatmap [m/s^3]"), ) self.ego_point = np.array([0.0, 0.0]) @@ -133,6 +190,11 @@ def __init__(self, node_name): self.get_parameter("NUM_BINS_STEER").get_parameter_value().integer_value ) self.num_bins_a = self.get_parameter("NUM_BINS_A").get_parameter_value().integer_value + self.num_bins_abs_steer_rate = ( + self.get_parameter("NUM_BINS_ABS_STEER_RATE").get_parameter_value().integer_value + ) + self.num_bins_jerk = self.get_parameter("NUM_BINS_JERK").get_parameter_value().integer_value + self.v_min, self.v_max = ( self.get_parameter("V_MIN").get_parameter_value().double_value, self.get_parameter("V_MAX").get_parameter_value().double_value, @@ -145,6 +207,15 @@ def __init__(self, node_name): self.get_parameter("A_MIN").get_parameter_value().double_value, self.get_parameter("A_MAX").get_parameter_value().double_value, ) + self.abs_steer_rate_min, self.abs_steer_rate_max = ( + self.get_parameter("ABS_STEER_RATE_MIN").get_parameter_value().double_value, + self.get_parameter("ABS_STEER_RATE_MAX").get_parameter_value().double_value, + ) + + self.jerk_min, self.jerk_max = ( + self.get_parameter("JERK_MIN").get_parameter_value().double_value, + self.get_parameter("JERK_MAX").get_parameter_value().double_value, + ) self.collected_data_counts_of_vel_acc = np.zeros( (self.num_bins_v, self.num_bins_a), dtype=np.int32 @@ -152,14 +223,56 @@ def __init__(self, node_name): self.collected_data_counts_of_vel_steer = np.zeros( (self.num_bins_v, self.num_bins_steer), dtype=np.int32 ) + self.collected_data_counts_of_vel_abs_steer_rate = np.zeros( + (self.num_bins_v, self.num_bins_abs_steer_rate), dtype=np.int32 + ) + self.collected_data_counts_of_vel_jerk = np.zeros( + (self.num_bins_v, self.num_bins_jerk), dtype=np.int32 + ) self.v_bins = np.linspace(self.v_min, self.v_max, self.num_bins_v + 1) self.steer_bins = np.linspace(self.steer_min, self.steer_max, self.num_bins_steer + 1) self.a_bins = np.linspace(self.a_min, self.a_max, self.num_bins_a + 1) + self.abs_steer_rate_bins = np.linspace( + self.abs_steer_rate_min, self.abs_steer_rate_max, self.num_bins_abs_steer_rate + 1 + ) + self.jerk_bins = np.linspace(self.jerk_min, self.jerk_max, self.num_bins_jerk + 1) self.v_bin_centers = (self.v_bins[:-1] + self.v_bins[1:]) / 2 self.steer_bin_centers = (self.steer_bins[:-1] + self.steer_bins[1:]) / 2 self.a_bin_centers = (self.a_bins[:-1] + self.a_bins[1:]) / 2 + self.abs_steer_rate_bin_centers = ( + self.abs_steer_rate_bins[:-1] + self.abs_steer_rate_bins[1:] + ) / 2 + self.jerk_bin_centers = (self.jerk_bins[:-1] + self.jerk_bins[1:]) / 2 + + MASK_NAME = self.get_parameter("MASK_NAME").value + mask_directory_path = ( + get_package_share_directory("control_data_collecting_tool") + + "/config/masks/" + + MASK_NAME + ) + + mask_vel_acc_path = os.path.join( + mask_directory_path, f"{MASK_NAME}_Velocity_Acceleration.txt" + ) + self.mask_vel_acc = self.load_mask_from_txt( + mask_vel_acc_path, self.num_bins_v, self.num_bins_a + ) + + mask_velocity_steering_path = os.path.join( + mask_directory_path, f"{MASK_NAME}_Velocity_Steering.txt" + ) + self.mask_vel_steer = self.load_mask_from_txt( + mask_velocity_steering_path, self.num_bins_v, self.num_bins_steer + ) + + mask_velocity_abs_steer_rate_path = os.path.join( + mask_directory_path, f"{MASK_NAME}_Velocity_Steering_Rate.txt" + ) + self.mask_vel_abs_steer_rate = self.load_mask_from_txt( + mask_velocity_abs_steer_rate_path, self.num_bins_v, self.num_bins_abs_steer_rate + ) def onOdometry(self, msg): self._present_kinematic_state = msg @@ -178,3 +291,13 @@ def subscribe_operation_mode(self, msg): def subscribe_control_mode(self, msg): self._present_control_mode_ = msg.mode + + def load_mask_from_txt(self, file_path, nx, ny): + try: + mask = np.loadtxt(file_path, dtype=int) + if len(mask) == nx and len(mask[0]) == ny: + return mask + except Exception as e: + self.get_logger().error(f"Failed to load mask from {file_path}: {e}") + + return np.ones((nx, ny), dtype=int) diff --git a/control_data_collecting_tool/scripts/data_collecting_data_counter.py b/control_data_collecting_tool/scripts/data_collecting_data_counter.py index 6c441546..adaa5602 100755 --- a/control_data_collecting_tool/scripts/data_collecting_data_counter.py +++ b/control_data_collecting_tool/scripts/data_collecting_data_counter.py @@ -62,6 +62,8 @@ def __init__(self): self.vel_hist = deque([float(0.0)] * 200, maxlen=200) self.acc_hist = deque([float(0.0)] * 200, maxlen=200) + self.previous_steer = 0.0 + self.previous_acc = 0.0 self.timer_period_callback = 0.033 # 30ms self.timer_counter = self.create_timer( @@ -75,6 +77,14 @@ def __init__(self): self.collected_data_counts_of_vel_steer_publisher_ = self.create_publisher( Int32MultiArray, "/control_data_collecting_tools/collected_data_counts_of_vel_steer", 10 ) + self.collected_data_counts_of_vel_abs_steer_rate_publisher_ = self.create_publisher( + Int32MultiArray, + "/control_data_collecting_tools/collected_data_counts_of_vel_abs_steer_rate", + 10, + ) + self.collected_data_counts_of_vel_jerk_publisher_ = self.create_publisher( + Int32MultiArray, "/control_data_collecting_tools/collected_data_counts_of_vel_jerk", 10 + ) self.vel_hist_publisher_ = self.create_publisher( Float32MultiArray, "/control_data_collecting_tools/vel_hist", 10 @@ -200,14 +210,22 @@ def load_rosbag_data(self, rosbag2_dir_list): vel, acc, steer, + steer_rate=(steer - self.previous_steer) / 0.033, + jerk=(acc - self.previous_acc) / 0.033, ) - + self.previous_steer = steer + self.previous_acc = acc current_time += self.timer_period_callback - def count_observations(self, v, a, steer): + self.previous_steer = 0.0 + self.previous_acc = 0.0 + + def count_observations(self, v, a, steer, steer_rate, jerk): v_bin = np.digitize(v, self.v_bins) - 1 steer_bin = np.digitize(steer, self.steer_bins) - 1 a_bin = np.digitize(a, self.a_bins) - 1 + abs_steer_rate_bin = np.digitize(abs(steer_rate), self.abs_steer_rate_bins) - 1 + jerk_bin = np.digitize(jerk, self.jerk_bins) - 1 if 0 <= v_bin < self.num_bins_v and 0 <= a_bin < self.num_bins_a: self.collected_data_counts_of_vel_acc[v_bin, a_bin] += 1 @@ -215,6 +233,12 @@ def count_observations(self, v, a, steer): if 0 <= v_bin < self.num_bins_v and 0 <= steer_bin < self.num_bins_steer: self.collected_data_counts_of_vel_steer[v_bin, steer_bin] += 1 + if 0 <= v_bin < self.num_bins_v and 0 <= abs_steer_rate_bin < self.num_bins_abs_steer_rate: + self.collected_data_counts_of_vel_abs_steer_rate[v_bin, abs_steer_rate_bin] += 1 + + if 0 <= v_bin < self.num_bins_v and 0 <= jerk_bin < self.num_bins_jerk: + self.collected_data_counts_of_vel_jerk[v_bin, jerk_bin] += 1 + # call back for counting data points def timer_callback_counter(self): if ( @@ -229,15 +253,17 @@ def timer_callback_counter(self): current_steer = arctan2( wheel_base * angular_z, self._present_kinematic_state.twist.twist.linear.x ) - current_vel = self._present_kinematic_state.twist.twist.linear.x current_acc = self._present_acceleration.accel.accel.linear.x + current_steer_rate = (current_steer - self.previous_steer) / 0.033 + current_jerk = (current_acc - self.previous_acc) / 0.033 + + self.previous_steer = current_steer + self.previous_acc = current_acc if self._present_kinematic_state.twist.twist.linear.x > 1e-3: self.count_observations( - current_vel, - current_acc, - current_steer, + current_vel, current_acc, current_steer, current_steer_rate, current_jerk ) self.acc_hist.append(float(current_acc)) @@ -254,6 +280,18 @@ def timer_callback_counter(self): self.collected_data_counts_of_vel_steer, ) + # publish collected_data_counts_of_vel_abs_steer_rate + publish_Int32MultiArray( + self.collected_data_counts_of_vel_abs_steer_rate_publisher_, + self.collected_data_counts_of_vel_abs_steer_rate, + ) + + # publish collected_data_counts_of_vel_jerk + publish_Int32MultiArray( + self.collected_data_counts_of_vel_jerk_publisher_, + self.collected_data_counts_of_vel_jerk, + ) + # publish acc_hist msg = Float32MultiArray() msg.data = list(self.acc_hist) diff --git a/control_data_collecting_tool/scripts/data_collecting_plotter.py b/control_data_collecting_tool/scripts/data_collecting_plotter.py index 93c35276..d683779e 100755 --- a/control_data_collecting_tool/scripts/data_collecting_plotter.py +++ b/control_data_collecting_tool/scripts/data_collecting_plotter.py @@ -15,8 +15,12 @@ # limitations under the License. from data_collecting_base_node import DataCollectingBaseNode +from matplotlib.colors import ListedColormap +from matplotlib.colors import Normalize +from matplotlib.patches import Rectangle import matplotlib.pyplot as plt import numpy as np +from rcl_interfaces.msg import ParameterDescriptor import rclpy import seaborn as sns from std_msgs.msg import Float32MultiArray @@ -27,6 +31,40 @@ class DataCollectingPlotter(DataCollectingBaseNode): def __init__(self): super().__init__("data_collecting_plotter") + self.declare_parameter( + "VEL_ACC_THRESHOLD", + 40, + ParameterDescriptor( + description="Threshold of velocity-and-acc heatmap in data collection" + ), + ) + + self.declare_parameter( + "VEL_STEER_THRESHOLD", + 20, + ParameterDescriptor( + description="Threshold of velocity-and-steer heatmap in data collection" + ), + ) + + self.declare_parameter( + "VEL_ABS_STEER_RATE_THRESHOLD", + 20, + ParameterDescriptor( + description="Threshold of velocity-and-abs_steer_rate heatmap in data collection" + ), + ) + + self.VEL_ACC_THRESHOLD = ( + self.get_parameter("VEL_ACC_THRESHOLD").get_parameter_value().integer_value + ) + self.VEL_STEER_THRESHOLD = ( + self.get_parameter("VEL_STEER_THRESHOLD").get_parameter_value().integer_value + ) + self.VEL_ABS_STEER_RATE_THRESHOLD = ( + self.get_parameter("VEL_ABS_STEER_RATE_THRESHOLD").get_parameter_value().integer_value + ) + # callback for plot self.grid_update_time_interval = 5.0 self.timer_plotter = self.create_timer( @@ -34,8 +72,14 @@ def __init__(self): self.timer_callback_plotter, ) - self.fig, self.axs = plt.subplots(3, 1, figsize=(12, 20)) + self.fig, self.axs = plt.subplots(5, 1, figsize=(12, 24)) plt.ion() + self.cmap = ListedColormap(["blue", "yellowgreen"]) + self.vel_acc_heatmap_norm = Normalize(vmin=0, vmax=2 * self.VEL_ACC_THRESHOLD) + self.vel_steer_heatmap_norm = Normalize(vmin=0, vmax=2 * self.VEL_STEER_THRESHOLD) + self.vel_abs_steer_rate_heatmap_norm = Normalize( + vmin=0, vmax=2 * self.VEL_ABS_STEER_RATE_THRESHOLD + ) self.collected_data_counts_of_vel_acc_subscription_ = self.create_subscription( Int32MultiArray, @@ -53,6 +97,22 @@ def __init__(self): ) self.collected_data_counts_of_vel_steer_subscription_ + self.collected_data_counts_of_vel_abs_steer_rate_subscription_ = self.create_subscription( + Int32MultiArray, + "/control_data_collecting_tools/collected_data_counts_of_vel_abs_steer_rate", + self.subscribe_collected_data_counts_of_vel_abs_steer_rate, + 10, + ) + self.collected_data_counts_of_vel_abs_steer_rate_subscription_ + + self.collected_data_counts_of_vel_jerk_subscription_ = self.create_subscription( + Int32MultiArray, + "/control_data_collecting_tools/collected_data_counts_of_vel_jerk", + self.subscribe_collected_data_counts_of_vel_jerk, + 10, + ) + self.collected_data_counts_of_vel_jerk_subscription_ + self.acc_hist_subscription_ = self.create_subscription( Float32MultiArray, "/control_data_collecting_tools/acc_hist", @@ -82,6 +142,16 @@ def subscribe_collected_data_counts_of_vel_steer(self, msg): cols = msg.layout.dim[1].size self.collected_data_counts_of_vel_steer = np.array(msg.data).reshape((rows, cols)) + def subscribe_collected_data_counts_of_vel_abs_steer_rate(self, msg): + rows = msg.layout.dim[0].size + cols = msg.layout.dim[1].size + self.collected_data_counts_of_vel_abs_steer_rate = np.array(msg.data).reshape((rows, cols)) + + def subscribe_collected_data_counts_of_vel_jerk(self, msg): + rows = msg.layout.dim[0].size + cols = msg.layout.dim[1].size + self.collected_data_counts_of_vel_jerk = np.array(msg.data).reshape((rows, cols)) + def subscribe_acc_hist(self, msg): self.acc_hist = msg.data @@ -110,17 +180,33 @@ def plot_data_collection_grid(self): self.heatmap = sns.heatmap( self.collected_data_counts_of_vel_acc.T, annot=True, - cmap="coolwarm", + cmap=self.cmap, + norm=self.vel_acc_heatmap_norm, xticklabels=np.round(self.v_bin_centers, 2), yticklabels=np.round(self.a_bin_centers, 2), ax=self.axs[1], linewidths=0.1, linecolor="gray", + cbar_kws={"ticks": [0, self.VEL_ACC_THRESHOLD]}, ) self.axs[1].set_xlabel("Velocity bins") self.axs[1].set_ylabel("Acceleration bins") + # Display mask + for i in range(self.collected_data_counts_of_vel_acc.shape[0]): + for j in range(self.collected_data_counts_of_vel_acc.shape[1]): + if self.mask_vel_acc[i, j] == 1: + rect = Rectangle( + (i, j), 1, 1, linewidth=0.25, edgecolor="black", facecolor="none" + ) + # self.axs[1].add_patch(rect) + else: + rect = Rectangle( + (i, j), 1, 1, linewidth=0.25, edgecolor="black", facecolor="gray" + ) + self.axs[1].add_patch(rect) + for collection in self.axs[2].collections: if collection.colorbar is not None: collection.colorbar.remove() @@ -129,18 +215,90 @@ def plot_data_collection_grid(self): self.heatmap = sns.heatmap( self.collected_data_counts_of_vel_steer.T, annot=True, - cmap="coolwarm", + cmap=self.cmap, + norm=self.vel_steer_heatmap_norm, xticklabels=np.round(self.v_bin_centers, 2), yticklabels=np.round(self.steer_bin_centers, 2), ax=self.axs[2], linewidths=0.1, linecolor="gray", + cbar_kws={"ticks": [0, self.VEL_STEER_THRESHOLD]}, ) + # Display mask + for i in range(self.collected_data_counts_of_vel_steer.shape[0]): + for j in range(self.collected_data_counts_of_vel_steer.shape[1]): + if self.mask_vel_steer[i, j] == 1: + rect = Rectangle( + (i, j), 1, 1, linewidth=0.25, edgecolor="black", facecolor="none" + ) + self.axs[2].add_patch(rect) + else: + rect = Rectangle( + (i, j), 1, 1, linewidth=0.25, edgecolor="black", facecolor="gray" + ) + self.axs[2].add_patch(rect) + # update collected steer and velocity grid self.axs[2].set_xlabel("Velocity bins") self.axs[2].set_ylabel("Steer bins") + for collection in self.axs[3].collections: + if collection.colorbar is not None: + collection.colorbar.remove() + self.axs[3].cla() + + self.heatmap = sns.heatmap( + self.collected_data_counts_of_vel_abs_steer_rate.T, + annot=True, + cmap=self.cmap, + norm=self.vel_abs_steer_rate_heatmap_norm, + xticklabels=np.round(self.v_bin_centers, 2), + yticklabels=np.round(self.abs_steer_rate_bin_centers, 2), + ax=self.axs[3], + linewidths=0.1, + linecolor="gray", + cbar_kws={"ticks": [0, self.VEL_STEER_THRESHOLD]}, + ) + + # Display mask + for i in range(self.collected_data_counts_of_vel_abs_steer_rate.shape[0]): + for j in range(self.collected_data_counts_of_vel_abs_steer_rate.shape[1]): + if self.mask_vel_abs_steer_rate[i, j] == 1: + rect = Rectangle( + (i, j), 1, 1, linewidth=0.25, edgecolor="black", facecolor="none" + ) + self.axs[3].add_patch(rect) + else: + rect = Rectangle( + (i, j), 1, 1, linewidth=0.25, edgecolor="black", facecolor="gray" + ) + self.axs[3].add_patch(rect) + + # update collected steer and velocity grid + self.axs[3].set_xlabel("Velocity bins") + self.axs[3].set_ylabel("Abs Steer_Rate bins") + + # update collected jerk and velocity grid + for collection in self.axs[4].collections: + if collection.colorbar is not None: + collection.colorbar.remove() + self.axs[4].cla() + + self.heatmap = sns.heatmap( + self.collected_data_counts_of_vel_jerk.T, + annot=True, + cmap="coolwarm", + xticklabels=np.round(self.v_bin_centers, 2), + yticklabels=np.round(self.jerk_bin_centers, 2), + ax=self.axs[4], + linewidths=0.1, + linecolor="gray", + ) + + self.axs[4].set_xlabel("Velocity bins") + self.axs[4].set_ylabel("Jerk bins") + self.fig.canvas.draw() diff --git a/control_data_collecting_tool/scripts/data_collecting_pure_pursuit_trajectory_follower.py b/control_data_collecting_tool/scripts/data_collecting_pure_pursuit_trajectory_follower.py index 6b9e1efa..23c00e05 100755 --- a/control_data_collecting_tool/scripts/data_collecting_pure_pursuit_trajectory_follower.py +++ b/control_data_collecting_tool/scripts/data_collecting_pure_pursuit_trajectory_follower.py @@ -67,7 +67,7 @@ def __init__(self): self.declare_parameter( "lookahead_time", 2.0, - ParameterDescriptor(description="Pure pursuit lookahead length coef [m/(m/s)]"), + ParameterDescriptor(description="Pure pursuit lookahead length coef [s]"), ) self.declare_parameter( @@ -92,7 +92,7 @@ def __init__(self): "stop_acc", -2.0, ParameterDescriptor( - description="Accel command for stopping data collecting driving [m/ss]" + description="Accel command for stopping data collecting driving [m/s^2]" ), ) @@ -100,7 +100,7 @@ def __init__(self): "stop_jerk_lim", 2.0, ParameterDescriptor( - description="Jerk limit for stopping data collecting driving [m/sss]" + description="Jerk limit for stopping data collecting driving [m/s^3]" ), ) @@ -108,13 +108,13 @@ def __init__(self): self.declare_parameter( "lon_acc_lim", 2.0, - ParameterDescriptor(description="Longitudinal acceleration limit [m/ss]"), + ParameterDescriptor(description="Longitudinal acceleration limit [m/s^2]"), ) self.declare_parameter( "lon_jerk_lim", 5.0, - ParameterDescriptor(description="Longitudinal jerk limit [m/sss]"), + ParameterDescriptor(description="Longitudinal jerk limit [m/s^3]"), ) self.declare_parameter( @@ -132,7 +132,7 @@ def __init__(self): self.declare_parameter( "acc_noise_amp", 0.01, - ParameterDescriptor(description="Accel cmd additional sine noise amplitude [m/ss]"), + ParameterDescriptor(description="Accel cmd additional sine noise amplitude [m/s^2]"), ) self.declare_parameter( @@ -526,9 +526,9 @@ def control(self): # [2] publish cmd control_cmd_msg = AckermannControlCommand() - control_cmd_msg.stamp = ( - control_cmd_msg.lateral.stamp - ) = control_cmd_msg.longitudinal.stamp = (self.get_clock().now().to_msg()) + control_cmd_msg.stamp = control_cmd_msg.lateral.stamp = ( + control_cmd_msg.longitudinal.stamp + ) = (self.get_clock().now().to_msg()) control_cmd_msg.longitudinal.velocity = trajectory_longitudinal_velocity[nearestIndex] control_cmd_msg.longitudinal.acceleration = cmd[0] control_cmd_msg.lateral.steering_tire_angle = cmd[1] diff --git a/control_data_collecting_tool/scripts/data_collecting_trajectory_publisher.py b/control_data_collecting_tool/scripts/data_collecting_trajectory_publisher.py index b2455490..c3c2d41b 100755 --- a/control_data_collecting_tool/scripts/data_collecting_trajectory_publisher.py +++ b/control_data_collecting_tool/scripts/data_collecting_trajectory_publisher.py @@ -58,16 +58,6 @@ class DataCollectingTrajectoryPublisher(DataCollectingBaseNode): def __init__(self): super().__init__("data_collecting_trajectory_publisher") - self.declare_parameter( - "COURSE_NAME", - "eight_course", - ParameterDescriptor( - description="Course name [`eight_course`, `u_shaped_return`, `straight_line_positive`, `straight_line_negative`, `reversal_loop_circle`, `along_road`]" - ), - ) - # set course name - self.COURSE_NAME = self.get_parameter("COURSE_NAME").value - self.declare_parameter( "acc_kp", 1.0, @@ -77,12 +67,12 @@ def __init__(self): self.declare_parameter( "max_lateral_accel", 0.5, - ParameterDescriptor(description="Max lateral acceleration limit [m/ss]"), + ParameterDescriptor(description="Max lateral acceleration limit [m/s^2]"), ) self.declare_parameter( "lateral_error_threshold", - 2.0, + 2.70, ParameterDescriptor( description="Lateral error threshold where applying velocity limit [m/s]" ), @@ -155,20 +145,15 @@ def __init__(self): self.declare_parameter( "COLLECTING_DATA_A_MIN", -1.0, - ParameterDescriptor(description="Minimum velocity for data collection [m/ss]"), + ParameterDescriptor(description="Minimum velocity for data collection [m/s^2]"), ) self.declare_parameter( "COLLECTING_DATA_A_MAX", 1.0, - ParameterDescriptor(description="Maximum velocity for data collection [m/ss]"), + ParameterDescriptor(description="Maximum velocity for data collection [m/s^2]"), ) - """ - Declare course specific parameters - """ - declare_course_params(self.COURSE_NAME, self) - self.trajectory_for_collecting_data_pub_ = self.create_publisher( Trajectory, "/data_collecting_trajectory", @@ -204,6 +189,11 @@ def __init__(self): ) self.sub_data_collecting_area_ + """ + Declare course specific parameters + """ + declare_course_params(self.COURSE_NAME, self) + # obtain ros params as dictionary param_names = self._parameters params = self.get_parameters(param_names) @@ -532,6 +522,8 @@ def callback_trajectory_generator(self): present_acc, self.collected_data_counts_of_vel_acc, self.collected_data_counts_of_vel_steer, + self.mask_vel_acc, + self.mask_vel_steer, ) trajectory_longitudinal_velocity_data = np.array( diff --git a/control_data_collecting_tool/scripts/mask/mask_selector.py b/control_data_collecting_tool/scripts/mask/mask_selector.py new file mode 100644 index 00000000..29bdfa47 --- /dev/null +++ b/control_data_collecting_tool/scripts/mask/mask_selector.py @@ -0,0 +1,367 @@ +#!/usr/bin/env python3 + +# Copyright 2024 Proxima Technology Inc, TIER IV +# +# 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 signal +import threading +import time + +import matplotlib.patches as patches +import matplotlib.pyplot as plt +import numpy as np +import yaml + + +class DataCollectingMaskSelector: + def __init__( + self, + window_title="Data Collecting Mask Selector", + x_min=0, + x_max=10, + y_min=-5, + y_max=5, + num_bins_x=10, + num_bins_y=10, + default_number=1, + xlabel="X Axis", + ylabel="Y Axis", + mask_xy=None, + ): + self.grid_update_time_interval = 5.0 + self.x_min, self.x_max = x_min, x_max + self.y_min, self.y_max = y_min, y_max + self.num_bins_x, self.num_bins_y = num_bins_x, num_bins_y + self.x_bins = np.linspace(self.x_min, self.x_max, self.num_bins_x + 1) + self.y_bins = np.linspace(self.y_min, self.y_max, self.num_bins_y + 1) + self.x_bin_centers = (self.x_bins[:-1] + self.x_bins[1:]) / 2 + self.y_bin_centers = (self.y_bins[:-1] + self.y_bins[1:]) / 2 + self.default_number = default_number + self.xlabel = xlabel + self.ylabel = ylabel + + # Initialize mask_xy with the provided array or default to ones + self.mask_xy = ( + mask_xy + if mask_xy is not None + else np.ones((self.num_bins_x, self.num_bins_y), dtype=int) + ) + + self.dragging = False + self.select_mode = True + self.text_objects = {} + + # Create the plot and configure the axes + self.fig, self.ax = plt.subplots() + self.fig.canvas.manager.set_window_title(window_title) + self.ax.set_xlim([self.x_min, self.x_max]) + self.ax.set_ylim([self.y_max, self.y_min]) + + # Set up grid lines and hide major tick labels + self.ax.set_xticks(self.x_bins) + self.ax.set_yticks(self.y_bins[::-1]) + self.ax.set_xticklabels([]) # Hide X-axis major tick labels + self.ax.set_yticklabels([]) # Hide Y-axis major tick labels + + # Set minor tick labels at bin centers + self.ax.set_xticks(self.x_bin_centers, minor=True) + self.ax.set_yticks(self.y_bin_centers[::-1], minor=True) + self.ax.set_xticklabels([f"{x:.2f}" for x in self.x_bin_centers], minor=True) + self.ax.set_yticklabels([f"{y:.2f}" for y in self.y_bin_centers[::-1]], minor=True) + + # Configure grid lines and labels + self.ax.grid(True, color="black", linestyle="-", linewidth=1.5) + self.ax.set_title(window_title) + self.ax.set_xlabel(self.xlabel) + self.ax.set_ylabel(self.ylabel) + plt.ion() + plt.show(block=False) + + # Initialize cells with provided mask_xy + self.clicked_cells = self.initialize_cells() + + # Connect mouse events to handlers + self.fig.canvas.mpl_connect("button_press_event", self.on_press) + self.fig.canvas.mpl_connect("button_release_event", self.on_release) + self.fig.canvas.mpl_connect("motion_notify_event", self.on_motion) + + def initialize_cells(self): + clicked_cells = {} + for x_bin in range(self.num_bins_x): + for y_bin in range(self.num_bins_y): + cell_x = self.x_bin_centers[x_bin] + cell_y = self.y_bin_centers[y_bin] + if self.mask_xy[x_bin, y_bin] == 1: + rect = patches.Rectangle( + ( + cell_x - (self.x_bins[1] - self.x_bins[0]) / 2, + cell_y - (self.y_bins[1] - self.y_bins[0]) / 2, + ), + self.x_bins[1] - self.x_bins[0], + self.y_bins[1] - self.y_bins[0], + linewidth=1, + edgecolor="yellowgreen", + facecolor="yellowgreen", + ) + self.ax.add_patch(rect) + clicked_cells[(cell_x, cell_y)] = rect + + text = self.ax.text( + cell_x, + cell_y, + str(self.default_number), + ha="center", + va="center", + fontsize=10, + color="black", + ) + self.text_objects[(cell_x, cell_y)] = text + else: + rect = None + + return clicked_cells + + def on_press(self, event): + self.dragging = True + self.toggle_select_mode(event) + self.update_cell(event) + + def on_release(self, event): + self.dragging = False + + def on_motion(self, event): + if self.dragging: + self.update_cell(event) + + def toggle_select_mode(self, event): + _, _, cell_center = self.get_cell_from_event(event) + if cell_center is not None: + self.select_mode = cell_center not in self.clicked_cells + + def get_cell_from_event(self, event): + if event.xdata is None or event.ydata is None: + return None, None, None + + x_bin = np.digitize(event.xdata, self.x_bins) - 1 + y_bin = np.digitize(event.ydata, self.y_bins) - 1 + + if 0 <= x_bin < self.num_bins_x and 0 <= y_bin < self.num_bins_y: + cell_x = self.x_bin_centers[x_bin] + cell_y = self.y_bin_centers[y_bin] + cell_center = (cell_x, cell_y) + return x_bin, y_bin, cell_center + else: + return None, None, None + + def update_cell(self, event): + x_bin, y_bin, cell_center = self.get_cell_from_event(event) + if cell_center is None: + return + + if self.select_mode: + if cell_center not in self.clicked_cells: + # Add the rectangle and text + rect = patches.Rectangle( + ( + cell_center[0] - (self.x_bins[1] - self.x_bins[0]) / 2, + cell_center[1] - (self.y_bins[1] - self.y_bins[0]) / 2, + ), + self.x_bins[1] - self.x_bins[0], + self.y_bins[1] - self.y_bins[0], + linewidth=1, + edgecolor="yellowgreen", + facecolor="yellowgreen", + ) + self.ax.add_patch(rect) + text = self.ax.text( + cell_center[0], + cell_center[1], + str(self.default_number), + ha="center", + va="center", + fontsize=10, + color="black", + ) + self.text_objects[cell_center] = text + self.clicked_cells[cell_center] = rect + self.mask_xy[x_bin, y_bin] = 1 + else: + if cell_center in self.clicked_cells: + # Remove the rectangle + self.clicked_cells[cell_center].remove() + del self.clicked_cells[cell_center] + + # Remove the text + # if cell_center in self.text_objects: + self.text_objects[cell_center].remove() + del self.text_objects[cell_center] + + # Update the mask + self.mask_xy[x_bin, y_bin] = 0 + + # Update the plot + self.fig.canvas.draw_idle() + + +def load_config_from_yaml(file_path): + if not os.path.exists(file_path): + raise FileNotFoundError(f"YAML file '{file_path}' not found.") + with open(file_path, "r") as file: + try: + return yaml.safe_load(file) + except yaml.YAMLError as e: + raise ValueError(f"Error parsing YAML file '{file_path}': {e}") + + +def load_mask_from_txt(file_path): + try: + mask = np.loadtxt(file_path, dtype=int) + print(f"Loaded mask from {file_path}:") + return mask + except Exception as e: + print(f"Error loading file {file_path}: {e}") + return None + + +def main(): + shutdown_event = threading.Event() + + def handle_shutdown(sig_num, frame): + shutdown_event.set() + + signal.signal(signal.SIGINT, handle_shutdown) + + # Load configuration from YAML + config = load_config_from_yaml("../../config/common_param.yaml")["/**"]["ros__parameters"] + + MASK_NAME = config["MASK_NAME"] + directory_path = "../../config/masks/" + MASK_NAME + os.makedirs(directory_path, exist_ok=True) + + NUM_BINS_V = config["NUM_BINS_V"] + NUM_BINS_STEER = config["NUM_BINS_STEER"] + NUM_BINS_A = config["NUM_BINS_A"] + NUM_BINS_STEER_RATE = config["NUM_BINS_ABS_STEER_RATE"] + + V_MIN = config["V_MIN"] + V_MAX = config["V_MAX"] + STEER_MIN = config["STEER_MIN"] + STEER_MAX = config["STEER_MAX"] + A_MIN = config["A_MIN"] + A_MAX = config["A_MAX"] + ABS_STEER_RATE_MIN = config["ABS_STEER_RATE_MIN"] + ABS_STEER_RATE_MAX = config["ABS_STEER_RATE_MAX"] + + VEL_ACC_THRESHOLD = config["VEL_ACC_THRESHOLD"] + VEL_STEER_THRESHOLD = config["VEL_STEER_THRESHOLD"] + VEL_ABS_STEER_RATE_THRESHOLD = config["VEL_ABS_STEER_RATE_THRESHOLD"] + + # Create 3 instances of the selector with different configurations + mask_velocity_acceleration_path = os.path.join( + directory_path, f"{MASK_NAME}_Velocity_Acceleration.txt" + ) + mask_velocity_acceleration = load_mask_from_txt(mask_velocity_acceleration_path) + selector1 = DataCollectingMaskSelector( + window_title="Velocity-Acceleration Mask", + x_min=V_MIN, + x_max=V_MAX, + y_min=A_MIN, + y_max=A_MAX, + num_bins_x=NUM_BINS_V, + num_bins_y=NUM_BINS_A, + default_number=VEL_ACC_THRESHOLD, + xlabel="Velocity (m/s)", + ylabel="Acceleration (m/s^2)", + mask_xy=mask_velocity_acceleration, + ) + + mask_velocity_steering_path = os.path.join(directory_path, f"{MASK_NAME}_Velocity_Steering.txt") + mask_velocity_steer = load_mask_from_txt(mask_velocity_steering_path) + selector2 = DataCollectingMaskSelector( + window_title="Velocity-Steering Mask", + x_min=V_MIN, + x_max=V_MAX, + y_min=STEER_MIN, + y_max=STEER_MAX, + num_bins_x=NUM_BINS_V, + num_bins_y=NUM_BINS_STEER, + default_number=VEL_STEER_THRESHOLD, + xlabel="Velocity (m/s)", + ylabel="Steering Angle (rad)", + mask_xy=mask_velocity_steer, + ) + + mask_velocity_steering_rate_path = os.path.join( + directory_path, f"{MASK_NAME}_Velocity_Steering_Rate.txt" + ) + mask_velocity_steering_rate = load_mask_from_txt(mask_velocity_steering_rate_path) + selector3 = DataCollectingMaskSelector( + window_title="Velocity-Steering Rate Mask", + x_min=V_MIN, + x_max=V_MAX, + y_min=ABS_STEER_RATE_MIN, + y_max=ABS_STEER_RATE_MAX, + num_bins_x=NUM_BINS_V, + num_bins_y=NUM_BINS_STEER_RATE, + default_number=VEL_ABS_STEER_RATE_THRESHOLD, + xlabel="Velocity (m/s)", + ylabel="Abs Steering Rate (rad/s)", + mask_xy=mask_velocity_steering_rate, + ) + + print("Press Ctrl+C to save Masks and exit.") + + # Set window positions + try: + selector1.fig.canvas.manager.window.wm_geometry("+100+100") + selector2.fig.canvas.manager.window.wm_geometry("+800+100") + selector3.fig.canvas.manager.window.wm_geometry("+1500+100") + except AttributeError: + print("Warning: Unable to set window position. Backend may not support it.") + + def update_loop(selector): + while not shutdown_event.is_set(): + time.sleep(selector.grid_update_time_interval) + + threads = [ + threading.Thread(target=update_loop, args=(selector,), daemon=True) + for selector in [selector1, selector2, selector3] + ] + for thread in threads: + thread.start() + + try: + while not shutdown_event.is_set(): + plt.pause(0.01) + finally: + np.savetxt(mask_velocity_acceleration_path, selector1.mask_xy, fmt="%d") + print("Saved Velocity-Acceleration Mask to", mask_velocity_acceleration_path) + np.savetxt( + os.path.join(directory_path, f"{MASK_NAME}_Velocity_Steering.txt"), + selector2.mask_xy, + fmt="%d", + ) + print("Saved Velocity-Steering Mask to", mask_velocity_steering_path) + np.savetxt( + os.path.join(directory_path, f"{MASK_NAME}_Velocity_Steering_Rate.txt"), + selector3.mask_xy, + fmt="%d", + ) + print("Saved Velocity-Steering Rate Mask to", mask_velocity_steering_rate_path) + print("Exiting program.") + + +if __name__ == "__main__": + main() diff --git a/control_data_collecting_tool/src/data_collecting_area_selection.cpp b/control_data_collecting_tool/src/data_collecting_area_selection.cpp index 50d75c15..02dd3b4f 100644 --- a/control_data_collecting_tool/src/data_collecting_area_selection.cpp +++ b/control_data_collecting_tool/src/data_collecting_area_selection.cpp @@ -23,6 +23,8 @@ #include +#include + using std::placeholders::_1; namespace rviz_plugins diff --git a/docs/assets/js/mathjax.js b/docs/assets/js/mathjax.js new file mode 100644 index 00000000..adb184a8 --- /dev/null +++ b/docs/assets/js/mathjax.js @@ -0,0 +1,20 @@ +// This file is automatically synced from: +// https://github.com/autowarefoundation/sync-file-templates +// To make changes, update the source repository and follow the guidelines in its README. + +window.MathJax = { + tex: { + inlineMath: [["\\(", "\\)"]], + displayMath: [["\\[", "\\]"]], + processEscapes: true, + processEnvironments: true, + }, + options: { + ignoreHtmlClass: ".*|", + processHtmlClass: "arithmatex", + }, +}; + +document$.subscribe(() => { + MathJax.typesetPromise(); +}); diff --git a/driving_environment_analyzer/package.xml b/driving_environment_analyzer/package.xml index 6f34177d..4304fe66 100644 --- a/driving_environment_analyzer/package.xml +++ b/driving_environment_analyzer/package.xml @@ -17,6 +17,7 @@ autoware_adapi_v1_msgs autoware_behavior_path_planner_common autoware_lane_departure_checker + autoware_lanelet2_extension autoware_motion_utils autoware_perception_msgs autoware_planning_msgs @@ -25,7 +26,6 @@ autoware_universe_utils autoware_vehicle_msgs geometry_msgs - lanelet2_extension libboost-dev libqt5-core libqt5-gui diff --git a/driving_environment_analyzer/src/utils.cpp b/driving_environment_analyzer/src/utils.cpp index b895b960..79e0714f 100644 --- a/driving_environment_analyzer/src/utils.cpp +++ b/driving_environment_analyzer/src/utils.cpp @@ -16,15 +16,18 @@ #include "autoware/motion_utils/trajectory/trajectory.hpp" -#include -#include -#include +#include +#include +#include #include #include +#include +#include #include #include +#include #include namespace driving_environment_analyzer::utils diff --git a/evaluation/tier4_metrics_rviz_plugin/src/metrics_visualize_panel.cpp b/evaluation/tier4_metrics_rviz_plugin/src/metrics_visualize_panel.cpp index 1104d26e..68cea462 100644 --- a/evaluation/tier4_metrics_rviz_plugin/src/metrics_visualize_panel.cpp +++ b/evaluation/tier4_metrics_rviz_plugin/src/metrics_visualize_panel.cpp @@ -21,8 +21,10 @@ #include #include +#include #include #include +#include #include namespace rviz_plugins diff --git a/localization/deviation_estimation_tools/ReadMe.md b/localization/deviation_estimation_tools/ReadMe.md index df26f2e2..5c1e4567 100644 --- a/localization/deviation_estimation_tools/ReadMe.md +++ b/localization/deviation_estimation_tools/ReadMe.md @@ -2,7 +2,7 @@ ## 1. Quick start -This repository consists of three main tools implemented on ROS2. +This repository consists of three main tools implemented on ROS 2. 1. Deviation Estimator 2. Deviation Evaluator diff --git a/localization/deviation_estimation_tools/deviation_estimator/src/deviation_estimator_main.cpp b/localization/deviation_estimation_tools/deviation_estimator/src/deviation_estimator_main.cpp index f53a3c4e..59f7329e 100644 --- a/localization/deviation_estimation_tools/deviation_estimator/src/deviation_estimator_main.cpp +++ b/localization/deviation_estimation_tools/deviation_estimator/src/deviation_estimator_main.cpp @@ -18,6 +18,13 @@ #include #include +#include +#include +#include +#include +#include +#include + int main(int argc, char ** argv) { if (argc != 2) { diff --git a/localization/deviation_estimation_tools/deviation_estimator/src/gyro_bias_module.cpp b/localization/deviation_estimation_tools/deviation_estimator/src/gyro_bias_module.cpp index 9c87709c..892021e2 100644 --- a/localization/deviation_estimation_tools/deviation_estimator/src/gyro_bias_module.cpp +++ b/localization/deviation_estimation_tools/deviation_estimator/src/gyro_bias_module.cpp @@ -17,6 +17,8 @@ #include "autoware/universe_utils/geometry/geometry.hpp" #include "deviation_estimator/utils.hpp" +#include + /** * @brief update gyroscope bias based on a given trajectory data */ diff --git a/localization/deviation_estimation_tools/deviation_estimator/src/logger.cpp b/localization/deviation_estimation_tools/deviation_estimator/src/logger.cpp index e3d8d3fd..2c69e5a6 100644 --- a/localization/deviation_estimation_tools/deviation_estimator/src/logger.cpp +++ b/localization/deviation_estimation_tools/deviation_estimator/src/logger.cpp @@ -15,6 +15,8 @@ #include "deviation_estimator/logger.hpp" #include +#include +#include /** * @brief constructor for Logger class diff --git a/localization/deviation_estimation_tools/deviation_estimator/src/validation_module.cpp b/localization/deviation_estimation_tools/deviation_estimator/src/validation_module.cpp index 7c089bc7..d81ca400 100644 --- a/localization/deviation_estimation_tools/deviation_estimator/src/validation_module.cpp +++ b/localization/deviation_estimation_tools/deviation_estimator/src/validation_module.cpp @@ -14,6 +14,12 @@ #include "deviation_estimator/validation_module.hpp" +#include +#include +#include +#include +#include + /** * @brief ValidationModule validates if estimated parameters are properly converged, given a * predefined threshold in this constructor arguments diff --git a/localization/deviation_estimation_tools/deviation_estimator/test/test_gyro_bias.cpp b/localization/deviation_estimation_tools/deviation_estimator/test/test_gyro_bias.cpp index 5f9401a7..6637378e 100644 --- a/localization/deviation_estimation_tools/deviation_estimator/test/test_gyro_bias.cpp +++ b/localization/deviation_estimation_tools/deviation_estimator/test/test_gyro_bias.cpp @@ -18,6 +18,7 @@ #include #include +#include TEST(DeviationEstimatorGyroBias, SmokeTestDefault) { diff --git a/localization/deviation_estimation_tools/deviation_evaluator/launch/deviation_evaluator.launch.xml b/localization/deviation_estimation_tools/deviation_evaluator/launch/deviation_evaluator.launch.xml index 90a2e312..5c5a989b 100644 --- a/localization/deviation_estimation_tools/deviation_evaluator/launch/deviation_evaluator.launch.xml +++ b/localization/deviation_estimation_tools/deviation_evaluator/launch/deviation_evaluator.launch.xml @@ -59,7 +59,7 @@ - + diff --git a/map/autoware_lanelet2_map_utils/src/fix_lane_change_tags.cpp b/map/autoware_lanelet2_map_utils/src/fix_lane_change_tags.cpp index be9ec44a..04170581 100644 --- a/map/autoware_lanelet2_map_utils/src/fix_lane_change_tags.cpp +++ b/map/autoware_lanelet2_map_utils/src/fix_lane_change_tags.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include diff --git a/map/autoware_lanelet2_map_utils/src/fix_z_value_by_pcd.cpp b/map/autoware_lanelet2_map_utils/src/fix_z_value_by_pcd.cpp index faedd513..31f11195 100644 --- a/map/autoware_lanelet2_map_utils/src/fix_z_value_by_pcd.cpp +++ b/map/autoware_lanelet2_map_utils/src/fix_z_value_by_pcd.cpp @@ -24,6 +24,8 @@ #include #include +#include +#include #include #include diff --git a/map/autoware_lanelet2_map_utils/src/merge_close_lines.cpp b/map/autoware_lanelet2_map_utils/src/merge_close_lines.cpp index e963ff88..1196453c 100644 --- a/map/autoware_lanelet2_map_utils/src/merge_close_lines.cpp +++ b/map/autoware_lanelet2_map_utils/src/merge_close_lines.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include diff --git a/map/autoware_lanelet2_map_utils/src/merge_close_points.cpp b/map/autoware_lanelet2_map_utils/src/merge_close_points.cpp index 46ced8a2..5d84d171 100644 --- a/map/autoware_lanelet2_map_utils/src/merge_close_points.cpp +++ b/map/autoware_lanelet2_map_utils/src/merge_close_points.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include diff --git a/map/autoware_lanelet2_map_utils/src/remove_unreferenced_geometry.cpp b/map/autoware_lanelet2_map_utils/src/remove_unreferenced_geometry.cpp index 9333afa3..cacb7527 100644 --- a/map/autoware_lanelet2_map_utils/src/remove_unreferenced_geometry.cpp +++ b/map/autoware_lanelet2_map_utils/src/remove_unreferenced_geometry.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include diff --git a/map/autoware_lanelet2_map_utils/src/transform_maps.cpp b/map/autoware_lanelet2_map_utils/src/transform_maps.cpp index 59f1ff3a..2d0ddd98 100644 --- a/map/autoware_lanelet2_map_utils/src/transform_maps.cpp +++ b/map/autoware_lanelet2_map_utils/src/transform_maps.cpp @@ -24,6 +24,7 @@ #include #include +#include #include #include diff --git a/map/autoware_lanelet2_map_validator/CMakeLists.txt b/map/autoware_lanelet2_map_validator/CMakeLists.txt index 339c3a38..36776605 100644 --- a/map/autoware_lanelet2_map_validator/CMakeLists.txt +++ b/map/autoware_lanelet2_map_validator/CMakeLists.txt @@ -32,39 +32,34 @@ target_link_libraries(autoware_lanelet2_map_validator ) if(BUILD_TESTING) - find_package(ament_index_cpp REQUIRED) + file(GLOB_RECURSE test_src "test/src/test_*.cpp") + ament_auto_add_library(autoware_lanelet2_map_validator_test_lib ${test_src}) - # test for json processing - ament_add_ros_isolated_gtest( - json_processing_test - test/src/test_json_processing.cpp - ) + target_include_directories(autoware_lanelet2_map_validator_test_lib PUBLIC + test/src/include + src/include) - target_link_libraries( - json_processing_test + target_link_libraries(autoware_lanelet2_map_validator_test_lib autoware_lanelet2_map_validator_lib - ament_index_cpp::ament_index_cpp ) # test for general lanelet2 map validators - function(add_validation_test VALIDATION_NAME) + function(add_validation_test TEST_FILE) + get_filename_component(TEST_NAME ${TEST_FILE} NAME_WE) + string(REPLACE "test_" "" VALIDATION_NAME ${TEST_NAME}) ament_add_ros_isolated_gtest( ${VALIDATION_NAME}_test - test/src/test_${VALIDATION_NAME}.cpp + ${TEST_FILE} ) target_link_libraries( ${VALIDATION_NAME}_test - autoware_lanelet2_map_validator_lib + autoware_lanelet2_map_validator_test_lib ) endfunction() - add_validation_test(missing_regulatory_elements_for_stop_lines) - add_validation_test(missing_regulatory_elements_for_crosswalks) - add_validation_test(missing_regulatory_elements_for_traffic_lights) - add_validation_test(regulatory_elements_details_for_crosswalks) - add_validation_test(regulatory_elements_details_for_traffic_lights) - add_validation_test(traffic_light_facing) - add_validation_test(missing_referrers_for_traffic_lights) + foreach(TEST_FILE ${test_src}) + add_validation_test(${TEST_FILE}) + endforeach() endif() ament_auto_package( diff --git a/map/autoware_lanelet2_map_validator/README.md b/map/autoware_lanelet2_map_validator/README.md index daa8706c..f1b2833f 100644 --- a/map/autoware_lanelet2_map_validator/README.md +++ b/map/autoware_lanelet2_map_validator/README.md @@ -287,6 +287,10 @@ The directory structure should be the same to that of the `src/validators` direc - [mapping.crosswalk.missing_regulatory_elements](./docs/crosswalk/missing_regulatory_elements_for_crosswalk.md) - [mapping.crosswalk.regulatory_element_details](./docs/crosswalk/regulatory_element_details_for_crosswalks.md) +## How to add a new validator + +If you want to contribute to `autoware_lanelet2_map_validator`, please check out the [how_to_contribute](./docs/how_to_contribute.md) first. + ## Relationship between requirements and validators This is a table describing the correspondence between the validators that each requirement consists of. @@ -315,14 +319,14 @@ The "Validators" column will be blank if it hasn't be implemented. | vm-01-19 | Walkway | | | vm-02-01 | Stop line alignment | (Not detectable) | | vm-02-02 | Stop sign | [mapping.stop_line.missing_regulatory_elements](./docs/stop_line/missing_regulatory_elements_for_stop_lines.md) | -| vm-03-01 | Intersection criteria | | +| vm-03-01 | Intersection criteria | [mapping.intersection.intersection_area_dangling_reference](./docs/intersection/intersection_area_dangling_reference.md) | | vm-03-02 | Lanelet's turn direction and virtual | | | vm-03-03 | Lanelet width in the intersection | | | vm-03-04 | Lanelet creation in the intersection | | | vm-03-05 | Lanelet division in the intersection | | | vm-03-06 | Guide lines in the intersection | | | vm-03-07 | Multiple lanelets in the intersection | | -| vm-03-08 | Intersection Area range | | +| vm-03-08 | Intersection Area range | [mapping.intersection.intersection_area_validity](./docs/intersection/intersection_area_validity.md), [mapping.intersection.intersection_area_segment_type](./docs/intersection/intersection_area_segment_type.md) | | vm-03-09 | Range of Lanelet in the intersection | | | vm-03-10 | Right of way (with signal) | | | vm-03-11 | Right of way (without signal) | | diff --git a/map/autoware_lanelet2_map_validator/autoware_requirement_set.json b/map/autoware_lanelet2_map_validator/autoware_requirement_set.json index 917993cb..4b8566f7 100644 --- a/map/autoware_lanelet2_map_validator/autoware_requirement_set.json +++ b/map/autoware_lanelet2_map_validator/autoware_requirement_set.json @@ -8,6 +8,25 @@ } ] }, + { + "id": "vm-03-01", + "validators": [ + { + "name": "mapping.intersection.intersection_area_dangling_reference" + } + ] + }, + { + "id": "vm-03-08", + "validators": [ + { + "name": "mapping.intersection.intersection_area_validity" + }, + { + "name": "mapping.intersection.intersection_area_segment_type" + } + ] + }, { "id": "vm-04-01", "validators": [ diff --git a/map/autoware_lanelet2_map_validator/docs/how_to_contribute.md b/map/autoware_lanelet2_map_validator/docs/how_to_contribute.md new file mode 100644 index 00000000..8f097c10 --- /dev/null +++ b/map/autoware_lanelet2_map_validator/docs/how_to_contribute.md @@ -0,0 +1,120 @@ +# How to contribute to `autoware_lanelet2_map_validator` + +Your contribution is welcome to achieve a broad view of validation for lanelet2 maps. +This document gives you the instructions on how to add a validator to `autoware_lanelet2_map_validator`. +Please take a look at the [Design Concept](#design-concept) and follow the [Contribution Guide](#contribution-guide). + +## Design Concept + +The main goal of `autoware_lanelet2_map_validator` is to validate whether the lanelet2 map matches the vector map requirements for Autoware. +`autoware_lanelet2_map_validator` achieves this by running a list of small validators. +In other words, each vector map requirement will be validated by one or more validators. +It is recommended to keep validators small and they don't have to be unique to a specific requirement so that we can broaden the expression of map requirements. (It doesn't mean that a validator should output only one kind of error!) + +The list of small validators will be defined as a JSON file (see [`autoware_requirement_set.json`](https://github.com/autowarefoundation/autoware_tools/blob/main/map/autoware_lanelet2_map_validator/autoware_requirement_set.json) for an example), and the output will also be a JSON file that appends validation results to a copy of the input. See [How to use `autoware_lanelet2_map_validator`](https://github.com/autowarefoundation/autoware_tools/tree/main/map/autoware_lanelet2_map_validator#how-to-use) for further information about how the input and output are processed. + +![autoware_lanelet2_map_validator_input_and_output](../media/autoware_lanelet2_map_validator_io.svg) + +Please note that the validators are categorized according to [the vector map requirements written in the Autoware Documentation](https://autowarefoundation.github.io/autoware-documentation/main/design/autoware-architecture/map/map-requirements/vector-map-requirements-overview/). If there are any suggestions for new categories please let the pull request (PR) reviewers know. The available categories as of now are + +- Lane +- Stop line +- Intersection +- Traffic light +- Crosswalk +- Area +- Others + +## Contribution Guide + +This section is aimed at contributors who want to add their own validators. If you want to change the core process of `autoware_lanelet2_map_validator`, please open a PR and discuss it with the maintainers. + +### 1. Implement your validator + + + +`autoware_lanelet2_map_validator` is based on the [Lanelet2 library provided by fzi-forschungszentrum-informatik](https://github.com/fzi-forschungszentrum-informatik/Lanelet2). + + + +Contributors are encouraged to make their validators by following the class structure shown in [`validator_template.cpp`](https://github.com/autowarefoundation/autoware_tools/blob/main/map/autoware_lanelet2_map_validator/src/validators/validator_template.cpp) and [`validator_template.hpp`](https://github.com/autowarefoundation/autoware_tools/blob/main/map/autoware_lanelet2_map_validator/src/validators/validator_template.hpp). Looking at other implementations may also be helpful. + +#### Restrictions for path structure + +- The source file (`.cpp`) must belong to `src/validators/\/` +- Avoid source file names that are the same as those in other categories. +- The header file (`.hpp`) must belong to `src/include/lanelet2_map_validator/validators/\/` +- Currently, there are no naming rules for source and header files, but the pair of source and header files should have the same name. + +#### Restrictions for validator class implementation + +- Define the name of the validator in the header file (`.hpp` file). + - The name must follow the structure `aaa.bbb.ccc` + - The first part (`aaa`) must be either `mapping`, `routing` or `rule` + - The second part (`bbb`) should be either `general`, `lane`, `stop_line`, `intersection`, `traffic_light`, `crosswalk`, `area`, `others`. + - The third part can be anything, as long as it is not hard to recognize the validator's feature. + - The issue code of the validator will be generated from this name. It removes the first part of the name, converts it to upper camel case, and adds a number for classification. (e. g. `Bbb.Ccc-001`) +- Write your implementation in the `operator()` function that outputs an [Issues (a.k.a vector\) object](https://github.com/fzi-forschungszentrum-informatik/Lanelet2/blob/master/lanelet2_validation/include/lanelet2_validation/Issue.h). Not all of the implementation has to be written in the operator; you can privately define and use functions in your validator class. +- Since `autoware_lanelet2_map_validator` outputs issue codes, please add an issue code prefix with square brackets on top of your issue message. + - You may use the `append_issue_code_prefix` function to generate the issue code prefix. + - Even if the validator only detects a single type of issue, please include the number `001` to your issue code. + - The issue code must correspond to the issue message one-to-one. +- Currently, there are no rules to decide the severity of the issue. If you're not confident about your severity decisions please discuss them with your PR reviewers. +- Other coding rules are mentioned in the [Autoware Documentation](https://autowarefoundation.github.io/autoware-documentation/main/contributing/). However, this coding rule doesn't hold if it conflicts with the Lanelet2 library. + +### 2. Write a test code + +Contributors must also provide test codes to ensure your validator is working properly and be able to be tested again when changes occur to the validator in the future. + +#### Restrictions for path structure + +- The source code (`.cpp`) must belong to `test/src/`. + - The test codes are not categorized because there are few codes, but they might be categorized in the future. +- The source code name should be `test_.cpp` +- The maps (`.osm`) for testing must belong to `test/data/map/\/` +- The JSON files (`.json`) for testing must belong to `test/data/json/` + +#### Restrictions for test code implementation + +- Tests should be executable by `colcon test`. It is strongly recommended to use the [gtest (googletest) format](https://github.com/google/googletest). +- If possible, the `MapValidationTester` class may be useful to inherit common map loading process. +- The test code must contain the following. + - A test function that checks whether the validator is available. + - A test function for each unique issue the validator can detect. It is recommended to create a small lanelet2 map for each unique issue. + - In this test, please also check that the issue code is emitted as expected. + - A test function ensuring that no issues occur when validating `test/data/map/sample_map.osm`. If `sample_map.osm` violates the validation or doesn't contain the primitive to validate, please fix or add the primitives to it. +- Add the test code to `CMakeLists.txt` using the `add_validation_test` function. + - Currently, this part must be added to CMakeLists.txt manually. Automation is expected in the future. + +### 3. Test the entire validator + +Please check that the `autoware_lanelet2_map_validator` works perfectly. + +1. Execute `colcon test --packages-select autoware_lanelet2_map_validator --event-handlers console_cohesion+` and confirm that all tests pass. +2. Execute the following command and confirm that no issues appear. + +```bash +ros2 run autoware_lanelet2_map_validator autoware_lanelet2_map_validator -p mgrs -m -i -o ./ +``` + +### 4. Write a document + +Contributors must provide documentation to explain what the validator can do. +The document must explain the following. + +- The validator's name +- Feature of the validator +- The source code where the validator is implemented +- A table of issues that the validator can detect. The following details are required. + - Issue Code + - Message + - Severity + - Primitive + - Description of the issue + - Approach to fix the issue + +In addition, add a link of the document to the table [Relationship between requirements and validators](https://github.com/autowarefoundation/autoware_tools/tree/main/map/autoware_lanelet2_map_validator#relationship-between-requirements-and-validators) in the main `README.md` to let the users know which map requirement your validator relates with. + +### 5. Submit a pull request + +Submit a pull request to the [autowarefoundation/autoware_tools](https://github.com/autowarefoundation/autoware_tools) repository. diff --git a/map/autoware_lanelet2_map_validator/docs/intersection/intersection_area_dangling_reference.md b/map/autoware_lanelet2_map_validator/docs/intersection/intersection_area_dangling_reference.md new file mode 100644 index 00000000..ab77f8e6 --- /dev/null +++ b/map/autoware_lanelet2_map_validator/docs/intersection/intersection_area_dangling_reference.md @@ -0,0 +1,27 @@ +# intersection_area_dangling_reference + +## Validator name + +mapping.intersection.intersection_area_dangling_reference + +## Feature + +This validator checks whether each intersection lanelet(namely the lanelet with `turn_direction` property) has reference to existing `intersection_area` polygon. Such invalid case occurs when an intersection_area is deleted but its referrers are not updated. + +This is achieved by the following procedure. + +1. Obtain the set of `intersection_area` polygon IDs +2. Check if intersection lanelet has "intersection_area" key and its value is contained in the above IDs + +The validator outputs the following issue with the corresponding ID of the primitive. + +| Issue Code | Message | Severity | Primitive | Description | Approach | +| -------------------------------------------------- | --------------------------------------------------------------------------------------- | -------- | --------- | -------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | +| Intersection.IntersectionAreaDanglingReference-001 | "Dangling reference to non-existing intersection area of ID \ is detected" | Error | Lanelet | The reported lanelet will cause a runtime error when attempting to look up the non-existent intersection_area. | Go to the reported lanelet and delete "intersection_area" key entry. | + +### Supplementary information + +## Related source codes + +- intersection_area_dangling_reference.hpp +- intersection_area_dangling_reference.cpp diff --git a/map/autoware_lanelet2_map_validator/docs/intersection/intersection_area_segment_type.md b/map/autoware_lanelet2_map_validator/docs/intersection/intersection_area_segment_type.md new file mode 100644 index 00000000..980a2607 --- /dev/null +++ b/map/autoware_lanelet2_map_validator/docs/intersection/intersection_area_segment_type.md @@ -0,0 +1,31 @@ +# intersection_area_segment_type + +## Validator name + +mapping.intersection.intersection_area_segment_type + +## Feature + +This validator check whether each `intersection_area` type polygon is made from points that belong to `road_border` type linestrings or the starting/ending edge of a lanelet. + +This is achieved by the following procedure. + +1. Create a 2D bounding box that circumscribes the polygon. +2. Collect `road_border` type linestrings within or intersecting the 2D bounding box. +3. Collect starting/ending edges of lanelets within or intersecting the 2D bounding box. +4. Examine each point that constitutes the polygon whether it belongs to the collection above. + +The validator outputs the following issue with the corresponding ID of the primitive. + +| Issue Code | Message | Severity | Primitive | Description | Approach | +| -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | -------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| Intersection.IntersectionAreaSegmentType-001 | "This intersection area is not made by points from road_border linestrings or lanelet edges. (Point ID: \)" | Error | Polygon | The `intersection_area` polygon has points that doesn't belong to `road_border` type linestrings or lanelet edges. The violating points are listed up at \. | Ensure that the `intersection_area` is formed ONLY by `road_border` linestrings and lanelet edges. | + +### Supplementary information + +Note that this validator only examines what type of linestring the points constituting the polygon belongs to, and doesn't examine they have a valid connection. Use the `mapping.intersection.intersection_area_validity` to check whether the polygon is `boost::geometry::is_valid()`. + +## Related source codes + +- intersection_area_segment_type.hpp +- intersection_area_segment_type.cpp diff --git a/map/autoware_lanelet2_map_validator/docs/intersection/intersection_area_validity.md b/map/autoware_lanelet2_map_validator/docs/intersection/intersection_area_validity.md new file mode 100644 index 00000000..fd0eb7fe --- /dev/null +++ b/map/autoware_lanelet2_map_validator/docs/intersection/intersection_area_validity.md @@ -0,0 +1,20 @@ +# intersection_area_validity + +## Validator name + +mapping.intersection.intersection_area_validity + +## Feature + +This validator check whether each `intersection_area` type polygon satisfies [`boost::geometry::is_valid`](https://www.boost.io/doc/libs/1_86_0/libs/geometry/doc/html/geometry/reference/algorithms/is_valid/is_valid_2_with_message.html). + +The validator outputs the following issue with the corresponding ID of the primitive. + +| Issue Code | Message | Severity | Primitive | Description | Approach | +| ----------------------------------------- | --------------------------------------------------------------------------------------- | -------- | --------- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Intersection.IntersectionAreaValidity-001 | "This intersection_area doesn't satisfy boost::geometry::is_valid (reason: \) | Error | Polygon | The `intersection_area` polygon didn't satisfy `boost::geometry::is_valid`. | There are several reasons expected and it is written in "(reason: \)". The \ is a copy of [the output message defined in the `boost::geometry` library](https://www.boost.org/doc/libs/1_86_0/boost/geometry/policies/is_valid/failing_reason_policy.hpp). | + +## Related source codes + +- intersection_area_validity.hpp +- intersection_area_validity.cpp diff --git a/map/autoware_lanelet2_map_validator/media/autoware_lanelet2_map_validator_io.svg b/map/autoware_lanelet2_map_validator/media/autoware_lanelet2_map_validator_io.svg new file mode 100644 index 00000000..5d9f36cc --- /dev/null +++ b/map/autoware_lanelet2_map_validator/media/autoware_lanelet2_map_validator_io.svg @@ -0,0 +1,385 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + [vm-02-02] + +
+
+
+
    +
  • mapping.stop_line.missing_regulatory_element
  • +
+
+ + [vm-04-01] + +
+
    +
  • mapping.traffic_light.missing_regulatory_elements
  • +
  • mapping.traffic_light.missing_referrers
  • +
  • mapping.traffic_light.regulatory_element_details
  • +
+
+ + [vm-04-02] + +
+
+
    +
  • mapping.traffic_light.correct_facing
  • +
+
+ ... and so on +
+
+
+
+
+
+
+
+
+ +
+
+
+
+ + + + + + + + +
+
+
+ + autoware_requirement_set.json + +
+
+
+
+ +
+
+
+
+ + + + + + + + +
+
+
+ + ID for the map requirement + +
+
+
+
+ +
+
+
+
+ + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + +
+
+
+ autoware_lanelet2_map_validator +
+
+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + +
+
+
+ + validation_target_map.osm + +
+
+
+
+ +
+
+
+
+ + + + + + + + + + +
+
+
+ + lanelet2_validation_results.json + +
+
+
+
+ +
+
+
+
+ + + + + + +
+ + + + + + + + +
+
+
+ A validator is deployed for each map requirement +
+
+
+
+ +
+
+
+
+ + + + + + + + +
+
+
+ ... or a group of validators can be allocated to a requirement if there are many things to validate +
+
+
+
+ +
+
+
+
+ + + + + + +
+
+
+
diff --git a/map/autoware_lanelet2_map_validator/src/common/cli.cpp b/map/autoware_lanelet2_map_validator/src/common/cli.cpp index 6b130231..27658b9d 100644 --- a/map/autoware_lanelet2_map_validator/src/common/cli.cpp +++ b/map/autoware_lanelet2_map_validator/src/common/cli.cpp @@ -14,6 +14,9 @@ #include "lanelet2_map_validator/cli.hpp" +#include +#include + namespace po = boost::program_options; namespace lanelet::autoware::validation diff --git a/map/autoware_lanelet2_map_validator/src/common/map_loader.cpp b/map/autoware_lanelet2_map_validator/src/common/map_loader.cpp index 418a1e51..ba941b34 100644 --- a/map/autoware_lanelet2_map_validator/src/common/map_loader.cpp +++ b/map/autoware_lanelet2_map_validator/src/common/map_loader.cpp @@ -17,6 +17,11 @@ #include #include +#include +#include +#include +#include + namespace lanelet::autoware::validation { diff --git a/map/autoware_lanelet2_map_validator/src/common/validation.cpp b/map/autoware_lanelet2_map_validator/src/common/validation.cpp index 71d7f4fc..068ab60b 100644 --- a/map/autoware_lanelet2_map_validator/src/common/validation.cpp +++ b/map/autoware_lanelet2_map_validator/src/common/validation.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -26,6 +27,7 @@ #include #include #include +#include // ANSI color codes for console output #define BOLD_ONLY "\033[1m" @@ -305,7 +307,6 @@ void process_requirements( // Check prerequisites are OK const auto prerequisite_issues = check_prerequisite_completion(validators, validator_name); - appendIssues(total_issues, prerequisite_issues); // NOTE: if prerequisite_issues is not empty, skip the content validation process const auto issues = @@ -313,7 +314,7 @@ void process_requirements( ? apply_validation( lanelet_map, replace_validator( validator_config.command_line_config.validationConfig, validator_name)) - : std::vector(); + : std::move(prerequisite_issues); // Add validation results to the json data json & validator_json = find_validator_block(json_data, validator_name); diff --git a/map/autoware_lanelet2_map_validator/src/include/lanelet2_map_validator/validators/intersection/intersection_area_dangling_reference.hpp b/map/autoware_lanelet2_map_validator/src/include/lanelet2_map_validator/validators/intersection/intersection_area_dangling_reference.hpp new file mode 100644 index 00000000..f9a24c28 --- /dev/null +++ b/map/autoware_lanelet2_map_validator/src/include/lanelet2_map_validator/validators/intersection/intersection_area_dangling_reference.hpp @@ -0,0 +1,51 @@ +// Copyright 2024 Autoware Foundation +// +// 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. + +#ifndef LANELET2_MAP_VALIDATOR__VALIDATORS__INTERSECTION__INTERSECTION_AREA_DANGLING_REFERENCE_HPP_ // NOLINT +#define LANELET2_MAP_VALIDATOR__VALIDATORS__INTERSECTION__INTERSECTION_AREA_DANGLING_REFERENCE_HPP_ // NOLINT + +#include +#include + +#include +#include + +namespace lanelet::autoware::validation +{ +class IntersectionAreaDanglingReferenceValidator : public lanelet::validation::MapValidator +{ +public: + constexpr static const char * name() + { + return "mapping.intersection.intersection_area_dangling_reference"; + } + + lanelet::validation::Issues operator()(const lanelet::LaneletMap & map) override; + +private: + /** + * @brief queries all intersection lanelets and check if their "intersection_area" custom KEY + * entry has existing id as VALUE + * + * @param map + * @return lanelet::validation::Issues + */ + lanelet::validation::Issues check_intersection_area_dangling_reference( + const lanelet::LaneletMap & map); +}; +} // namespace lanelet::autoware::validation + +// clang-format off +#endif // LANELET2_MAP_VALIDATOR__VALIDATORS__INTERSECTION__INTERSECTION_AREA_DANGLING_REFERENCE_HPP_ // NOLINT +// clang-format on diff --git a/map/autoware_lanelet2_map_validator/src/include/lanelet2_map_validator/validators/intersection/intersection_area_segment_type.hpp b/map/autoware_lanelet2_map_validator/src/include/lanelet2_map_validator/validators/intersection/intersection_area_segment_type.hpp new file mode 100644 index 00000000..cd563d43 --- /dev/null +++ b/map/autoware_lanelet2_map_validator/src/include/lanelet2_map_validator/validators/intersection/intersection_area_segment_type.hpp @@ -0,0 +1,67 @@ +// Copyright 2024 Autoware Foundation +// +// 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. + +#ifndef LANELET2_MAP_VALIDATOR__VALIDATORS__INTERSECTION__INTERSECTION_AREA_SEGMENT_TYPE_HPP_ // NOLINT +#define LANELET2_MAP_VALIDATOR__VALIDATORS__INTERSECTION__INTERSECTION_AREA_SEGMENT_TYPE_HPP_ // NOLINT + +#include +#include + +#include +#include + +namespace lanelet::autoware::validation +{ +class IntersectionAreaSegmentTypeValidator : public lanelet::validation::MapValidator +{ +public: + constexpr static const char * name() + { + return "mapping.intersection.intersection_area_segment_type"; + } + + lanelet::validation::Issues operator()(const lanelet::LaneletMap & map) override; + +private: + /** + * @brief The main validation process + * + * @param map + * @return lanelet::validation::Issues + */ + lanelet::validation::Issues check_intersection_area_segment_type(const lanelet::LaneletMap & map); + + /** + * @brief Create a submap consisting of road_border linestrings and lanelet edges only. + * + * @param map + * @param intersection_area + * @return lanelet::LaneletSubmapUPtr + */ + lanelet::LaneletSubmapUPtr create_nearby_borders_submap( + const lanelet::LaneletMap & map, const lanelet::ConstPolygon3d & intersection_area); + + /** + * @brief Create a list-up-string from Ids=vector + * + * @param ids + * @return std::string + */ + std::string ids_to_string(const lanelet::Ids ids); +}; +} // namespace lanelet::autoware::validation + +// clang-format off +#endif // LANELET2_MAP_VALIDATOR__VALIDATORS__INTERSECTION__INTERSECTION_AREA_SEGMENT_TYPE_HPP_ // NOLINT +// clang-format on diff --git a/map/autoware_lanelet2_map_validator/src/include/lanelet2_map_validator/validators/intersection/intersection_area_validity.hpp b/map/autoware_lanelet2_map_validator/src/include/lanelet2_map_validator/validators/intersection/intersection_area_validity.hpp new file mode 100644 index 00000000..708cefab --- /dev/null +++ b/map/autoware_lanelet2_map_validator/src/include/lanelet2_map_validator/validators/intersection/intersection_area_validity.hpp @@ -0,0 +1,37 @@ +// Copyright 2024 Autoware Foundation +// +// 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. + +#ifndef LANELET2_MAP_VALIDATOR__VALIDATORS__INTERSECTION__INTERSECTION_AREA_VALIDITY_HPP_ // NOLINT +#define LANELET2_MAP_VALIDATOR__VALIDATORS__INTERSECTION__INTERSECTION_AREA_VALIDITY_HPP_ // NOLINT + +#include +#include + +namespace lanelet::autoware::validation +{ +class IntersectionAreaValidityValidator : public lanelet::validation::MapValidator +{ +public: + constexpr static const char * name() { return "mapping.intersection.intersection_area_validity"; } + + lanelet::validation::Issues operator()(const lanelet::LaneletMap & map) override; + +private: + lanelet::validation::Issues check_intersection_area_validity(const lanelet::LaneletMap & map); +}; +} // namespace lanelet::autoware::validation + +// clang-format off +#endif // LANELET2_MAP_VALIDATOR__VALIDATORS__INTERSECTION__INTERSECTION_AREA_VALIDITY_HPP_ // NOLINT +// clang-format on diff --git a/map/autoware_lanelet2_map_validator/src/main.cpp b/map/autoware_lanelet2_map_validator/src/main.cpp index 66918b0d..a62c8fe7 100644 --- a/map/autoware_lanelet2_map_validator/src/main.cpp +++ b/map/autoware_lanelet2_map_validator/src/main.cpp @@ -22,6 +22,7 @@ #include #include #include +#include int main(int argc, char * argv[]) { diff --git a/map/autoware_lanelet2_map_validator/src/validators/intersection/intersection_area_dangling_reference.cpp b/map/autoware_lanelet2_map_validator/src/validators/intersection/intersection_area_dangling_reference.cpp new file mode 100644 index 00000000..a3cbeb19 --- /dev/null +++ b/map/autoware_lanelet2_map_validator/src/validators/intersection/intersection_area_dangling_reference.cpp @@ -0,0 +1,91 @@ +// Copyright 2024 Autoware Foundation +// +// 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. + +#include "lanelet2_map_validator/validators/intersection/intersection_area_dangling_reference.hpp" + +#include "lanelet2_map_validator/utils.hpp" + +#include + +#include +#include +#include +#include + +namespace lanelet::autoware::validation +{ + +namespace +{ +lanelet::validation::RegisterMapValidator reg; +} // namespace + +lanelet::validation::Issues IntersectionAreaDanglingReferenceValidator::operator()( + const lanelet::LaneletMap & map) +{ + lanelet::validation::Issues issues; + + lanelet::autoware::validation::appendIssues( + issues, check_intersection_area_dangling_reference(map)); + + return issues; +} + +lanelet::validation::Issues +IntersectionAreaDanglingReferenceValidator::check_intersection_area_dangling_reference( + const lanelet::LaneletMap & map) +{ + // returns the VALUE of intersection_area key + auto is_intersection_with_area = [](const auto & lanelet) -> std::optional { + if (lanelet.attributeOr("turn_direction", "none") == std::string("none")) { + return std::nullopt; + } + + const std::string id_str = lanelet.attributeOr("intersection_area", "none"); + if (id_str == std::string("none")) { + return std::nullopt; + } + + const auto id = static_cast(std::atoi(id_str.c_str())); + return id; + }; + + std::unordered_set intersection_area_ids; + for (const auto & area : map.polygonLayer) { + if ( + area.attributeOr(lanelet::AttributeName::Type, "none") == std::string("intersection_area")) { + intersection_area_ids.emplace(area.id()); + } + } + + lanelet::validation::Issues issues; + for (const auto & lanelet : map.laneletLayer) { + if (const auto id_opt = is_intersection_with_area(lanelet); id_opt) { + const auto id = id_opt.value(); + if (intersection_area_ids.find(id) == intersection_area_ids.end()) { + issues.emplace_back( + lanelet::validation::Severity::Error, lanelet::validation::Primitive::Lanelet, + lanelet.id(), + append_issue_code_prefix( + this->name(), 1, + "Dangling reference to non-existing intersection area of ID " + std::to_string(id) + + " is detected")); + } + } + } + + return issues; +} + +} // namespace lanelet::autoware::validation diff --git a/map/autoware_lanelet2_map_validator/src/validators/intersection/intersection_area_segment_type.cpp b/map/autoware_lanelet2_map_validator/src/validators/intersection/intersection_area_segment_type.cpp new file mode 100644 index 00000000..65573b7b --- /dev/null +++ b/map/autoware_lanelet2_map_validator/src/validators/intersection/intersection_area_segment_type.cpp @@ -0,0 +1,153 @@ +// Copyright 2024 Autoware Foundation +// +// 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. + +#include "lanelet2_map_validator/validators/intersection/intersection_area_segment_type.hpp" + +#include "lanelet2_map_validator/utils.hpp" + +#include + +#include +#include +#include + +#include +#include + +namespace lanelet::autoware::validation +{ +namespace +{ +lanelet::validation::RegisterMapValidator reg; +} + +lanelet::validation::Issues IntersectionAreaSegmentTypeValidator::operator()( + const lanelet::LaneletMap & map) +{ + lanelet::validation::Issues issues; + + lanelet::autoware::validation::appendIssues(issues, check_intersection_area_segment_type(map)); + + return issues; +} + +lanelet::validation::Issues +IntersectionAreaSegmentTypeValidator::check_intersection_area_segment_type( + const lanelet::LaneletMap & map) +{ + lanelet::validation::Issues issues; + + for (const lanelet::ConstPolygon3d & polygon3d : map.polygonLayer) { + if ( + !polygon3d.hasAttribute(lanelet::AttributeName::Type) || + polygon3d.attribute(lanelet::AttributeName::Type).value() != "intersection_area") { + continue; + } + + const auto borders_submap = create_nearby_borders_submap(map, polygon3d); + lanelet::Ids invalid_point_ids = {}; + for (const lanelet::ConstPoint3d & point : polygon3d) { + lanelet::LineStrings3d search_results = borders_submap->lineStringLayer.findUsages(point); + if (search_results.empty()) { + invalid_point_ids.push_back(point.id()); + } + } + if (!invalid_point_ids.empty()) { + issues.emplace_back( + lanelet::validation::Severity::Error, lanelet::validation::Primitive::Polygon, + polygon3d.id(), + append_issue_code_prefix( + this->name(), 1, + "This intersection area is not made by points from road_border linestrings or lanelet " + "edges. (Point ID: " + + ids_to_string(invalid_point_ids) + ")")); + } + } + + return issues; +} + +lanelet::LaneletSubmapUPtr IntersectionAreaSegmentTypeValidator::create_nearby_borders_submap( + const lanelet::LaneletMap & map, const lanelet::ConstPolygon3d & intersection_area) +{ + lanelet::BoundingBox2d bbox2d = + lanelet::geometry::boundingBox2d(lanelet::traits::toBasicPolygon2d(intersection_area)); + + lanelet::ConstLanelets nearby_lanelets = map.laneletLayer.search(bbox2d); + lanelet::ConstLineStrings3d nearby_linestrings = map.lineStringLayer.search(bbox2d); + + lanelet::LineStrings3d nearby_borders; + + // Collect lanelet edges intersecting the intersection area + for (const auto & lanelet : nearby_lanelets) { + if ( + !lanelet.hasAttribute(lanelet::AttributeName::Subtype) || + lanelet.attribute(lanelet::AttributeName::Subtype).value() != + lanelet::AttributeValueString::Road) { + continue; + } + + if (bbox2d.contains(lanelet.leftBound2d().front().basicPoint2d())) { + lanelet::Point3d left_point(lanelet.leftBound().front()); + lanelet::Point3d right_point(lanelet.rightBound().front()); + + lanelet::AttributeMap attribute; + attribute["type"] = "lanelet_edge"; // An instant linestring type for this code + + lanelet::LineString3d lanelet_front_edge( + lanelet::utils::getId(), {left_point, right_point}, attribute); + nearby_borders.push_back(lanelet_front_edge); + } + + if (bbox2d.contains(lanelet.leftBound2d().back().basicPoint2d())) { + lanelet::Point3d left_point(lanelet.leftBound().back()); + lanelet::Point3d right_point(lanelet.rightBound().back()); + + lanelet::AttributeMap attribute; + attribute["type"] = "lanelet_edge"; // An instant linestring type for this code + + lanelet::LineString3d lanelet_back_edge( + lanelet::utils::getId(), {left_point, right_point}, attribute); + nearby_borders.push_back(lanelet_back_edge); + } + } + + // Collect road_border subtype linestrings + for (const auto & linestring : nearby_linestrings) { + if ( + linestring.hasAttribute(lanelet::AttributeName::Type) && + linestring.attribute(lanelet::AttributeName::Type).value() == + lanelet::AttributeValueString::RoadBorder) { + auto data = std::const_pointer_cast(linestring.constData()); + nearby_borders.push_back(lanelet::LineString3d(data, linestring.inverted())); + } + } + + return lanelet::utils::createSubmap(nearby_borders); +} + +std::string IntersectionAreaSegmentTypeValidator::ids_to_string(const lanelet::Ids ids) +{ + std::string result = "("; + for (size_t i = 0; i < ids.size(); i++) { + result += std::to_string(ids[i]); + if (i < ids.size() - 1) { + result += ", "; + } + } + result += ")"; + return result; +} + +} // namespace lanelet::autoware::validation diff --git a/map/autoware_lanelet2_map_validator/src/validators/intersection/intersection_area_validity.cpp b/map/autoware_lanelet2_map_validator/src/validators/intersection/intersection_area_validity.cpp new file mode 100644 index 00000000..b19174f4 --- /dev/null +++ b/map/autoware_lanelet2_map_validator/src/validators/intersection/intersection_area_validity.cpp @@ -0,0 +1,74 @@ +// Copyright 2024 Autoware Foundation +// +// 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. + +#include "lanelet2_map_validator/validators/intersection/intersection_area_validity.hpp" + +#include "lanelet2_map_validator/utils.hpp" + +#include + +#include +#include +#include + +#include +#include + +namespace lanelet::autoware::validation +{ +namespace +{ +lanelet::validation::RegisterMapValidator reg; +} + +lanelet::validation::Issues IntersectionAreaValidityValidator::operator()( + const lanelet::LaneletMap & map) +{ + lanelet::validation::Issues issues; + + lanelet::autoware::validation::appendIssues(issues, check_intersection_area_validity(map)); + + return issues; +} + +lanelet::validation::Issues IntersectionAreaValidityValidator::check_intersection_area_validity( + const lanelet::LaneletMap & map) +{ + lanelet::validation::Issues issues; + + for (const lanelet::ConstPolygon3d & polygon3d : map.polygonLayer) { + if ( + !polygon3d.hasAttribute(lanelet::AttributeName::Type) || + polygon3d.attribute(lanelet::AttributeName::Type).value() != "intersection_area") { + continue; + } + + lanelet::BasicPolygon2d basic_polygon2d = lanelet::traits::to2D(polygon3d.basicPolygon()); + + std::string reason; + bool polygon_is_valid = boost::geometry::is_valid(basic_polygon2d, reason); + if (!polygon_is_valid) { + issues.emplace_back( + lanelet::validation::Severity::Error, lanelet::validation::Primitive::Polygon, + polygon3d.id(), + append_issue_code_prefix( + this->name(), 1, + "This intersection_area doesn't satisfy boost::geometry::is_valid (reason: " + reason + + ").")); + } + } + + return issues; +} +} // namespace lanelet::autoware::validation diff --git a/map/autoware_lanelet2_map_validator/src/validators/traffic_light/regulatory_element_details_for_traffic_lights.cpp b/map/autoware_lanelet2_map_validator/src/validators/traffic_light/regulatory_element_details_for_traffic_lights.cpp index 4c536d03..a244ebbe 100644 --- a/map/autoware_lanelet2_map_validator/src/validators/traffic_light/regulatory_element_details_for_traffic_lights.cpp +++ b/map/autoware_lanelet2_map_validator/src/validators/traffic_light/regulatory_element_details_for_traffic_lights.cpp @@ -21,6 +21,8 @@ #include #include +#include + namespace lanelet::autoware::validation { namespace diff --git a/map/autoware_lanelet2_map_validator/test/data/map/intersection/basic_intersection_area.osm b/map/autoware_lanelet2_map_validator/test/data/map/intersection/basic_intersection_area.osm new file mode 100644 index 00000000..b5122a94 --- /dev/null +++ b/map/autoware_lanelet2_map_validator/test/data/map/intersection/basic_intersection_area.osm @@ -0,0 +1,2985 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/map/autoware_lanelet2_map_validator/test/data/map/intersection/intersection_area_with_dangling_reference.osm b/map/autoware_lanelet2_map_validator/test/data/map/intersection/intersection_area_with_dangling_reference.osm new file mode 100644 index 00000000..ccb148db --- /dev/null +++ b/map/autoware_lanelet2_map_validator/test/data/map/intersection/intersection_area_with_dangling_reference.osm @@ -0,0 +1,2988 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/map/autoware_lanelet2_map_validator/test/data/map/intersection/intersection_area_with_irrelative_point.osm b/map/autoware_lanelet2_map_validator/test/data/map/intersection/intersection_area_with_irrelative_point.osm new file mode 100644 index 00000000..a8e04a2b --- /dev/null +++ b/map/autoware_lanelet2_map_validator/test/data/map/intersection/intersection_area_with_irrelative_point.osm @@ -0,0 +1,2992 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/map/autoware_lanelet2_map_validator/test/data/map/intersection/intersection_area_with_self_intersection.osm b/map/autoware_lanelet2_map_validator/test/data/map/intersection/intersection_area_with_self_intersection.osm new file mode 100644 index 00000000..d0679e0d --- /dev/null +++ b/map/autoware_lanelet2_map_validator/test/data/map/intersection/intersection_area_with_self_intersection.osm @@ -0,0 +1,2986 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/map/autoware_lanelet2_map_validator/test/data/map/intersection/intersection_area_with_wrong_linestring_type.osm b/map/autoware_lanelet2_map_validator/test/data/map/intersection/intersection_area_with_wrong_linestring_type.osm new file mode 100644 index 00000000..9c212f79 --- /dev/null +++ b/map/autoware_lanelet2_map_validator/test/data/map/intersection/intersection_area_with_wrong_linestring_type.osm @@ -0,0 +1,2986 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/map/autoware_lanelet2_map_validator/test/data/map/intersection/intersection_area_with_wrong_orientation.osm b/map/autoware_lanelet2_map_validator/test/data/map/intersection/intersection_area_with_wrong_orientation.osm new file mode 100644 index 00000000..4bb51e8f --- /dev/null +++ b/map/autoware_lanelet2_map_validator/test/data/map/intersection/intersection_area_with_wrong_orientation.osm @@ -0,0 +1,2985 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/map/autoware_lanelet2_map_validator/test/data/map/sample_map.osm b/map/autoware_lanelet2_map_validator/test/data/map/sample_map.osm index e9b84e91..8994ebae 100644 --- a/map/autoware_lanelet2_map_validator/test/data/map/sample_map.osm +++ b/map/autoware_lanelet2_map_validator/test/data/map/sample_map.osm @@ -1,6 +1,6 @@ - + @@ -155,14 +155,14 @@ - - - + + + - - - + + + @@ -170,29 +170,24 @@ - - - + + + - - - - - - - - + + + - - - + + + - - - + + + @@ -200,19 +195,19 @@ - - - + + + - - - + + + - - - + + + @@ -385,10 +380,10 @@ - - - - + + + + @@ -445,14 +440,14 @@ - - - + + + - - - + + + @@ -625,24 +620,24 @@ - - - + + + - - + + - - - - + + + + - - - + + + @@ -770,11 +765,6 @@ - - - - - @@ -3631,9 +3621,9 @@ - - - + + + @@ -3731,6 +3721,921 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4152,7 +5057,6 @@ - @@ -4653,11 +5557,6 @@ - - - - - @@ -5090,12 +5989,6 @@ - - - - - - @@ -5243,12 +6136,6 @@ - - - - - - @@ -5283,6 +6170,316 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -5291,6 +6488,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -5786,15 +7139,6 @@ - - - - - - - - - @@ -5822,6 +7166,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -5891,7 +7271,7 @@ - + diff --git a/map/autoware_lanelet2_map_validator/test/src/test_missing_regulatory_elements_for_crosswalks.cpp b/map/autoware_lanelet2_map_validator/test/src/crosswalk/test_missing_regulatory_elements_for_crosswalks.cpp similarity index 99% rename from map/autoware_lanelet2_map_validator/test/src/test_missing_regulatory_elements_for_crosswalks.cpp rename to map/autoware_lanelet2_map_validator/test/src/crosswalk/test_missing_regulatory_elements_for_crosswalks.cpp index 17ec1714..95ab9db6 100644 --- a/map/autoware_lanelet2_map_validator/test/src/test_missing_regulatory_elements_for_crosswalks.cpp +++ b/map/autoware_lanelet2_map_validator/test/src/crosswalk/test_missing_regulatory_elements_for_crosswalks.cpp @@ -18,6 +18,8 @@ #include #include +#include + class TestMissingRegulatoryElementsForCrosswalks : public MapValidationTester { private: diff --git a/map/autoware_lanelet2_map_validator/test/src/test_regulatory_elements_details_for_crosswalks.cpp b/map/autoware_lanelet2_map_validator/test/src/crosswalk/test_regulatory_elements_details_for_crosswalks.cpp similarity index 99% rename from map/autoware_lanelet2_map_validator/test/src/test_regulatory_elements_details_for_crosswalks.cpp rename to map/autoware_lanelet2_map_validator/test/src/crosswalk/test_regulatory_elements_details_for_crosswalks.cpp index b49406fd..90bbf0f8 100644 --- a/map/autoware_lanelet2_map_validator/test/src/test_regulatory_elements_details_for_crosswalks.cpp +++ b/map/autoware_lanelet2_map_validator/test/src/crosswalk/test_regulatory_elements_details_for_crosswalks.cpp @@ -18,6 +18,8 @@ #include #include +#include + class TestRegulatoryElementsDetailsForCrosswalks : public MapValidationTester { private: diff --git a/map/autoware_lanelet2_map_validator/test/src/map_validation_tester.hpp b/map/autoware_lanelet2_map_validator/test/src/include/map_validation_tester.hpp similarity index 100% rename from map/autoware_lanelet2_map_validator/test/src/map_validation_tester.hpp rename to map/autoware_lanelet2_map_validator/test/src/include/map_validation_tester.hpp diff --git a/map/autoware_lanelet2_map_validator/test/src/intersection/test_intersection_area_dangling_reference.cpp b/map/autoware_lanelet2_map_validator/test/src/intersection/test_intersection_area_dangling_reference.cpp new file mode 100644 index 00000000..bd81497d --- /dev/null +++ b/map/autoware_lanelet2_map_validator/test/src/intersection/test_intersection_area_dangling_reference.cpp @@ -0,0 +1,63 @@ +// Copyright 2024 Autoware Foundation +// +// 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. + +#include "lanelet2_map_validator/validators/intersection/intersection_area_dangling_reference.hpp" +#include "map_validation_tester.hpp" + +#include +#include + +#include + +class TestIntersectionAreaDanglingReference : public MapValidationTester +{ +}; + +TEST_F(TestIntersectionAreaDanglingReference, ValidatorAvailability) // NOLINT for gtest +{ + std::string expected_validator_name = + lanelet::autoware::validation::IntersectionAreaDanglingReferenceValidator::name(); + + lanelet::validation::Strings validators = + lanelet::validation::availabeChecks(expected_validator_name); // cspell:disable-line + + const uint32_t expected_validator_num = 1; + EXPECT_EQ(expected_validator_num, validators.size()); + EXPECT_EQ(expected_validator_name, validators[0]); +} + +TEST_F(TestIntersectionAreaDanglingReference, ValidateDanglingReference) // NOLINT for gtest +{ + load_target_map("intersection/intersection_area_with_dangling_reference.osm"); + lanelet::autoware::validation::IntersectionAreaDanglingReferenceValidator checker; + const auto & issues = checker(*map_); + + EXPECT_EQ(issues.size(), 1); + EXPECT_EQ(issues[0].id, 53); + EXPECT_EQ(issues[0].severity, lanelet::validation::Severity::Error); + EXPECT_EQ(issues[0].primitive, lanelet::validation::Primitive::Lanelet); + EXPECT_EQ( + issues[0].message, + "[Intersection.IntersectionAreaDanglingReference-001] Dangling " + "reference to non-existing intersection area of ID 777 is detected"); +} + +TEST_F(TestIntersectionAreaDanglingReference, ValidIntersectionArea) // NOLINT for gtest +{ + load_target_map("intersection/basic_intersection_area.osm"); + lanelet::autoware::validation::IntersectionAreaDanglingReferenceValidator checker; + const auto & issues = checker(*map_); + + EXPECT_EQ(issues.size(), 0); +} diff --git a/map/autoware_lanelet2_map_validator/test/src/intersection/test_intersection_area_segment_type.cpp b/map/autoware_lanelet2_map_validator/test/src/intersection/test_intersection_area_segment_type.cpp new file mode 100644 index 00000000..c8395ea3 --- /dev/null +++ b/map/autoware_lanelet2_map_validator/test/src/intersection/test_intersection_area_segment_type.cpp @@ -0,0 +1,95 @@ +// Copyright 2024 Autoware Foundation +// +// 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. + +#include "lanelet2_map_validator/validators/intersection/intersection_area_segment_type.hpp" +#include "map_validation_tester.hpp" + +#include +#include + +#include + +class TestIntersectionAreaSegmentType : public MapValidationTester +{ +private: +}; + +TEST_F(TestIntersectionAreaSegmentType, ValidatorAvailability) // NOLINT for gtest +{ + std::string expected_validator_name = + lanelet::autoware::validation::IntersectionAreaSegmentTypeValidator::name(); + + lanelet::validation::Strings validators = + lanelet::validation::availabeChecks(expected_validator_name); // cspell:disable-line + + const uint32_t expected_validator_num = 1; + EXPECT_EQ(expected_validator_num, validators.size()); + EXPECT_EQ(expected_validator_name, validators[0]); +} + +TEST_F(TestIntersectionAreaSegmentType, CheckIrrelativePoint) // NOLINT for gtest +{ + load_target_map("intersection/intersection_area_with_irrelative_point.osm"); + + lanelet::autoware::validation::IntersectionAreaSegmentTypeValidator checker; + const auto & issues = checker(*map_); + + EXPECT_EQ(issues.size(), 1); + EXPECT_EQ(issues[0].id, 10803); + EXPECT_EQ(issues[0].severity, lanelet::validation::Severity::Error); + EXPECT_EQ(issues[0].primitive, lanelet::validation::Primitive::Polygon); + EXPECT_EQ( + issues[0].message, + "[Intersection.IntersectionAreaSegmentType-001] This intersection area is not made by points " + "from road_border linestrings or lanelet edges. (Point ID: (10804))"); +} + +TEST_F(TestIntersectionAreaSegmentType, CheckWrongLinestringType) // NOLINT for gtest +{ + load_target_map("intersection/intersection_area_with_wrong_linestring_type.osm"); + + lanelet::autoware::validation::IntersectionAreaSegmentTypeValidator checker; + const auto & issues = checker(*map_); + + EXPECT_EQ(issues.size(), 1); + EXPECT_EQ(issues[0].id, 10803); + EXPECT_EQ(issues[0].severity, lanelet::validation::Severity::Error); + EXPECT_EQ(issues[0].primitive, lanelet::validation::Primitive::Polygon); + EXPECT_EQ( + issues[0].message, + "[Intersection.IntersectionAreaSegmentType-001] This intersection area is not made by points " + "from road_border linestrings or lanelet edges. (Point ID: (10756, 10757, 10758, 10759, 10760, " + "10761, 10762, 10763, 10764, 10765, 10766, 10767, 10768, 10769, 10770, 10771, 10772, 10773, " + "10774, 10775, 10776))"); +} + +TEST_F(TestIntersectionAreaSegmentType, ValidIntersectionArea) // NOLINT for gtest +{ + load_target_map("intersection/basic_intersection_area.osm"); + + lanelet::autoware::validation::IntersectionAreaSegmentTypeValidator checker; + const auto & issues = checker(*map_); + + EXPECT_EQ(issues.size(), 0); +} + +TEST_F(TestIntersectionAreaSegmentType, SampleMap) // NOLINT for gtest +{ + load_target_map("sample_map.osm"); + + lanelet::autoware::validation::IntersectionAreaSegmentTypeValidator checker; + const auto & issues = checker(*map_); + + EXPECT_EQ(issues.size(), 0); +} diff --git a/map/autoware_lanelet2_map_validator/test/src/intersection/test_intersection_area_validity.cpp b/map/autoware_lanelet2_map_validator/test/src/intersection/test_intersection_area_validity.cpp new file mode 100644 index 00000000..1228304b --- /dev/null +++ b/map/autoware_lanelet2_map_validator/test/src/intersection/test_intersection_area_validity.cpp @@ -0,0 +1,95 @@ +// Copyright 2024 Autoware Foundation +// +// 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. + +#include "lanelet2_map_validator/validators/intersection/intersection_area_validity.hpp" +#include "map_validation_tester.hpp" + +#include +#include + +#include + +class TestIntersectionAreaValidity : public MapValidationTester +{ +private: +}; + +TEST_F(TestIntersectionAreaValidity, ValidatorAvailability) // NOLINT for gtest +{ + std::string expected_validator_name = + lanelet::autoware::validation::IntersectionAreaValidityValidator::name(); + + lanelet::validation::Strings validators = + lanelet::validation::availabeChecks(expected_validator_name); // cspell:disable-line + + const uint32_t expected_validator_num = 1; + EXPECT_EQ(expected_validator_num, validators.size()); + EXPECT_EQ(expected_validator_name, validators[0]); +} + +TEST_F(TestIntersectionAreaValidity, CheckWrongOrientation) // NOLINT for gtest +{ + load_target_map("intersection/intersection_area_with_wrong_orientation.osm"); + + lanelet::autoware::validation::IntersectionAreaValidityValidator checker; + const auto & issues = checker(*map_); + + EXPECT_EQ(issues.size(), 1); + EXPECT_EQ(issues[0].id, 10803); + EXPECT_EQ(issues[0].severity, lanelet::validation::Severity::Error); + EXPECT_EQ(issues[0].primitive, lanelet::validation::Primitive::Polygon); + EXPECT_EQ( + issues[0].message, + "[Intersection.IntersectionAreaValidity-001] This intersection_area doesn't satisfy " + "boost::geometry::is_valid (reason: Geometry has wrong orientation)."); +} + +TEST_F(TestIntersectionAreaValidity, CheckSelfIntersection) // NOLINT for gtest +{ + load_target_map("intersection/intersection_area_with_self_intersection.osm"); + + lanelet::autoware::validation::IntersectionAreaValidityValidator checker; + const auto & issues = checker(*map_); + + EXPECT_EQ(issues.size(), 1); + EXPECT_EQ(issues[0].id, 10803); + EXPECT_EQ(issues[0].severity, lanelet::validation::Severity::Error); + EXPECT_EQ(issues[0].primitive, lanelet::validation::Primitive::Polygon); + EXPECT_EQ( + issues[0].message, + "[Intersection.IntersectionAreaValidity-001] This intersection_area doesn't satisfy " + "boost::geometry::is_valid (reason: Geometry has invalid self-intersections. A " + "self-intersection point was found at (3757.52, 73751.8); method: i; operations: u/i; segment " + "IDs {source, multi, ring, segment}: {0, -1, -1, 21}/{0, -1, -1, 23})."); +} + +TEST_F(TestIntersectionAreaValidity, ValidIntersectionArea) // NOLINT for gtest +{ + load_target_map("intersection/basic_intersection_area.osm"); + + lanelet::autoware::validation::IntersectionAreaValidityValidator checker; + const auto & issues = checker(*map_); + + EXPECT_EQ(issues.size(), 0); +} + +TEST_F(TestIntersectionAreaValidity, SampleMap) // NOLINT for gtest +{ + load_target_map("sample_map.osm"); + + lanelet::autoware::validation::IntersectionAreaValidityValidator checker; + const auto & issues = checker(*map_); + + EXPECT_EQ(issues.size(), 0); +} diff --git a/map/autoware_lanelet2_map_validator/test/src/test_missing_regulatory_elements_for_stop_lines.cpp b/map/autoware_lanelet2_map_validator/test/src/stop_line/test_missing_regulatory_elements_for_stop_lines.cpp similarity index 99% rename from map/autoware_lanelet2_map_validator/test/src/test_missing_regulatory_elements_for_stop_lines.cpp rename to map/autoware_lanelet2_map_validator/test/src/stop_line/test_missing_regulatory_elements_for_stop_lines.cpp index 006ac806..351115f0 100644 --- a/map/autoware_lanelet2_map_validator/test/src/test_missing_regulatory_elements_for_stop_lines.cpp +++ b/map/autoware_lanelet2_map_validator/test/src/stop_line/test_missing_regulatory_elements_for_stop_lines.cpp @@ -18,6 +18,8 @@ #include #include +#include + class TestMissingRegulatoryElementsForStopLines : public MapValidationTester { private: diff --git a/map/autoware_lanelet2_map_validator/test/src/test_missing_referrers_for_traffic_lights.cpp b/map/autoware_lanelet2_map_validator/test/src/traffic_light/test_missing_referrers_for_traffic_lights.cpp similarity index 99% rename from map/autoware_lanelet2_map_validator/test/src/test_missing_referrers_for_traffic_lights.cpp rename to map/autoware_lanelet2_map_validator/test/src/traffic_light/test_missing_referrers_for_traffic_lights.cpp index bf832aab..7d02dc64 100644 --- a/map/autoware_lanelet2_map_validator/test/src/test_missing_referrers_for_traffic_lights.cpp +++ b/map/autoware_lanelet2_map_validator/test/src/traffic_light/test_missing_referrers_for_traffic_lights.cpp @@ -18,6 +18,8 @@ #include #include +#include + class TestMissingReferrersForTrafficLights : public MapValidationTester { private: diff --git a/map/autoware_lanelet2_map_validator/test/src/test_missing_regulatory_elements_for_traffic_lights.cpp b/map/autoware_lanelet2_map_validator/test/src/traffic_light/test_missing_regulatory_elements_for_traffic_lights.cpp similarity index 99% rename from map/autoware_lanelet2_map_validator/test/src/test_missing_regulatory_elements_for_traffic_lights.cpp rename to map/autoware_lanelet2_map_validator/test/src/traffic_light/test_missing_regulatory_elements_for_traffic_lights.cpp index 3c3d2ae4..d72d4e76 100644 --- a/map/autoware_lanelet2_map_validator/test/src/test_missing_regulatory_elements_for_traffic_lights.cpp +++ b/map/autoware_lanelet2_map_validator/test/src/traffic_light/test_missing_regulatory_elements_for_traffic_lights.cpp @@ -18,6 +18,8 @@ #include #include +#include + class TestMissingRegulatoryElementsForTrafficLights : public MapValidationTester { private: diff --git a/map/autoware_lanelet2_map_validator/test/src/test_regulatory_elements_details_for_traffic_lights.cpp b/map/autoware_lanelet2_map_validator/test/src/traffic_light/test_regulatory_elements_details_for_traffic_lights.cpp similarity index 99% rename from map/autoware_lanelet2_map_validator/test/src/test_regulatory_elements_details_for_traffic_lights.cpp rename to map/autoware_lanelet2_map_validator/test/src/traffic_light/test_regulatory_elements_details_for_traffic_lights.cpp index 046f063c..53278bf0 100644 --- a/map/autoware_lanelet2_map_validator/test/src/test_regulatory_elements_details_for_traffic_lights.cpp +++ b/map/autoware_lanelet2_map_validator/test/src/traffic_light/test_regulatory_elements_details_for_traffic_lights.cpp @@ -18,6 +18,8 @@ #include #include +#include + class TestRegulatoryElementDetailsForTrafficLights : public MapValidationTester { private: diff --git a/map/autoware_lanelet2_map_validator/test/src/test_traffic_light_facing.cpp b/map/autoware_lanelet2_map_validator/test/src/traffic_light/test_traffic_light_facing.cpp similarity index 99% rename from map/autoware_lanelet2_map_validator/test/src/test_traffic_light_facing.cpp rename to map/autoware_lanelet2_map_validator/test/src/traffic_light/test_traffic_light_facing.cpp index ab3dbe05..16ec330d 100644 --- a/map/autoware_lanelet2_map_validator/test/src/test_traffic_light_facing.cpp +++ b/map/autoware_lanelet2_map_validator/test/src/traffic_light/test_traffic_light_facing.cpp @@ -19,6 +19,7 @@ #include #include +#include class TestTrafficLightFacing : public MapValidationTester { diff --git a/map/autoware_pointcloud_divider/include/autoware/pointcloud_divider/utility.hpp b/map/autoware_pointcloud_divider/include/autoware/pointcloud_divider/utility.hpp index 544ae4f9..e837f6d4 100644 --- a/map/autoware_pointcloud_divider/include/autoware/pointcloud_divider/utility.hpp +++ b/map/autoware_pointcloud_divider/include/autoware/pointcloud_divider/utility.hpp @@ -17,6 +17,7 @@ #include +#include #include #include #include diff --git a/map/autoware_pointcloud_divider/src/pcd_divider.cpp b/map/autoware_pointcloud_divider/src/pcd_divider.cpp index b4468d37..d7c9f5c9 100644 --- a/map/autoware_pointcloud_divider/src/pcd_divider.cpp +++ b/map/autoware_pointcloud_divider/src/pcd_divider.cpp @@ -49,7 +49,11 @@ #include #include +#include #include +#include +#include +#include namespace fs = std::filesystem; diff --git a/map/autoware_pointcloud_divider/src/pointcloud_divider_node.cpp b/map/autoware_pointcloud_divider/src/pointcloud_divider_node.cpp index 5ed7b0db..0adc937e 100644 --- a/map/autoware_pointcloud_divider/src/pointcloud_divider_node.cpp +++ b/map/autoware_pointcloud_divider/src/pointcloud_divider_node.cpp @@ -18,6 +18,8 @@ #include +#include + namespace autoware::pointcloud_divider { diff --git a/map/autoware_pointcloud_merger/src/pcd_merger.cpp b/map/autoware_pointcloud_merger/src/pcd_merger.cpp index bafaeca6..d4cf5869 100644 --- a/map/autoware_pointcloud_merger/src/pcd_merger.cpp +++ b/map/autoware_pointcloud_merger/src/pcd_merger.cpp @@ -50,6 +50,8 @@ #include #include +#include +#include namespace fs = std::filesystem; diff --git a/map/autoware_pointcloud_merger/src/pointcloud_merger_node.cpp b/map/autoware_pointcloud_merger/src/pointcloud_merger_node.cpp index fe849891..4a720703 100644 --- a/map/autoware_pointcloud_merger/src/pointcloud_merger_node.cpp +++ b/map/autoware_pointcloud_merger/src/pointcloud_merger_node.cpp @@ -18,6 +18,8 @@ #include +#include + namespace autoware::pointcloud_merger { diff --git a/mkdocs.yaml b/mkdocs.yaml index 9f868f28..97ff8c97 100644 --- a/mkdocs.yaml +++ b/mkdocs.yaml @@ -1,7 +1,11 @@ -site_name: Autoware Universe Documentation -site_url: https://autowarefoundation.github.io/autoware_tools +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + +site_name: Autoware Tools Documentation +site_url: https://autowarefoundation.github.io/autoware-tools-documentation repo_url: https://github.com/autowarefoundation/autoware_tools -edit_uri: https://github.com/autowarefoundation/autoware_tools/edit/main/ +edit_uri: https://github.com/autowarefoundation/autoware-tools-documentation/edit/main/ docs_dir: . copyright: Copyright © 2023 The Autoware Foundation diff --git a/planning/autoware_planning_data_analyzer/config/behavior_analyzer.param.yaml b/planning/autoware_planning_data_analyzer/config/behavior_analyzer.param.yaml index dbd9e91c..42747198 100644 --- a/planning/autoware_planning_data_analyzer/config/behavior_analyzer.param.yaml +++ b/planning/autoware_planning_data_analyzer/config/behavior_analyzer.param.yaml @@ -17,9 +17,9 @@ efficiency: 1.0 safety: 1.0 - grid_seach: + grid_search: min: 0.1 max: 1.0 - resolusion: 0.2 + resolution: 0.2 dt: 1.0 thread_num: 8 diff --git a/planning/autoware_planning_data_analyzer/src/data_structs.hpp b/planning/autoware_planning_data_analyzer/src/data_structs.hpp index 53ff2b02..796c78dc 100644 --- a/planning/autoware_planning_data_analyzer/src/data_structs.hpp +++ b/planning/autoware_planning_data_analyzer/src/data_structs.hpp @@ -78,7 +78,7 @@ struct GridSearchParameters { double min{0.0}; double max{1.0}; - double resolusion{0.01}; + double resolution{0.01}; double dt{1.0}; size_t thread_num{4}; }; @@ -91,7 +91,7 @@ struct Parameters double w1{1.0}; double w2{1.0}; double w3{1.0}; - GridSearchParameters grid_seach{}; + GridSearchParameters grid_search{}; TargetStateParameters target_state{}; }; diff --git a/planning/autoware_planning_data_analyzer/src/node.cpp b/planning/autoware_planning_data_analyzer/src/node.cpp index fdab8f90..8c02d6dd 100644 --- a/planning/autoware_planning_data_analyzer/src/node.cpp +++ b/planning/autoware_planning_data_analyzer/src/node.cpp @@ -18,6 +18,12 @@ #include +#include +#include +#include +#include +#include + namespace autoware::behavior_analyzer { using autoware::universe_utils::createDefaultMarker; @@ -77,11 +83,11 @@ BehaviorAnalyzerNode::BehaviorAnalyzerNode(const rclcpp::NodeOptions & node_opti parameters_->w1 = declare_parameter("weight.lon_comfortability"); parameters_->w2 = declare_parameter("weight.efficiency"); parameters_->w3 = declare_parameter("weight.safety"); - parameters_->grid_seach.dt = declare_parameter("grid_seach.dt"); - parameters_->grid_seach.min = declare_parameter("grid_seach.min"); - parameters_->grid_seach.max = declare_parameter("grid_seach.max"); - parameters_->grid_seach.resolusion = declare_parameter("grid_seach.resolusion"); - parameters_->grid_seach.thread_num = declare_parameter("grid_seach.thread_num"); + parameters_->grid_search.dt = declare_parameter("grid_search.dt"); + parameters_->grid_search.min = declare_parameter("grid_search.min"); + parameters_->grid_search.max = declare_parameter("grid_search.max"); + parameters_->grid_search.resolution = declare_parameter("grid_search.resolution"); + parameters_->grid_search.thread_num = declare_parameter("grid_search.thread_num"); parameters_->target_state.lat_positions = declare_parameter>("target_state.lateral_positions"); parameters_->target_state.lat_velocities = @@ -199,7 +205,7 @@ void BehaviorAnalyzerNode::weight( [[maybe_unused]] const Trigger::Request::SharedPtr req, Trigger::Response::SharedPtr res) { std::lock_guard lock(mutex_); - RCLCPP_INFO(get_logger(), "start weight grid seach."); + RCLCPP_INFO(get_logger(), "start weight grid search."); const auto & p = parameters_; @@ -209,13 +215,13 @@ void BehaviorAnalyzerNode::weight( std::vector weight_grid; - double resolusion = p->grid_seach.resolusion; - double min = p->grid_seach.min; - double max = p->grid_seach.max; - for (double w0 = min; w0 < max + 0.1 * resolusion; w0 += resolusion) { - for (double w1 = min; w1 < max + 0.1 * resolusion; w1 += resolusion) { - for (double w2 = min; w2 < max + 0.1 * resolusion; w2 += resolusion) { - for (double w3 = min; w3 < max + 0.1 * resolusion; w3 += resolusion) { + double resolution = p->grid_search.resolution; + double min = p->grid_search.min; + double max = p->grid_search.max; + for (double w0 = min; w0 < max + 0.1 * resolution; w0 += resolution) { + for (double w1 = min; w1 < max + 0.1 * resolution; w1 += resolution) { + for (double w2 = min; w2 < max + 0.1 * resolution; w2 += resolution) { + for (double w3 = min; w3 < max + 0.1 * resolution; w3 += resolution) { weight_grid.emplace_back(w0, w1, w2, w3); } } @@ -240,7 +246,7 @@ void BehaviorAnalyzerNode::weight( stop_watch.tic("total_time"); while (reader_.has_next() && rclcpp::ok()) { - update(bag_data, p->grid_seach.dt); + update(bag_data, p->grid_search.dt); if (!bag_data->ready()) break; @@ -276,7 +282,7 @@ void BehaviorAnalyzerNode::weight( size_t i = 0; while (rclcpp::ok()) { std::vector threads; - for (size_t thread_id = 0; thread_id < p->grid_seach.thread_num; thread_id++) { + for (size_t thread_id = 0; thread_id < p->grid_search.thread_num; thread_id++) { threads.emplace_back(update, data_set, i + thread_id); } @@ -284,14 +290,14 @@ void BehaviorAnalyzerNode::weight( if (i + 1 > weight_grid.size()) break; - i += p->grid_seach.thread_num; + i += p->grid_search.thread_num; } show_best_result(); } std::cout << "process time: " << stop_watch.toc("total_time") << "[ms]" << std::endl; - RCLCPP_INFO(get_logger(), "finish weight grid seach."); + RCLCPP_INFO(get_logger(), "finish weight grid search."); res->success = true; } diff --git a/planning/autoware_rtc_replayer/src/autoware_rtc_replayer_node.cpp b/planning/autoware_rtc_replayer/src/autoware_rtc_replayer_node.cpp index 98afa937..ab47bcaf 100644 --- a/planning/autoware_rtc_replayer/src/autoware_rtc_replayer_node.cpp +++ b/planning/autoware_rtc_replayer/src/autoware_rtc_replayer_node.cpp @@ -15,6 +15,9 @@ #include "rtc_replayer/rtc_replayer_node.hpp" #include +#include +#include +#include namespace autoware::rtc_replayer { diff --git a/planning/planning_debug_tools/scripts/perception_replayer/perception_replayer_common.py b/planning/planning_debug_tools/scripts/perception_replayer/perception_replayer_common.py index 8a510864..b9957651 100644 --- a/planning/planning_debug_tools/scripts/perception_replayer/perception_replayer_common.py +++ b/planning/planning_debug_tools/scripts/perception_replayer/perception_replayer_common.py @@ -119,9 +119,11 @@ def load_rosbag(self, rosbag2_path: str): objects_topic = ( "/perception/object_recognition/detection/objects" if self.args.detected_object - else "/perception/object_recognition/tracking/objects" - if self.args.tracked_object - else "/perception/object_recognition/objects" + else ( + "/perception/object_recognition/tracking/objects" + if self.args.tracked_object + else "/perception/object_recognition/objects" + ) ) ego_odom_topic = "/localization/kinematic_state" traffic_signals_topic = "/perception/traffic_light_recognition/traffic_signals" diff --git a/planning/planning_debug_tools/scripts/perception_replayer/perception_reproducer.py b/planning/planning_debug_tools/scripts/perception_replayer/perception_reproducer.py index a4202102..1b75fa8a 100755 --- a/planning/planning_debug_tools/scripts/perception_replayer/perception_reproducer.py +++ b/planning/planning_debug_tools/scripts/perception_replayer/perception_reproducer.py @@ -55,9 +55,9 @@ def __init__(self, args): self.perv_objects_msg, self.prev_traffic_signals_msg = self.find_topics_by_timestamp( pose_timestamp ) - self.memorized_original_objects_msg = ( - self.memorized_noised_objects_msg - ) = self.perv_objects_msg + self.memorized_original_objects_msg = self.memorized_noised_objects_msg = ( + self.perv_objects_msg + ) # start main timer callback diff --git a/planning/planning_debug_tools/src/trajectory_analyzer.cpp b/planning/planning_debug_tools/src/trajectory_analyzer.cpp index 2dfcf940..ffbef362 100644 --- a/planning/planning_debug_tools/src/trajectory_analyzer.cpp +++ b/planning/planning_debug_tools/src/trajectory_analyzer.cpp @@ -14,6 +14,10 @@ #include "planning_debug_tools/trajectory_analyzer.hpp" +#include +#include +#include + namespace planning_debug_tools { TrajectoryAnalyzerNode::TrajectoryAnalyzerNode(const rclcpp::NodeOptions & options) diff --git a/setup.cfg b/setup.cfg index 5214751c..4d7d5e5b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,7 @@ +# This file is automatically synced from: +# https://github.com/autowarefoundation/sync-file-templates +# To make changes, update the source repository and follow the guidelines in its README. + [flake8] # Modified from https://github.com/ament/ament_lint/blob/ebd524bb9973d5ec1dc48a670ce54f958a5a0243/ament_flake8/ament_flake8/configuration/ament_flake8.ini extend-ignore = B902,C816,D100,D101,D102,D103,D104,D105,D106,D107,D203,D212,D404,I202,CNL100,E203,E501,Q000 diff --git a/vehicle/estimator_utils/include/estimator_utils/estimator_base.hpp b/vehicle/estimator_utils/include/estimator_utils/estimator_base.hpp index 80d64574..beeed058 100644 --- a/vehicle/estimator_utils/include/estimator_utils/estimator_base.hpp +++ b/vehicle/estimator_utils/include/estimator_utils/estimator_base.hpp @@ -22,6 +22,7 @@ #include "tier4_calibration_msgs/msg/estimation_result.hpp" +#include #include #include diff --git a/vehicle/time_delay_estimator/src/time_delay_estimator.cpp b/vehicle/time_delay_estimator/src/time_delay_estimator.cpp index 4f4e6b17..507b1b6d 100644 --- a/vehicle/time_delay_estimator/src/time_delay_estimator.cpp +++ b/vehicle/time_delay_estimator/src/time_delay_estimator.cpp @@ -19,6 +19,7 @@ #include "time_delay_estimator/data_processor.hpp" #include "time_delay_estimator/parameters.hpp" +#include #include #include