Skip to content

Commit

Permalink
feat(lanelet2_map_validator): add validator to check traffic light fa…
Browse files Browse the repository at this point in the history
…cing (#165)

* Added valdiator missing_referrers_for_traffic_lights

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

* Added validator traffic_light_facing

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

* Added traffic_light_facing and missing_referrers_for_traffic_lights

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

* Added new validators to README.md

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

* Added test codes for traffic_light_facing and missing_referrers_for_traffic_lights

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

* feat(lanelet2_map_validator): added issue codes  (#163)

* Added issue code processing

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

* Revised tests for json processing

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

* Added issue codes for missing_regulatory_elements_for_crosswalks

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

* Added issue codes for regulatory_element_details_for_crosswalks

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

* Added issue codes for missing_regulatory_elements_for_stop_lines

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

* Added issue codes for missing_regulatory_elements_for_traffic_lights

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

* Added issue codes for regulatory_element_details_for_traffic_lights

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

* Added issue codes to docs

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

* Change issue_code_prefix to append_issue_code_prefix

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

* Fixed merging mistake

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

---------

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

* Changed to append_issue_code_prefix.
Added test for TrafficLight.CorrectFacing-001

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

* Rearrange code structure

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

* Fixed spelling mistakes

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

* Fixed traffic_light_facing_procedure.svg

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

* Fixed mistakes in document

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

* Refine algorithm in traffic_light_facing.cpp

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

* Shorten the data collection process, and updated the procedure svg

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

* Use findUsages in missing_referrers_for_traffic_lights

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

* Update map/autoware_lanelet2_map_validator/docs/traffic_light/missing_referrers_for_traffic_lights.md

Co-authored-by: Mamoru Sobue <[email protected]>
Signed-off-by: TaikiYamada4 <[email protected]>

* style(pre-commit): autofix

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

* Quit stocking all lanelets to collect traffic light regulatory elements

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

---------

Signed-off-by: TaikiYamada4 <[email protected]>
Co-authored-by: Mamoru Sobue <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 5, 2024
1 parent 5197af4 commit 368e889
Show file tree
Hide file tree
Showing 18 changed files with 4,426 additions and 60 deletions.
2 changes: 2 additions & 0 deletions map/autoware_lanelet2_map_validator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ if(BUILD_TESTING)
add_validation_test(missing_regulatory_elements_for_traffic_lights)
add_validation_test(regulatory_elements_details_for_crosswalks)
add_validation_test(regulatory_elements_details_for_traffic_lights)
add_validation_test(traffic_light_facing)
add_validation_test(missing_referrers_for_traffic_lights)
endif()

ament_auto_package(
Expand Down
108 changes: 54 additions & 54 deletions map/autoware_lanelet2_map_validator/README.md

Large diffs are not rendered by default.

36 changes: 30 additions & 6 deletions map/autoware_lanelet2_map_validator/autoware_requirement_set.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,37 @@
"id": "vm-04-01",
"validators": [
{
"name": "mapping.crosswalk.missing_regulatory_elements"
"name": "mapping.traffic_light.missing_regulatory_elements"
},
{
"name": "mapping.crosswalk.regulatory_element_details",
"name": "mapping.traffic_light.missing_referrers",
"prerequisites": [
{
"name": "mapping.crosswalk.missing_regulatory_elements"
"name": "mapping.traffic_light.missing_regulatory_elements"
}
]
},
{
"name": "mapping.traffic_light.regulatory_element_details",
"prerequisites": [
{
"name": "mapping.traffic_light.missing_regulatory_elements"
}
]
}
]
},
{
"id": "vm-04-02",
"validators": [
{
"name": "mapping.traffic_light.correct_facing",
"prerequisites": [
{
"name": "mapping.traffic_light.missing_referrers"
},
{
"name": "mapping.traffic_light.regulatory_element_details"
}
]
}
Expand All @@ -28,13 +52,13 @@
"id": "vm-05-01",
"validators": [
{
"name": "mapping.traffic_light.missing_regulatory_elements"
"name": "mapping.crosswalk.missing_regulatory_elements"
},
{
"name": "mapping.traffic_light.regulatory_element_details",
"name": "mapping.crosswalk.regulatory_element_details",
"prerequisites": [
{
"name": "mapping.traffic_light.missing_regulatory_elements"
"name": "mapping.crosswalk.missing_regulatory_elements"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# missing_referrers_for_traffic_lights

## Validator name

mapping.traffic_light.missing_referrers

## Feature

This validator checks whether each `traffic_light` type regulatory element has been referred by at least one lanelet.

| Issue Code | Message | Severity | Primitive | Description | Approach |
| --------------------------------- | ----------------------------------------------------------------------------- | -------- | ------------------ | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| TrafficLight.MissingReferrers-001 | Regulatory element of traffic light must be referred by at least one lanelet. | Error | Regulatory Element | There is a `traffic_light` type regulatory element that hasn't been referred by any lanelet. | The lanelet that might be controlled by the traffic light must refer this regulatory element. |

## Related source codes

- missing_referrers_for_traffic_lights.cpp
- missing_referrers_for_traffic_lights.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# traffic_light_facing

## Validator name

mapping.traffic_light.correct_facing

## Recommended prerequisite validators

- mapping.traffic_light.missing_referrers
- mapping.traffic_light.regulatory_element_details

## Feature

This validator checks whether each `traffic_light` linestring is drawn with the correct direction, because the linestring direction describes the facing of the traffic_light.
If the traffic light is facing to the viewer, the traffic light linestring must be drawn from the left point to the right point seen from the viewer.
Note that this validator only check traffic lights whose subtype are `red_yellow_green`.
This validator checks five types of issues.
The former three issues are related to prerequisites to perform correct validation rather than direct validation results of the traffic light facing.
The latter two issues mention to the traffic light facing.

All output issues specify the traffic_light "linestring" or the traffic_light "regulatory_element" as the **primitive**, and the primitive ID will be specified as the **ID**.

| Issue Code | Message | Severity | Primitive | Description | Approach |
| ------------------------------ | ----------------------------------------------------------------------------- | -------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| TrafficLight.CorrectFacing-001 | "Lanelets referring this traffic_light have several divergent starting lines" | Info | Linestring | A `traffic_light` subtype regulatory element may be referred by multiple lanelets. This warning appears when the starting line of those lanelets (which tends to be the same or similar) diverge too much. | This hardly happens, but maybe the referring lanelet is completely wrong or the traffic light cannot be seen from the starting edge of the referring lanelet. |
| TrafficLight.CorrectFacing-002 | "The linestring direction seems to be wrong." | Error | Linestring | This `traffic_light` type linestring is drawn with the wrong direction. | Fix the traffic light linestring so that it is drawn from the left to the right seen from the stop line. |
| TrafficLight.CorrectFacing-003 | "The linestring direction has been judged as both correct and wrong." | Warning | Linestring | The validator cannot judge whether the direction of this `traffic_light` type linestring is correct. (Mostly they are correct.) This occurs from special regulatory element definitions and technical issues written below. | This occurs in the [Difficult Case](#difficult-cases) written below. This validator currently cannot determine that the traffic light facing is correct in this case, so please recheck it by yourself and please ignore it if it is correct. |

### Procedure

This flow chart shows the simplified procedure how the validation is done.

![traffic_light_facing_procedure](../../media/traffic_light_facing_procedure.svg)

### Difficult cases

Currently, this validator assumes that all traffic lights in the same regulatory element has the same facing.
However, there might be cases that this assumption doesn't hold, and this is only when traffic lights on the other side of the road is in the same regulatory element.
It is hard to tell that this traffic light is for this road or the opposite road since the facing of the traffic light is unknown yet, so this validator keeps its ambiguity for now.
This kind of traffic light will be judged as correct from the this side but not from the other side, and it will be misjudged oppositely if the traffic light linestring id drawn wrong.
This validator will throws a warning for this case and tells the user to check it by their own.

We assume that this kind of traffic light could be found only a few, but if you feel this concerning you can remove the traffic light on the other road from the regulatory element. This workaround affects nothing if your planning module doesn't utilize the information that the traffic light on the other road has the same timing of lighting.

![difficult_cases_in_traffic_light_facing](../../media/traffic_light_facing_difficult_cases.svg)

## Related source codes

- traffic_light_facing.hpp
- traffic_light_facing.cpp
Loading

0 comments on commit 368e889

Please sign in to comment.