torchdrivesim.map

Classes

Stopline

MapConfig

Encapsulates various map metadata, including where to find files defining the map.

Functions

_filename_defaults(→ Dict[str, str])

resolve_paths_to_absolute(→ MapConfig)

load_map_config(→ MapConfig)

store_map_config(→ None)

find_map_config(→ Optional[MapConfig])

To retrieve configs for maps not bundled with the package,

download_iai_map(→ None)

Downloads the map information using LOCATION_INFO from the Inverted AI API.

traffic_controls_from_map_config(→ Dict[str, ...)

find_wrong_way_stoplines(→ List[int])

Module Contents

class torchdrivesim.map.Stopline[source]
actor_id: int[source]
agent_type: str[source]
x: float[source]
y: float[source]
length: float[source]
width: float[source]
orientation: float[source]
__post_init__()[source]
class torchdrivesim.map.MapConfig[source]

Encapsulates various map metadata, including where to find files defining the map. Map definition includes a coordinate frame and traffic signals.

name: str[source]
left_handed_coordinates: bool = False[source]
center: Tuple[float, float] | None = None[source]
lanelet_path: str | None = None[source]
lanelet_map_origin: Tuple[float, float] = (0, 0)[source]
mesh_path: str | None = None[source]
stoplines_path: str | None = None[source]
traffic_light_controller_path: str | None = None[source]
iai_location_name: str | None = None[source]
note: str | None = None[source]
property lanelet_map: torchdrivesim.lanelet2.LaneletMap | None[source]
property road_mesh: torchdrivesim.mesh.BirdviewMesh | None[source]
property stoplines: List[Stopline][source]
property traffic_light_controller: torchdrivesim.traffic_lights.TrafficLightController | None[source]
torchdrivesim.map._filename_defaults(name: str) Dict[str, str][source]
torchdrivesim.map.resolve_paths_to_absolute(cfg: MapConfig, root: str) MapConfig[source]
torchdrivesim.map.load_map_config(json_path: str, resolve_paths: bool = True) MapConfig[source]
torchdrivesim.map.store_map_config(cfg: MapConfig, json_path: str, store_absolute_paths: bool = False) None[source]
torchdrivesim.map.find_map_config(map_name: str, resolve_paths: bool = True) MapConfig | None[source]

To retrieve configs for maps not bundled with the package, folders with corresponding names must be placed inside one of the directories listed in TDS_RESOURCE_PATH environment variable. Note that map names should be globally unique.

torchdrivesim.map.download_iai_map(location_name: str, save_path: str) None[source]

Downloads the map information using LOCATION_INFO from the Inverted AI API. IAI_API_KEY needs to be set for this to succeed. Basename of save_path will be used as the map name for TorchDriveSim. If the dirpath of save_path is in TDS_RESOURCE_PATH, the map will be immediately available in find_map_config.

torchdrivesim.map.traffic_controls_from_map_config(cfg: MapConfig) Dict[str, torchdrivesim.traffic_controls.BaseTrafficControl][source]
torchdrivesim.map.find_wrong_way_stoplines(map_cfg: MapConfig, angle_threshold: float = np.pi / 6) List[int][source]