Closed seominseokt closed 1 week ago
Traffic lights operate in groups, and when one group's cycle ends, it waits at a red light until the other group's cycle finishes, resulting in a longer duration of the red light.
For example, if there are two groups (Group 1 and Group 2) and each maintains green for 10 seconds, yellow for 3 seconds, and red for 2 seconds:
When Group 1's cycle ends, Group 2's cycle begins, during which Group 1 stays on red.
Thus, Group 1's red light lasts for 2 seconds (Group 1's red) + 10 seconds (Group 2's green) + 3 seconds (Group 2's yellow) + 2 seconds (Group 1's red) = 17 seconds.
Currently in Town10, I am using
world.get_snapshot().timestamp.elapsed_seconds
to monitor whether the traffic lights stay for the designated duration.Upon investigation, I found that the yellow and green lights operate exactly for the set duration, but the red light remains unchanged and persists beyond the designated time (default 2 seconds).
Below is the code I used, and upon checking the saved CSV file, it appears that even though 2 seconds have elapsed, the traffic light remains set to red.