smarts.sstudio.sstypes.dataset module

class smarts.sstudio.sstypes.dataset.TrafficHistoryDataset(name: str, source_type: str, input_path: str | None = None, scenario_id: str | None = None, x_margin_px: float = 0.0, y_margin_px: float = 0.0, swap_xy: bool = False, flip_y: bool = False, filter_off_map: bool = False, map_lane_width: float = 3.7, real_lane_width_m: float = 3.7, speed_limit_mps: float | None = None, heading_inference_window: int = 2, heading_inference_min_speed: float = 2.2, max_angular_velocity: float | None = None, default_heading: float = 4.71238898038469)[source]

Describes a dataset containing trajectories (time-stamped positions) for a set of vehicles. Often these have been collected by third parties from real-world observations, hence the name ‘history’. When used with a SMARTS scenario, traffic vehicles will move on the map according to their trajectories as specified in the dataset. These can be mixed with other types of traffic (such as would be specified by an object of the Traffic type in this DSL). In order to use this efficiently, SMARTS will pre-process (‘import’) the dataset when the scenario is built.

default_heading: float = 4.71238898038469

A heading in radians to be used by default for vehicles if the headings are not present in the dataset and cannot be inferred from position changes (such as on the first time step).

filter_off_map: bool = False

if True, then any vehicle whose coordinates on a time step fall outside of the map’s bounding box will be removed for that time step

flip_y: bool = False

if True, the dataset will be mirrored around the x-axis

heading_inference_min_speed: float = 2.2

Speed threshold below which a vehicle’s heading is assumed not to change. This is useful to prevent abnormal heading changes that may arise from noise in position estimates in a trajectory dataset dominating real position changes in situations where the real position changes are very small. Defaults to 2.2 m/s if not specified.

heading_inference_window: int = 2

When inferring headings from positions, a sliding window (moving average) of this size will be used to smooth inferred headings and reduce their dependency on any individual position changes. Defaults to 2 if not specified.

input_path: str | None = None

a relative or absolute path to the dataset; if omitted, dataset will not be imported

map_lane_width: float = 3.7

1 scale - the default.) It’s also used in SMARTS for detecting off-road, etc.

Type:

This is used to figure out the map scale, which is map_lane_width / real_lane_width_m. (So use real_lane_width_m here for 1

max_angular_velocity: float | None = None

When inferring headings from positions, each vehicle’s angular velocity will be limited to be at most this amount (in rad/sec) to prevent lateral-coordinate noise in the dataset from causing near-instantaneous heading changes.

name: str

a unique name for the dataset

real_lane_width_m: float = 3.7

Average width in meters of the dataset’s lanes in the real world. US highway lanes are about 12 feet (or ~3.7m, the default) wide.

scenario_id: str | None = None

a unique ID for a Waymo scenario. For other datasets, this field will be None.

source_type: str

the type of the dataset; supports values in (NGSIM, INTERACTION, Waymo, Argoverse)

speed_limit_mps: float | None = None

used by SMARTS for the initial speed of new agents being added to the scenario

swap_xy: bool = False

if True, the x and y axes the dataset coordinate system will be swapped

x_margin_px: float = 0.0

x offset of the map from the data (in pixels)

y_margin_px: float = 0.0

y offset of the map from the data (in pixels)