smarts.core.sensors package

class smarts.core.sensors.SensorResolver[source]

Bases: object

An interface describing sensor observation and update systems.

observe(sim_frame: SimulationFrame, sim_local_constants: SimulationLocalConstants, agent_ids: Set[str], renderer: RendererBase, bullet_client: bc.BulletClient) Tuple[Dict[str, Observation], Dict[str, bool], Dict[str, Dict[str, Sensor]]][source]

Generate observations

Parameters:
  • sim_frame (SimulationFrame) – The simulation frame.

  • sim_local_constants (SimulationLocalConstants) – Constraints defined by the local simulator.

  • agent_ids (Set[str]) – The agents to run.

  • renderer (RendererBase) – The renderer to use.

  • bullet_client (Any) – The bullet client. This parameter is likely to be removed.

step(sim_frame: SimulationFrame, sensor_states: Iterable[SensorState])[source]

Step the sensor state.

class smarts.core.sensors.SensorState(max_episode_steps: int | None, plan_frame: PlanFrame)[source]

Bases: object

Sensor state information

get_plan(road_map: RoadMap)[source]

Get the current plan for the actor.

classmethod invalid() SensorState[source]

Generate a invalid default frame.

property reached_max_episode_steps: bool

Inbuilt sensor information that describes if episode step limit has been reached.

property seen_alive_actors: bool

If an agents alive actor has been spotted before.

property seen_interest_actors: bool

If an interest actor has been spotted before.

step()[source]

Update internal state.

property steps_completed: int

Get the number of steps where this sensor has been updated.

class smarts.core.sensors.Sensors[source]

Bases: object

Sensor related utilities

classmethod observe_serializable_sensor_batch(sim_frame: SimulationFrame, sim_local_constants: SimulationLocalConstants, agent_ids_for_group: Iterable[str]) Tuple[Dict[str, Observation], Dict[str, bool], Dict[str, Dict[str, Sensor]]][source]

Run the serializable sensors in a batch.

classmethod observe_vehicle(sim_frame: SimulationFrame, sim_local_constants: SimulationLocalConstants, interface: AgentInterface, sensor_state: SensorState, vehicle: Vehicle, renderer: RendererBase, bullet_client: bc.BulletClient) Tuple[Observation, bool, Dict[str, Sensor]][source]

Generate observations for the given agent around the given vehicle.

static process_physics_sensors(sim_frame: SimulationFrame, sim_local_constants: SimulationLocalConstants, sensor_state: SensorState, vehicle_id: str, bullet_client: bc.BulletClient) Tuple[Dict[str, Any], Dict[str, Sensor]][source]

Run observations that can only be done on the main thread.

static process_rendering_sensors(sim_frame: SimulationFrame, sim_local_constants: SimulationLocalConstants, interface: AgentInterface, sensor_state: SensorState, vehicle_id: str, renderer: RendererBase) Tuple[Dict[str, Any], Dict[str, Sensor]][source]

Run observations that can only be done on the main thread.

static process_serialization_safe_sensors(sim_frame: SimulationFrame, sim_local_constants: SimulationLocalConstants, interface: AgentInterface, sensor_state: SensorState, vehicle_id: str, agent_id: str | None = None) Tuple[Observation, bool, Dict[str, Sensor]][source]

Observations that can be done on any thread.

classmethod process_serialization_unsafe_sensors(sim_frame: SimulationFrame, sim_local_constants: SimulationLocalConstants, interface: AgentInterface, sensor_state: SensorState, vehicle_id: str, renderer: RendererBase, bullet_client: bc.BulletClient) Tuple[Dict[str, Any], Dict[str, Sensor]][source]

Run observations that can only be done on the main thread.