torchdrivesim.traffic_lights

Attributes

Classes

TrafficLightState

Generic enumeration.

TrafficLightGroupState

Representing a single state of a group of traffic lights.

TrafficLightStateMachine

TrafficLightController

Functions

Module Contents

torchdrivesim.traffic_lights.logger[source]
class torchdrivesim.traffic_lights.TrafficLightState[source]

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

none[source]
green[source]
yellow[source]
red[source]
torchdrivesim.traffic_lights.ActorStates[source]
class torchdrivesim.traffic_lights.TrafficLightGroupState[source]

Representing a single state of a group of traffic lights.

actor_states: ActorStates[source]
sequence_number: int[source]
duration: float[source]
next_state: int[source]
class torchdrivesim.traffic_lights.TrafficLightStateMachine(group_states: List[TrafficLightGroupState])[source]
_states[source]
classmethod from_json(json_file_path: str) typing_extensions.Self[source]

Current json format: [

{
“actor_states”: {

“4411”: “red”, “3411”: “red”, ………

}, “state”: “0”, “duration”: 10, “next_state”: “1”

]

to_json() str[source]
reset()[source]
set_to(state_index: int, time_remaining: float)[source]

Set the TrafficLightStateMachine to a specific state.

tick(dt: float)[source]

Update the time remaining for the current state.

property states: List[TrafficLightGroupState][source]
property duration: float[source]
property current_state: TrafficLightGroupState[source]
property time_remaining: float[source]
get_current_actor_states() ActorStates[source]
class torchdrivesim.traffic_lights.TrafficLightController(traffic_fsms: List[TrafficLightStateMachine])[source]
traffic_fsms[source]
classmethod from_json(json_file_path: str) typing_extensions.Self[source]

Current json format: [

[
{
“actor_states”: {

“4411”: “red”, “3411”: “red”, ………

}, “state”: “0”, “duration”: 10, “next_state”: “1”

]

to_json() str[source]
tick(dt)[source]
set_to(light_states: List[List[float]])[source]
reset()[source]
update_current_state_and_time()[source]
property current_state[source]
property current_state_with_name[source]
property state_per_machine[source]
property time_remaining[source]
get_number_of_light_groups()[source]
collect_all_current_light_states()[source]
torchdrivesim.traffic_lights.current_light_state_tensor_from_controller(traffic_light_controller: TrafficLightController, traffic_light_ids: List[int]) torch.Tensor[source]