carla-simulator / carla

Open-source simulator for autonomous driving research.
http://carla.org
MIT License
11.39k stars 3.69k forks source link

Enforce the traffic lights to operate according to a fixed duration #8194

Open lingyixia opened 1 month ago

lingyixia commented 1 month ago

I have known that the red light can be influenced by other traffic light within group, while how to ignore this effect? I meet a scenario that contain only a single vehicle so I do not need to consider traffic jam, I need a fixed during.

DnDare commented 1 month ago

Hi @lingyixia As explained at: https://github.com/carla-simulator/carla/issues/6121#issuecomment-1387123555 Traffic lights have defined times (Green: 10 seconds, Yellow :3 seconds, Red: 2seconds, ). In TrafficLight Groups with multiple traffic lights these times are the added in a cicle. With a single traffic light a full cicle would be 15 seconds.

If you want to isolate one traffic light, you should do it in the editor. image

If you want to try to modify the times, you should try this, I couldn't test whether they work or not, sry. https://carla.readthedocs.io/en/latest/python_api/#carla.TrafficLight.set_state image