Skip to content

Fixed a bug in Phase::evaluate where states were missing except for the last state when multiple states existed for the same ID#1734

Merged
HansRobo merged 8 commits intomasterfrom
fix/multiple_states_on_phase
Nov 13, 2025
Merged

Fixed a bug in Phase::evaluate where states were missing except for the last state when multiple states existed for the same ID#1734
HansRobo merged 8 commits intomasterfrom
fix/multiple_states_on_phase

Conversation

@HansRobo
Copy link
Copy Markdown
Member

@HansRobo HansRobo commented Nov 10, 2025

Description

Abstract

When multiple TrafficSignalState are specified in Phase in TrafficSignalController, states except the last one are missing.
This is because TrafficSignalState::evaluate overwrite the state of traffic light every time.
The traffic light state manipulation previously only provided an overwrite operation with set, but by adding clear/add, I have made it possible to perform flexible operations and reset the state only once per frame in this pull-request.

Details

Test with TrafficSignals.yaml

Traffic lights output comparison when traffic signal controller controller-1 is on phase-3.

before this pull-request
---
traffic_lights:
- lanelet_way_id: 34836
  traffic_light_bulbs:
  - enum_revision: 0
    color: 1
    shape: 1
    status: 2
    confidence: 1.0
- lanelet_way_id: 34802
  traffic_light_bulbs:
  - enum_revision: 0
    color: 3
    shape: 2
    status: 2
    confidence: 1.0
after this pull-request
---
traffic_lights:
- lanelet_way_id: 34836
  traffic_light_bulbs:
  - enum_revision: 0
    color: 1
    shape: 1
    status: 2
    confidence: 1.0
- lanelet_way_id: 34802
  traffic_light_bulbs:
  - enum_revision: 0
    color: 3
    shape: 2
    status: 2
    confidence: 1.0
  - enum_revision: 0 # this bulb is missing before this pull-request
    color: 1
    shape: 1
    status: 2
    confidence: 1.0

References

Regression Test: OK

Destructive Changes

None

Known Limitations

None

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 10, 2025

Checklist for reviewers ☑️

All references to "You" in the following text refer to the code reviewer.

  • Is this pull request written in a way that is easy to read from a third-party perspective?
  • Is there sufficient information (background, purpose, specification, algorithm description, list of disruptive changes, and migration guide) in the description of this pull request?
  • If this pull request contains a destructive change, does this pull request contain the migration guide?
  • Labels of this pull request are valid?
  • All unit tests/integration tests are included in this pull request? If you think adding test cases is unnecessary, please describe why and cross out this line.
  • The documentation for this pull request is enough? If you think adding documents for this pull request is unnecessary, please describe why and cross out this line.

@HansRobo HansRobo self-assigned this Nov 10, 2025
@HansRobo HansRobo added bug Something isn't working wait for regression test bump patch If this pull request merged, bump patch version of the scenario_simulator_v2 labels Nov 10, 2025
@HansRobo HansRobo marked this pull request as ready for review November 11, 2025 02:16
@sonarqubecloud
Copy link
Copy Markdown

@HansRobo HansRobo merged commit d0e88ad into master Nov 13, 2025
14 checks passed
@HansRobo HansRobo deleted the fix/multiple_states_on_phase branch November 13, 2025 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working bump patch If this pull request merged, bump patch version of the scenario_simulator_v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants