smarts.core.sensor module

class smarts.core.sensor.AccelerometerSensor[source]

Tracks motion changes within the vehicle equipped with this sensor.

teardown(**kwargs)[source]

Clean up internal resources

class smarts.core.sensor.CameraSensor(vehicle_state: VehicleState, renderer: RendererBase, name: str, mask: int, width: int, height: int, resolution: float, build_camera: bool = True)[source]

The base for a sensor that renders images.

property camera_name: str

The name of the camera this sensor is using.

property name: str

The name of this sensor.

property serializable: bool

If this sensor can be serialized.

step(sim_frame: SimulationFrame, **kwargs)[source]

Update sensor state.

teardown(**kwargs)[source]

Clean up internal resources

class smarts.core.sensor.CustomRenderSensor(vehicle_state: VehicleState, width: int, height: int, resolution: float, renderer: RendererBase, fragment_shader_path: str, render_dependencies: Tuple[RenderDependencyBase, ...], ogm_sensor: OGMSensor | None, top_down_rgb_sensor: RGBSensor | None, drivable_area_grid_map_sensor: DrivableAreaGridMapSensor | None, occlusion_map_sensor: OcclusionMapSensor | None, name: str)[source]

Defines a configurable image sensor.

step(sim_frame: SimulationFrame, **kwargs)[source]

Update sensor state.

teardown(**kwargs)[source]

Clean up internal resources

class smarts.core.sensor.DrivableAreaGridMapSensor(vehicle_state: VehicleState, width: int, height: int, resolution: float, renderer: RendererBase)[source]

A sensor that renders drivable area from around its target actor.

class smarts.core.sensor.DrivenPathSensor(max_path_length: int = 500)[source]

Tracks the driven path as a series of positions (regardless if the vehicle is following the route or not). For performance reasons it only keeps the last N=max_path_length path segments.

distance_travelled(elapsed_sim_time, last_n_seconds: float | None = None, last_n_steps: int | None = None)[source]

Find the amount of distance travelled over the last # of seconds XOR steps

teardown(**kwargs)[source]

Clean up internal resources

track_latest_driven_path(elapsed_sim_time, vehicle_state)[source]

Records the current location of the tracked vehicle.

class smarts.core.sensor.LanePositionSensor[source]

Tracks lane-relative RefLine (Frenet) coordinates.

property mutable: bool

If this sensor mutates on call.

teardown(**kwargs)[source]

Clean up internal resources

class smarts.core.sensor.LidarSensor(vehicle_state: VehicleState, sensor_params: SensorParams | None = None, lidar_offset=(0, 0, 1))[source]

A lidar sensor.

follow_vehicle(vehicle_state: VehicleState)[source]

Update the sensor to target the given vehicle.

property serializable: bool

If this sensor can be serialized.

teardown(**kwargs)[source]

Clean up internal resources

class smarts.core.sensor.NeighborhoodVehiclesSensor(radius: float | None = None)[source]

Detects other vehicles around the sensor equipped vehicle.

property mutable: bool

If this sensor mutates on call.

property radius: float

Radius to check for nearby vehicles.

teardown(**kwargs)[source]

Clean up internal resources

class smarts.core.sensor.OGMSensor(vehicle_state: VehicleState, width: int, height: int, resolution: float, renderer: RendererBase)[source]

A sensor that renders occupancy information from around its target actor.

class smarts.core.sensor.OcclusionMapSensor(vehicle_state: VehicleState, width: int, height: int, resolution: float, renderer: RendererBase, ogm_sensor: OGMSensor, add_surface_noise: bool)[source]

A sensor that demonstrates only the areas that can be seen by the vehicle.

teardown(**kwargs)[source]

Clean up internal resources

class smarts.core.sensor.RGBSensor(vehicle_state: VehicleState, width: int, height: int, resolution: float, renderer: RendererBase)[source]

A sensor that renders color values from around its target actor.

class smarts.core.sensor.RoadWaypointsSensor(horizon: int = 32)[source]

Detects waypoints from all paths nearby the vehicle.

property mutable: bool

If this sensor mutates on call.

teardown(**kwargs)[source]

Clean up internal resources

class smarts.core.sensor.Sensor[source]

The sensor base class.

property mutable: bool

If this sensor mutates on call.

property serializable: bool

If this sensor can be serialized.

step(sim_frame: SimulationFrame, **kwargs)[source]

Update sensor state.

abstract teardown(**kwargs)[source]

Clean up internal resources

class smarts.core.sensor.SignalsSensor(lookahead: float)[source]

Reports state of traffic signals (lights) in the lanes ahead of vehicle.

teardown(**kwargs)[source]

Clean up internal resources

class smarts.core.sensor.TripMeterSensor[source]

Tracks distance travelled along the route (in meters). Meters driven while off-route are not counted as part of the total.

teardown(**kwargs)[source]

Clean up internal resources

update_distance_wps_record(waypoint_paths: List[List[Waypoint]], vehicle_state: VehicleState, plan: Plan, road_map: RoadMap)[source]

Append a waypoint to the history if it is not already counted.

class smarts.core.sensor.ViaSensor(lane_acquisition_range, speed_accuracy)[source]

Tracks collection of ViaPoint collectibles

teardown(**kwargs)[source]

Clean up internal resources

class smarts.core.sensor.WaypointsSensor(lookahead: int = 32)[source]

Detects waypoints leading forward along the vehicle plan.

property mutable: bool

If this sensor mutates on call.

teardown(**kwargs)[source]

Clean up internal resources