DRIVE#

invertedai.api.drive(location: str, agent_states: List[AgentState], agent_attributes: List[AgentAttributes], recurrent_states: List[RecurrentState], 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.

  • 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 should be provided here. Any traffic light for which no state is provided will have a state generated by iai.

  • 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. If manual control of individual traffic lights is desired, modify the relevant state(s) in traffic_lights_states, then pass in light_recurrent_states as usual.

  • 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.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[dict[str, FieldInfo]] = {'agent_states': FieldInfo(annotation=List[invertedai.common.AgentState], required=True), 'api_model_version': FieldInfo(annotation=str, required=True), 'birdview': FieldInfo(annotation=Union[Image, NoneType], required=True), 'infractions': FieldInfo(annotation=Union[List[invertedai.common.InfractionIndicators], NoneType], required=True), 'is_inside_supported_area': FieldInfo(annotation=List[bool], required=True), 'light_recurrent_states': FieldInfo(annotation=Union[List[invertedai.common.LightRecurrentState], NoneType], required=True), 'recurrent_states': FieldInfo(annotation=List[invertedai.common.RecurrentState], required=True), 'traffic_lights_states': FieldInfo(annotation=Union[Dict[int, invertedai.common.TrafficLightState], NoneType], required=True)}#

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].

This replaces Model.__fields__ from Pydantic V1.

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, each key-value pair corresponds to one particular traffic light.