Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(map_loader, route_handler)!: add format_version validation #7074

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

soblin
Copy link
Contributor

@soblin soblin commented May 20, 2024

Description

https://github.com/orgs/autowarefoundation/discussions/4740

Related links

autowarefoundation/autoware_common#245

autowarefoundation/autoware_launch#993

Tests performed

https://evaluation.tier4.jp/evaluation/reports?project_id=prd_jt

tested with autowarefoundation/autoware_common#245

If format_version == 2.1, allow_unsupported_version = true

[component_container_mt-22] [WARN 1716197945.485872919] [map.lanelet2_map_loader]: format_version(2) of the provided map(/home/<>/workspace/maps/kashiwanoha_stable/lanelet2_map.osm) is larger than the supported version(1)
[component_container_mt-22] [INFO 1716197945.486288163] [map.lanelet2_map_loader]: Loaded map format_version: 2.1

autoware launches

if format_version == "temp", allow_unsupported_version = true

[component_container_mt-22] [WARN 1716198351.199131584] [map.lanelet2_map_loader]: /home/<>/workspace/maps/kashiwanoha_stable/lanelet2_map.osm has no format_version(null) or non semver-style format_version(temp) information
[component_container_mt-22] [INFO 1716198351.199345713] [map.lanelet2_map_loader]: Loaded map format_version: temp

autoware launches

if format_version == "" or not provided, allow_unsupported_version = true

[component_container_mt-22] [WARN 1716198658.592172992] [map.lanelet2_map_loader]: /home/<>/workspace/maps/kashiwanoha_stable/lanelet2_map.osm has no format_version(null) or non semver-style format_version() information
[component_container_mt-22] [INFO 1716198658.593344519] [map.lanelet2_map_loader]: Loaded map format_version:
[component_container_mt-22] [WARN 1716198895.854275254] [map.lanelet2_map_loader]: /home/<>/workspace/maps/kashiwanoha_stable/lanelet2_map.osm has no format_version(null) or non semver-style format_version(null) information
[component_container_mt-22] [INFO 1716198895.854322873] [map.lanelet2_map_loader]: Loaded map format_version: null

autoware launches

if format_version == "1.1", allow_unsupported_version = false

autoware launches

if format_version == "2.1", allow_unsupported_version = false

[component_container_mt-22] [WARN 1716199205.647257720] [map.lanelet2_map_loader]: format_version(2) of the provided map(/home/<>/workspace/maps/kashiwanoha_stable/lanelet2_map.osm) is larger than the supported version(1)
[component_container_mt-22] terminate called after throwing an instance of 'std::invalid_argument'
[component_container_mt-22]   what():  allow_unsupported_version is false, so stop loading lanelet map

autoware fails

Notes for reviewers

Interface changes

It is preferable for the user to define format_version for their map

ROS Topic Changes

ROS Parameter Changes

Effects on system behavior

none

Pre-review checklist for the PR author

The PR author must check the checkboxes below when creating the PR.

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.

@github-actions github-actions bot added the component:map Map creation, storage, and loading. (auto-assigned) label May 20, 2024
@soblin soblin marked this pull request as ready for review May 20, 2024 10:13
@soblin soblin force-pushed the feat/map_loader_format_version_validation branch from f0bddc5 to 0a9746b Compare May 20, 2024 10:14
@soblin soblin changed the title feat(map_loader): add format_version validation feat!(map_loader): add format_version validation May 20, 2024
@soblin soblin changed the title feat!(map_loader): add format_version validation feat(map_loader)!: add format_version validation May 21, 2024
@soblin soblin added the tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label May 21, 2024
@YamatoAndo YamatoAndo removed the tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label May 22, 2024
@YamatoAndo
Copy link
Contributor

@soblin We should add tag:run-build-and-test-differential after merging autowarefoundation/autoware_common#245

@YamatoAndo
Copy link
Contributor

The header of the sample map is written as follows

<?xml version="1.0"?>
<osm version="0.6" generator="lanelet2">

Wouldn't it be better to rewrite the header as follows?

<?xml version="1.0"?>
<osm generator="lanelet2">
  <MetaInfo format_version="1"/>

@soblin
Copy link
Contributor Author

soblin commented May 23, 2024

I noticed the sample map does not have "MetaInfo" although our internal map has. I will update the sample map before merging this PR

@soblin soblin force-pushed the feat/map_loader_format_version_validation branch 4 times, most recently from 0088afa to 11206bc Compare June 12, 2024 05:06
@github-actions github-actions bot added the component:planning Route planning, decision-making, and navigation. (auto-assigned) label Jun 12, 2024
@soblin soblin force-pushed the feat/map_loader_format_version_validation branch from 11206bc to 533965a Compare June 12, 2024 05:20
@YamatoAndo YamatoAndo changed the title feat(map_loader)!: add format_version validation feat(map_loader, route_handler)!: add format_version validation Jun 12, 2024
@YamatoAndo
Copy link
Contributor

YamatoAndo commented Jun 12, 2024

@soblin
The comment in the parse function stated as follows.
So I tried the case with format_version="1", but it resulted in a runtime error. If this is intended behavior, then there is no issue, but it seems ambiguous, so I would like the comment to be removed.

  // NOTE(Mamoru Sobue): matches `1`, `1.10`, `1.10.100`
  // `1` ==> [`1`, ``, ``]
  // `1.10` ==> [`1.`, ``, `10`]
  // `1.10.100` ==> [`1.`, `10.`, `100`]

@YamatoAndo
Copy link
Contributor

By the way, most of the maps owned by TIER IV are format_version="1", so it seems better to fix the runtime error

@soblin
Copy link
Contributor Author

soblin commented Jun 14, 2024

@YamatoAndo Thank you, I fixed the regex error. With this implementation we can parse all patterns while rejecting invalid patterns.

https://wandbox.org/permlink/CU7xaHPc50ddoiDL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:map Map creation, storage, and loading. (auto-assigned) component:planning Route planning, decision-making, and navigation. (auto-assigned)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants