smarts.core.sensor_manager module
- class smarts.core.sensor_manager.SensorManager[source]
A sensor management system that associates actors with sensors.
- add_sensor_for_actor(actor_id: str, name: str, sensor: Sensor) str [source]
Adds a sensor association for a specific actor.
- add_sensor_state(actor_id: str, sensor_state: SensorState)[source]
Add a sensor state associated with a given actor.
- clean_up_sensors_for_actors(current_actor_ids: Set[str], renderer: RendererBase)[source]
Cleans up sensors that are attached to non-existing actors.
- observe(sim_frame: SimulationFrame, sim_local_constants: SimulationLocalConstants, agent_ids: Set[str], renderer_ref: RendererBase, physics_ref: bc.BulletClient) Tuple[Dict[str, Observation], Dict[str, bool]] [source]
Runs observations and updates the sensor states. :param sim_frame: The current state from the simulation. :type sim_frame: SimulationFrame :param sim_local_constants: The values that should stay the same for a simulation over a reset. :type sim_local_constants: SimulationLocalConstants :param agent_ids: The agent ids to process. :type agent_ids: Set[str] :param renderer_ref: The renderer (if any) that should be used. :type renderer_ref: RendererBase :param physics_ref: The physics client.
- observe_batch(sim_frame: SimulationFrame, sim_local_constants: SimulationLocalConstants, interface: AgentInterface, sensor_states: Dict[str, SensorState], vehicles: Dict[str, Vehicle], renderer: RendererBase, bullet_client: bc.BulletClient) Tuple[Dict[str, Observation], Dict[str, bool]] [source]
Operates all sensors on a batch of vehicles for a single agent.
- remove_actor_sensors_by_actor_id(actor_id: str, schedule_teardown: bool = True) Iterable[Tuple[Sensor, int]] [source]
Remove association of an actor to sensors. If the sensor is no longer associated an actor, the sensor is scheduled to be removed.
- remove_sensor(sensor_id: str, schedule_teardown: bool = False) Sensor | None [source]
Remove a sensor by its id. Removes any associations it has with actors.
- remove_sensor_state_by_actor_id(actor_id: str)[source]
Add a sensor state associated with a given actor.
- sensor_state_exists(actor_id: str) bool [source]
Determines if a actor has a sensor state associated with it.
- sensor_state_for_actor_id(actor_id: str) SensorState | None [source]
Gets the sensor state for the given actor.
- sensor_states_items() Iterator[Tuple[str, SensorState]] [source]
Gets all actor to sensor state associations.
- sensors_for_actor_id(actor_id: str) List[Sensor] [source]
Gets all sensors associated with the given actor.
- sensors_for_actor_ids(actor_ids: Set[str]) Dict[str, Dict[str, Sensor]] [source]
Gets all sensors for the given actors.
- step(sim_frame: SimulationFrame, renderer: RendererBase)[source]
Update sensor values based on the new simulation state.
- teardown(renderer: RendererBase)[source]
Tear down the current sensors and clean up any internal resources.