Various errors in examples for traffic signals
All examples for the traffic lights have many issues and won't work. This is my analysis of example 1:
tl: traffic_light with:
keep(it.bulbs.size() == 4 && it.bulbs[0].color == red && it.bulbs[1].color == red && it.bulbs[2].color == yellow && it.bulbs[3].color == green)
We don't have &&
. The operator is called and
, but I'd suggest writing this als separate constraints instead of one long train of and-operations.
# drive from traffic light
sut.car.drive() with:
a: along(stop_line at: start)
override(a, run_mode: best_effort)
You cannot have labels (a:) on modifiers or override them, only actions. Also, a comma after stop_line is missing.
stop_line: traffic_light_stop_line with:
keep(it.traffic_light_group == tl.group)
# change light to yellow and wait for 2s
tl_controller.set_group_state(tl.group, [is_off, is_off, is_on, is_off])
wait elapsed(2s)
# change light to green
tl_controller.set_group_state(tl.group, [is_off, is_off, is_off, is_on])
# drive
sut.car.drive()
struct traffic_light does not have a field named group
. In addition, the set_group_state
action is defined to have an infinite duration, so anything that comes after that will never be executed.
The other examples have similar issues.