autowarefoundation / autoware_tools

Apache License 2.0
17 stars 34 forks source link

feat(autoware_lanelet2_map_validator): allow prerequisites attribute for input #147

Closed TaikiYamada4 closed 2 weeks ago

TaikiYamada4 commented 2 weeks ago

Description

This PR introduces the concept of prerequisites to autoware_lanelet2_map_validator.

Since autoware_lanelet2_map_validator is a collection of small validators, some redundancy is expected. For example, one validator might need to check for unrelated map flaws to ensure safe execution, and this checking procedure might overlap with that of another validator. Therefore map requirements should have validation orders such like "Validation B should be done only when validation A has passed". The prerequisites attribute will allow the JSON input to control the validation order.

Since the validation process have been a bit complex due to this change, I moved the process_requirements() function to validation.cpp from main.cpp not to make main.cpp long too much.

Test codes are also added regarding the JSON processing in this validator.

Related links

None

Tests performed

1. General execution

I tried the following command and I get the results shown in the screenshot. You can see that mapping.crosswalk.regulatory_element_details fails because mapping.crosswalk.missing_regulatory_elements has failed before. (Before applying this PR, mapping.crosswalk.regulatory_element_details could oass the validation`)

ros2 run autoware_lanelet2_map_validator autoware_lanelet2_map_validator -m ./src/universe/autoware.universe/common/autoware_test_utils/test_map/lanelet2_map.osm -p mgrs -i autoware_requirement_set.json -o ./ 

Screenshot from 2024-11-08 14-15-15

2. colcon test

You can see the test for json processing is added by the following command.

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

You might get something like this

1: Running main() from /opt/ros/humble/src/gtest_vendor/src/gtest_main.cc
1: [==========] Running 7 tests from 1 test suite.
1: [----------] Global test environment set-up.
1: [----------] 7 tests from JsonProcessingTest
1: [ RUN      ] JsonProcessingTest.ParseValidatorsWithValidInput
1: [       OK ] JsonProcessingTest.ParseValidatorsWithValidInput (1 ms)
1: [ RUN      ] JsonProcessingTest.CreateValidationQueueNoCycles
1: [       OK ] JsonProcessingTest.CreateValidationQueueNoCycles (0 ms)
1: [ RUN      ] JsonProcessingTest.CreateValidationQueueWithCycles
1: [       OK ] JsonProcessingTest.CreateValidationQueueWithCycles (0 ms)
1: [ RUN      ] JsonProcessingTest.CheckPrerequisiteCompletionSuccess
1: [       OK ] JsonProcessingTest.CheckPrerequisiteCompletionSuccess (0 ms)
1: [ RUN      ] JsonProcessingTest.CheckPrerequisiteCompletionFailure
1: [       OK ] JsonProcessingTest.CheckPrerequisiteCompletionFailure (0 ms)
1: [ RUN      ] JsonProcessingTest.DescriptUnusedValidatorsToJson
1: [       OK ] JsonProcessingTest.DescriptUnusedValidatorsToJson (2 ms)
1: [ RUN      ] JsonProcessingTest.SummarizeValidatorResults
1: [       OK ] JsonProcessingTest.SummarizeValidatorResults (1 ms)
1: [----------] 7 tests from JsonProcessingTest (4 ms total)
1: 
1: [----------] Global test environment tear-down
1: [==========] 7 tests from 1 test suite ran. (4 ms total)
1: [  PASSED  ] 7 tests.

Notes for reviewers

Interface changes

Effects on system behavior

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.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

After all checkboxes are checked, anyone who has write access can merge the PR.

github-actions[bot] commented 2 weeks ago

Documentation URL: https://autowarefoundation.github.io/autoware_tools/pr-147/ Modified URLs: