smarts.dataset.traffic_histories_to_observations module

class smarts.dataset.traffic_histories_to_observations.ObservationRecorder(scenario: str, output_dir: str | None, seed: int = 42, agent_interface: AgentInterface | None = None, start_time: float | None = None, end_time: float | None = None)[source]

Generate SMARTS observations from the perspective of one or more social/history vehicles within a SMARTS scenario.

Parameters:
  • scenario (str) – A path to a scenario to run. Note: the scenario should already have been built using scl scenario build ….

  • output_dir (str) – Path to the directory for the output files. Will be created if necessary.

  • seed (int) – Seed for random number generation. Default: 42.

  • agent_interface (AgentInterface, optional) – Agent interface to be used for recorded vehicles. If not provided, will use a default interface with all sensors enabled.

  • start_time (float, Optional) – The start time (in seconds) of the window within which observations should be recorded.”

  • end_time (float, Optional) – The end time (in seconds) of the window within which observations should be recorded.”

collect(vehicles_with_sensors: Sequence[int] | None, headless: bool = True)[source]

Records SMARTS observations for selected vehicles.

Parameters:
  • vehicles_with_sensors (Sequence[int], optional) – A list of vehicle_ids within the scenario to which to attach sensors and record Observations. If not specified, this will default the ego vehicle of the scenario if there is one. If not, this will default to all vehicles in the scenario.

  • headless (bool, optional) – Whether to run the simulation in headless mode. Defaults to True.