- invertedai.api.initialize(location: str, agent_attributes: Optional[List[AgentAttributes]] = None, states_history: Optional[List[List[AgentState]]] = None, traffic_light_state_history: Optional[List[Dict[int, TrafficLightState]]] = None, get_birdview: bool = False, location_of_interest: Optional[Tuple[float, float]] = None, get_infractions: bool = False, agent_count: Optional[int] = None, random_seed: Optional[int] = None) InitializeResponse #
Initializes a simulation in a given location. Either agent_count or both agent_attributes and states_history need to be provided. In the latter case, the simulation is initialized with the specific history, and if traffic lights are present then traffic_light_state_history should also be provided. If only agent_count is specified, a new initial state is generated with the requested total number of agents, i.e. when an empty list or None is passed for ‘states_history’. Otherwise, if the agent_count is higher than the number of agents in states_history the remaining agents will be spawned conditionally on the provided agents. If agent_count is equal to the number of agents in states_history, the simulation will be initialized only with the agents provided. Finally, ‘agent_count’ cannot be less than he number of agents in states_history. Every simulation needs to start with a call to this function in order to obtain correct recurrent states for
location – Location name in IAI format.
agent_attributes – Static attributes for all agents.
states_history – History of agent states - the outer list is over time and the inner over agents, in chronological order, i.e., index 0 is the oldest state and index -1 is the current state. For best results, provide at least 10 historical states for each agent.
traffic_light_state_history – History of traffic light states - the list is over time, in chronological order. Traffic light states should be provided for all time steps where agent states are specified.
location_of_interest – Optional coordinates for spawning agents with the given location as center instead of the default map center
get_birdview – If True, a birdview image will be returned representing the current world. Note this will significantly impact on the latency.
get_infractions – If True, infraction metrics will be returned for each agent.
agent_count – If states_history is not specified, this needs to be provided and dictates how many agents will be spawned.
random_seed – Controls the stochastic aspects of initialization for reproducibility.
- class invertedai.api.InitializeResponse(*, recurrent_states: List[Optional[RecurrentState]], agent_states: List[Optional[AgentState]], agent_attributes: List[Optional[AgentAttributes]], birdview: Optional[Image] = None, infractions: Optional[List[InfractionIndicators]] = None)#
Response returned from an API call to
- infractions: Optional[List[InfractionIndicators]]#
If get_infractions was set, they are returned here.