DRIVE#

invertedai.api.drive(location: str, agent_states: List[AgentState], agent_attributes: Optional[List[AgentAttributes]] = None, agent_properties: Optional[List[AgentProperties]] = None, recurrent_states: Optional[List[RecurrentState]] = None, traffic_lights_states: Optional[Dict[int, TrafficLightState]] = None, light_recurrent_states: Optional[List[LightRecurrentState]] = None, get_birdview: bool = False, rendering_center: Optional[Tuple[float, float]] = None, rendering_fov: Optional[float] = None, get_infractions: bool = False, random_seed: Optional[int] = None, api_model_version: Optional[str] = None) DriveResponse[source]#
Parameters:
  • location – Location name in IAI format.

  • agent_states – Current states of all agents. The state must include x: [float], y: [float] coordinate in meters orientation: [float] in radians with 0 pointing along x and pi/2 pointing along y and speed: [float] in m/s.

  • agent_attributes – Static attributes of all agents. List of agent attributes. Each agent requires, length: [float] width: [float] and rear_axis_offset: [float] all in meters. agent_type: [str], currently supports ‘car’ and ‘pedestrian’. waypoint: optional [Point], the target waypoint of the agent.

  • agent_properties – Agent properties for all agents, replacing soon to be deprecated agent_attributes. List of agent attributes. Each agent requires, length: [float] width: [float] and rear_axis_offset: [float] all in meters. agent_type: [str], currently supports ‘car’ and ‘pedestrian’. waypoint: optional [Point], the target waypoint of the agent. max_speed: optional [float], the desired maximum speed of the agent in m/s.

  • recurrent_states – Recurrent states for all agents, obtained from the previous call to drive() or initialize().

  • get_birdview – Whether to return an image visualizing the simulation state. This is very slow and should only be used for debugging.

  • rendering_center – Optional center coordinates for the rendered birdview.

  • rendering_fov – Optional fov for the rendered birdview.

  • get_infractions – Whether to check predicted agent states for infractions. This introduces some overhead, but it should be relatively small.

  • traffic_lights_states – If the location contains traffic lights within the supported area, their current state can be provided here. It is legal to not provide this field, and use ‘light_recurrent_states’ to step the traffic lights. If provided, light states from ‘traffic_light_states’ will override the original light states given by ‘light_recurrent_states’. The server does not currently support continuing user-provided light state sequences, so once the states are provided at any step, they should also be provided on all subsequent steps to guarantee coherent light sequences. If neither ‘traffic_lights_states’ nor ‘light_recurrent_states’ are provided, the server will arbitrarily initialize the traffic light states, and return the associated ‘light_recurrent_states’ in the response.

  • light_recurrent_states

    Light recurrent states for all agents, obtained from the previous call to

    drive() or initialize().

    Specifies the state and time remaining for each light group in the map. To let the server manage all light states in the scene, pass ‘light_recurrent_states’ from the previous response of drive() here and leave traffic_light_states=None.

  • random_seed – Controls the stochastic aspects of agent behavior for reproducibility.

  • api_model_version – Optionally specify the version of the model. If None is passed which is by default, the best model will be used.


class invertedai.api.DriveResponse(*, agent_states: List[AgentState], recurrent_states: List[RecurrentState], birdview: Optional[Image], infractions: Optional[List[InfractionIndicators]], is_inside_supported_area: List[bool], traffic_lights_states: Optional[Dict[int, TrafficLightState]], light_recurrent_states: Optional[List[LightRecurrentState]], api_model_version: str)[source]#

Response returned from an API call to iai.drive().

agent_states: List[AgentState]#

Predicted states for all agents at the next time step.

api_model_version: str#
birdview: Optional[Image]#

If get_birdview was set, this contains the resulting image.

infractions: Optional[List[InfractionIndicators]]#

If get_infractions was set, they are returned here.

is_inside_supported_area: List[bool]#

For each agent, indicates whether the predicted state is inside supported area.

light_recurrent_states: Optional[List[LightRecurrentState]]#

Light recurrent states for the full map, each element corresponds to one light group. Pass this to the next call of iai.drive() for the server to realistically update the traffic light states.

recurrent_states: List[RecurrentState]#

To pass to iai.drive() at the subsequent time step.

traffic_lights_states: Optional[Dict[int, TrafficLightState]]#

Traffic light states for the full map, as seen by the agents before they performed their actions resulting in the returned state. Each key-value pair corresponds to one particular traffic light.