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(autoware_lanelet2_map_validator): allow prerequisites attribute for input #147

Conversation

TaikiYamada4
Copy link
Contributor

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

  • You can test scenarios like "making a loop of prerequisites" or "self referring" which should be detected.
  • Technically speaking, mapping.crosswalk.regulatory_element_details doesn't have to have mapping.crosswalk.missing_regulatory_elements as a prerequisite, but I set autoware_requirement_set.json as it is now to demonstrate how prerequisites attribute works. After a validator that definitely needs a prerequisite appears, I may remove the prerequisites attribute from mapping.crosswalk.missing_regulatory_elements and mapping.traffic_light.missing_regulatory_elements

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.

  • 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.

Signed-off-by: TaikiYamada4 <[email protected]>
Copy link
Contributor

@soblin soblin left a comment

Choose a reason for hiding this comment

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

I think "describe" is what you mean by "descript" actually

Signed-off-by: TaikiYamada4 <[email protected]>
Signed-off-by: TaikiYamada4 <[email protected]>
@TaikiYamada4 TaikiYamada4 merged commit 7906f5e into autowarefoundation:main Nov 11, 2024
16 checks passed
@TaikiYamada4 TaikiYamada4 deleted the feat/lanelet2_map_validator/add_prerequistes branch November 11, 2024 04:14
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.

2 participants