smarts.core.argoverse_map module
- class smarts.core.argoverse_map.ArgoverseMap(map_spec: MapSpec, avm: av2.map.map_api.ArgoverseStaticMap)[source]
A road map for an Argoverse 2 scenario.
- DEFAULT_LANE_SPEED = 16.67
- LANE_MARKINGS = frozenset({av2.map.lane_segment.LaneMarkType.SOLID_WHITE, av2.map.lane_segment.LaneMarkType.DASHED_WHITE, av2.map.lane_segment.LaneMarkType.SOLID_DASH_WHITE, av2.map.lane_segment.LaneMarkType.DASH_SOLID_WHITE, av2.map.lane_segment.LaneMarkType.DOUBLE_DASH_WHITE, av2.map.lane_segment.LaneMarkType.DOUBLE_SOLID_WHITE, av2.map.lane_segment.LaneMarkType.NONE})
- class Lane(map: ArgoverseMap, lane_id: str, lane_seg: av2.map.lane_segment.LaneSegment, index: int)[source]
Lane representation for Argoverse maps.
- property bounding_box
Gets the lane bounding box.
- property center_polyline: List[Point]
Should return a list of the points along the center-line of the lane, in the order they will be encountered in the direction of travel.
Note: not all map types will be able to implement this method, so use with care. This was added to support those that wish to make use of the SegmentCache class below.
- contains_point(point: Point) bool [source]
Returns True if this point is fully contained by this surface. For some regions of some maps, it may not be possible to determine this. In such indeterminate cases, it is recommended to return True.
- property foes: List[Lane]
All lanes that in some ways intersect with (cross) this one, including those that have the same outgoing lane as this one, and so might require right-of-way rules. This should only ever happen in junctions.
- property in_junction: bool
If this lane is a part of a junction (usually an intersection.)
- property index: int
when not in_junction, 0 is outer / right-most (relative to lane heading) lane on road. otherwise, index scheme is implementation-dependent, but must be deterministic.
- property lane_id: str
Unique identifier for this Lane.
- property lane_to_left: Tuple[Lane | None, bool]
Get the parallel lane to the left side of the direction this current lane.
Note
Left is defined as 90 degrees clockwise relative to the lane heading. (I.e., positive t in the RefLine coordinate system.) Second result is True if lane is in the same direction as this one In junctions, diverging lanes should not be included.
- property lane_to_right: Tuple[Lane | None, bool]
Get the parallel lane to the right side of the direction this current lane.
Note
Right is defined as 90 degrees counter-clockwise relative to the lane heading. (I.e., negative t in the RefLine coordinate system.) Second result is True if lane is in the same direction as this one. In junctions, diverging lanes should not be included.
- property lanes_in_same_direction: List[Lane]
returns all other lanes on this road where traffic goes in the same direction. it is currently assumed these will be adjacent to one another. In junctions, diverging lanes should not be included.
- property length: float
The length of this lane.
- oncoming_lanes_at_offset(offset: float) List[Lane] [source]
Returns a list of nearby lanes at offset that are (roughly) parallel to this one but go in the opposite direction.
- shape(buffer_width: float = 0.0, default_width: float | None = None) Polygon [source]
Returns a convex polygon representing this surface, buffered by buffered_width (which must be non-negative), where buffer_width is a buffer around the perimeter of the polygon. In some situations, it may be desirable to also specify a default_width, in which case the returned polygon should have a convex shape where the distance across it is no less than buffered_width + default_width at any point.
- property speed_limit: float | None
The speed limit on this lane. May be None if not defined.
- waypoint_paths_at_offset(offset: float, lookahead: int = 30, route: Route | None = None) List[List[Waypoint]] [source]
Computes equally-spaced Waypoints for all lane paths up to lookahead waypoints ahead, starting offset into this lane. Constrains paths to the supplied route if specified.
- ROAD_MARKINGS = frozenset({av2.map.lane_segment.LaneMarkType.DOUBLE_SOLID_YELLOW, av2.map.lane_segment.LaneMarkType.SOLID_DASH_YELLOW, av2.map.lane_segment.LaneMarkType.DASH_SOLID_YELLOW, av2.map.lane_segment.LaneMarkType.DOUBLE_DASH_YELLOW, av2.map.lane_segment.LaneMarkType.SOLID_BLUE, av2.map.lane_segment.LaneMarkType.DASHED_YELLOW, av2.map.lane_segment.LaneMarkType.SOLID_YELLOW})
- class Road(road_id: str, lanes: List[Lane])[source]
Road representation for Argoverse maps.
- property composite_road: Road
Return an abstract Road composed of one or more RoadMap.Road segments (including this one) that has been inferred to correspond to one continuous real-world road. May return same object as self.
- contains_point(point: Point) bool [source]
Returns True if this point is fully contained by this surface. For some regions of some maps, it may not be possible to determine this. In such indeterminate cases, it is recommended to return True.
- property is_composite: bool
Returns True if this Road object was inferred and composed out of subordinate Road objects.
- property is_junction: bool
Note that a junction can be an intersection (‘+’) or a ‘T’, ‘Y’, ‘L’, etc.
- property length: float
The length of this road.
- oncoming_roads_at_point(point: Point) List[Road] [source]
Returns a list of nearby roads to point that are (roughly) parallel to this one but have lanes that go in the opposite direction.
- property parallel_roads: List[Road]
Returns roads that start and end at the same point as this one.
- property road_id: str
The identifier for this road.
- shape(buffer_width: float = 0.0, default_width: float | None = None) Polygon [source]
Returns a convex polygon representing this surface, buffered by buffered_width (which must be non-negative), where buffer_width is a buffer around the perimeter of the polygon. In some situations, it may be desirable to also specify a default_width, in which case the returned polygon should have a convex shape where the distance across it is no less than buffered_width + default_width at any point.
- class Route(road_map: RoadMap, roads: List[Road] = [], start_lane: Lane | None = None, end_lane: Lane | None = None)[source]
Describes a route between Argoverse roads.
- property geometry: Sequence[Sequence[Tuple[float, float]]]
A sequence of polygon vertices describing the shape of each road on the route
- property road_length: float
The total road length of this route.
- class Surface(surface_id: str, road_map)[source]
Surface representation for Argoverse maps.
- property is_drivable: bool
Returns true if this surface is legally and physically drivable.
- property surface_id: str
The unique identifier for a surface.
- property bounding_box: BoundingBox | None
The minimum bounding box that contains the map geometry. May return None to indicate the map is unbounded.
- is_same_map(map_spec) bool [source]
Check if the MapSpec Object source points to the same RoadMap instance as the current
- nearest_lanes(point: Point, radius: float | None = None, include_junctions: bool = False) List[Tuple[Lane, float]] [source]
Find lanes on this road map that are near the given point. Returns a list of tuples of lane and distance, sorted by distance.
- random_route(max_route_len: int = 10, starting_road: Road | None = None, only_drivable: bool = True) Route [source]
Generate a random route contained in this road map.
- Parameters:
max_route_len – The total number of roads in the route.
starting_road – If specified, the route will start with this road.
only_drivable – If True, will restrict the route to only drive-able roads; otherwise can incl. non-drivable roads (such as bike lanes) too.
- Returns:
A randomly generated route.
- road_with_point(point: Point, *, lanes_to_search: Sequence[Lane] | None = None) Road | None [source]
Find the road that contains the given point. :param point: The point to check. :param lanes_to_search: A sequence of lanes with their distances. If not provided, the nearest lanes will be used.
- Returns:
A list of generated routes that satisfy the given restrictions. Routes will be returned in order of increasing length.
- route_from_road_ids(road_ids: Sequence[str], resolve_intermediaries: bool = False) Route [source]
Generate a route containing the specified roads. :param road_ids: The road ids of the route. :type road_ids: Sequence[str] :param resolve_intermediaries: If to fill in the gaps in the route. This may be needed to complete an incomplete route or fill in junctions roads. :type resolve_intermediaries: bool
- Returns:
A route that satisfies the given road id restrictions.
- property source: str
Path to the directory containing the map JSON file.
- surface_by_id(surface_id: str) Surface | None [source]
Find a surface within the road map that has the given identifier.
- waypoint_paths(pose: Pose, lookahead: int, within_radius: float = 5, route: Route | None = None) List[List[Waypoint]] [source]
Computes equally-spaced Waypoints for all lane paths up to lookahead waypoints ahead, starting on the Road containing the nearest Lane aligned with the vehicle’s pose within within_radius meters. Constrains paths to the supplied route if specified.