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

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/64fc959f-88e5-50ce-9360-7c57d7940ea7?project_id=prd_jt

https://evaluation.tier4.jp/evaluation/reports/50c7b099-3375-5eb9-8fd5-710fe2011a9c?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 run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label May 21, 2024
@YamatoAndo YamatoAndo removed the 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
@soblin soblin requested a review from zulfaqar-azmi-t4 as a code owner 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

Copy link
Contributor

@YamatoAndo YamatoAndo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (map_loader)

soblin added 2 commits July 5, 2024 11:31
Signed-off-by: Mamoru Sobue <[email protected]>
Signed-off-by: Mamoru Sobue <[email protected]>
@soblin soblin requested a review from mkquda as a code owner July 5, 2024 05:37
Copy link

github-actions bot commented Jul 5, 2024

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

Signed-off-by: Mamoru Sobue <[email protected]>
@soblin soblin added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Jul 9, 2024
@soblin soblin force-pushed the feat/map_loader_format_version_validation branch from 422f6f5 to 3f1014e Compare July 9, 2024 12:49
Copy link

codecov bot commented Jul 9, 2024

Codecov Report

Attention: Patch coverage is 18.18182% with 18 lines in your changes missing coverage. Please review.

Project coverage is 28.44%. Comparing base (458dbe5) to head (3f1014e).
Report is 7 commits behind head on main.

Files Patch % Lines
...c/lanelet2_map_loader/lanelet2_map_loader_node.cpp 5.88% 16 Missing ⚠️
...nning/autoware_route_handler/src/route_handler.cpp 60.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7074   +/-   ##
=======================================
  Coverage   28.44%   28.44%           
=======================================
  Files        1591     1594    +3     
  Lines      116213   116247   +34     
  Branches    49615    49634   +19     
=======================================
+ Hits        33059    33070   +11     
- Misses      74132    74153   +21     
- Partials     9022     9024    +2     
Flag Coverage Δ *Carryforward flag
differential 24.97% <18.18%> (?)
total 28.44% <ø> (ø) Carriedforward from 458dbe5

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@soblin soblin merged commit 951d4cc into autowarefoundation:main Jul 9, 2024
28 of 30 checks passed
@soblin soblin deleted the feat/map_loader_format_version_validation branch July 9, 2024 13:43
Ariiees pushed a commit to Ariiees/autoware.universe that referenced this pull request Jul 22, 2024
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) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants