torchdrivesim.map ================= .. py:module:: torchdrivesim.map Classes ------- .. autoapisummary:: torchdrivesim.map.Stopline torchdrivesim.map.MapConfig Functions --------- .. autoapisummary:: torchdrivesim.map._filename_defaults torchdrivesim.map.resolve_paths_to_absolute torchdrivesim.map.load_map_config torchdrivesim.map.store_map_config torchdrivesim.map.find_map_config torchdrivesim.map.download_iai_map torchdrivesim.map.traffic_controls_from_map_config torchdrivesim.map.find_wrong_way_stoplines Module Contents --------------- .. py:class:: Stopline .. py:attribute:: actor_id :type: int .. py:attribute:: agent_type :type: str .. py:attribute:: x :type: float .. py:attribute:: y :type: float .. py:attribute:: length :type: float .. py:attribute:: width :type: float .. py:attribute:: orientation :type: float .. py:method:: __post_init__() .. py:class:: MapConfig Encapsulates various map metadata, including where to find files defining the map. Map definition includes a coordinate frame and traffic signals. .. py:attribute:: name :type: str .. py:attribute:: left_handed_coordinates :type: bool :value: False .. py:attribute:: center :type: Optional[Tuple[float, float]] :value: None .. py:attribute:: lanelet_path :type: Optional[str] :value: None .. py:attribute:: lanelet_map_origin :type: Tuple[float, float] :value: (0, 0) .. py:attribute:: mesh_path :type: Optional[str] :value: None .. py:attribute:: stoplines_path :type: Optional[str] :value: None .. py:attribute:: traffic_light_controller_path :type: Optional[str] :value: None .. py:attribute:: iai_location_name :type: Optional[str] :value: None .. py:attribute:: note :type: Optional[str] :value: None .. py:property:: lanelet_map :type: Optional[torchdrivesim.lanelet2.LaneletMap] .. py:property:: road_mesh :type: Optional[torchdrivesim.mesh.BirdviewMesh] .. py:property:: stoplines :type: List[Stopline] .. py:property:: traffic_light_controller :type: Optional[torchdrivesim.traffic_lights.TrafficLightController] .. py:function:: _filename_defaults(name: str) -> Dict[str, str] .. py:function:: resolve_paths_to_absolute(cfg: MapConfig, root: str) -> MapConfig .. py:function:: load_map_config(json_path: str, resolve_paths: bool = True) -> MapConfig .. py:function:: store_map_config(cfg: MapConfig, json_path: str, store_absolute_paths: bool = False) -> None .. py:function:: find_map_config(map_name: str, resolve_paths: bool = True) -> Optional[MapConfig] 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. .. py:function:: download_iai_map(location_name: str, save_path: str) -> None 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`. .. py:function:: traffic_controls_from_map_config(cfg: MapConfig) -> Dict[str, torchdrivesim.traffic_controls.BaseTrafficControl] .. py:function:: find_wrong_way_stoplines(map_cfg: MapConfig, angle_threshold: float = np.pi / 6) -> List[int]