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(lanelet2_map_validator): enable to catch map loading issues such as invalid point elevations #205

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

TaikiYamada4
Copy link
Contributor

Description

Background

Currently, autoware_lanelet2_map_validator can validate a LaneletMap class object but cannot validate the osm file itself.
However, Autoware requires all points in the map must have an ele tag defined, which is not able to validate from a LaneletMap class object.

Osm Parser for validation

Hence, I've created an original osm parser autoware_validator_osm_parser for autoware_lanelet2_map_validator to catch errors that happen in the osm parsing phase.

I had to copy the portion of the Lanelet 2 library to create a osm_parser that can validate the ele tag in the osm file, so I made a license statement that this code copied and modified the ones in the Lanelet2 library.

Passing errors on map loading

The current autoware_lanelet2_map_validator has a problem that issues happening in the map loading phase will not be passed to the lanelet2_validation_results.json. I've reorganized the process in the validation so that the map loading issues can be passed to the final result.

Main changes in this PR

  • Create a new osm parser autoware_validator_osm_parser to validate stuff inside in the parsing phase
    • Added a feature that returns errors when a point doesn't have a ele tag and its value.
    • Let autoware_lanelet2_map_validator use autoware_validator_osm_parser to load the lanelet2 map.
  • Reorganized the validation process so that map loading issues can be written to lanelet2_validation_results.json.
  • Create a test code and test maps to test whether the autoware_validator_osm_parser can detect points that have invalid elevation.

How was this PR tested?

colcon test

Checked that all test codes passes 100%

colcon test --packages-select autoware_lanelet2_map_validator --event-handlers console_cohesion+

Usual practice

1. Succeed case

Checked that the usual ros2 run works against sample_map.osm, and see a new item [map_loading].

ros2 run autoware_lanelet2_map_validator autoware_lanelet2_map_validator -p mgrs -m ./test/data/map/sample_map.osm -i ./autoware_requirement_set.json -o ./

Screenshot from 2025-01-24 15-23-21

2. Fail case

Checked that the usual ros2 run works against single_lanelet_one_point_missing_ele.osm, and see a new item [map_loading].

ros2 run autoware_lanelet2_map_validator autoware_lanelet2_map_validator -p mgrs -m ./test/data/map/lane/single_lanelet_one_point_missing_ele.osm -i ./autoware_requirement_set.json -o ./

Screenshot from 2025-01-24 15-31-03

You can see a new requirement block map_loading is created in the lanelet2_validation_results.json.

{
    "id": "map_loading",
    "passed": false,
    "validators": [
        {
            "issues": [
                {
                    "id": 0,
                    "issue_code": "General.MapLoading-001",
                    "message": "Error reading primitive with id 13 from file: Elevation tag is not defined for the given node.",
                    "primitive": "primitive",
                    "severity": "Error"
                }
            ],
            "name": "general.map_loading",
            "passed": false
        }
    ]
}

Notes for reviewers

autoware_validator_osm_parser.cpp and autoware_validator_osm_parser.hpp is based on the code of the Lanelet2 library.

  • It is a copy of ...
  • The differences are...
    • Changed OsmFileParser to AutowareValidatorOsmFileParser and added autoware namespace to it.
    • Created AutowareValidatorOsmParser class (inherit from OsmParser) and modify the parse() method to detect invalid elevation tags.
      • In the parse() method lanelet::osm::read() changed to lanelet::osm::autoware::read() which is redirected to the read() method in AutowareValidatorOsmFileParser`.
    • Changed the readNodes() method (which is called from the read() method) so that invalid elevation can be detected.

Effects on system behavior

  • autoware_lanelet2_map_validator can detect invalid elevation definitions in a osm file.
  • autoware_lanelet2_map_validator writes issues that happened in the map loading phase.

Copy link

Thank you for contributing to the Autoware project!

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

Please ensure:

@TaikiYamada4 TaikiYamada4 marked this pull request as draft January 27, 2025 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant