Skip to content

Commit cd9cea2

Browse files
committed
Adjust traffic light logic to set yellow lights to red for walking lanes
1 parent 99cf5d2 commit cd9cea2

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

mosstool/map/_map_util/junctions/gen_traffic_light.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,12 @@ def _gen_fixed_program(
402402
len(output_phases) > 0 or len(phases) == 0
403403
), f"No valid phases for junction {junc_id}"
404404

405+
# set yellow light to red for walking lanes
406+
for idx, phase in enumerate(output_phases):
407+
for i, l in enumerate(phase["states"]):
408+
if i in walk_indexes_set and l == lightv2.LIGHT_STATE_YELLOW:
409+
phase["states"][i] = lightv2.LIGHT_STATE_RED
410+
405411
# trying to use rule-based traffic light phases
406412
rule_based_phases = _rule_based_traffic_light(
407413
j, lanes, roads, green_time, yellow_time, traffic_light_mode

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "mosstool"
3-
version = "1.3.11"
3+
version = "1.3.12"
44
description = "MObility Simulation System toolbox "
55
authors = ["Jun Zhang <zhangjun990222@qq.com>","Junbo Yan <yanjb20thu@gmali.com>"]
66
license = "MIT"

0 commit comments

Comments
 (0)