hdmap

hdmap.MapParser

class hdmap.MapParser.MapParser(filename: str)

Class to load and parse HD Map

Parameters

filename (str) – filename of the HD Map

get_coordinate_and_heading(lane_id: str, s: float) Tuple[modules.common.proto.geometry_pb2.PointENU, float]

Given a lane_id and a point on the lane, get the actual coordinate and the heading at that point.

Parameters
  • lane_id (str) – ID of the lane intereted in

  • s (float) – meters away from the start of the lane

Returns

coordinate and heading in a tuple

Return type

Tuple[PointENU, float]

get_crosswalk_by_id(cw_id: str) modules.map.proto.map_crosswalk_pb2.Crosswalk

Get a specific crosswalk object based on ID

Parameters

cw_id (str) – ID of the crosswalk interested in

Returns

crosswalk object

Return type

Crosswalk

get_crosswalks() List[str]

Get a list of all crosswalk IDs on the HD Map

Returns

list of crosswalk IDs

Return type

List[str]

static get_instance()

Get the singleton instance of MapParser

get_junction_by_id(j_id: str) modules.map.proto.map_junction_pb2.Junction

Get a specific junction object based on ID

Parameters

j_id (str) – ID of the junction interested in

Returns

junction object

Return type

Junction

get_junctions() List[str]

Get a list of all junction IDs on the HD Map

Returns

list of junction IDs

Return type

List[str]

get_lane_by_id(l_id: str) modules.map.proto.map_lane_pb2.Lane

Get a specific junction object based on ID

Parameters

l_id (str) – ID of the lane interested in

Returns

lane object

Return type

Lane

get_lane_central_curve(lane_id: str) shapely.geometry.linestring.LineString

Gets the central curve of the lane.

Parameters

lane_id (str) – ID of the lane interested in

Returns

an object representing the lane’s central curve

Rypte

LineString

get_lane_length(lane_id: str) float

Gets the length of the lane.

Parameters

lane_id (str) – ID of the lane interested in

Returns

length of the lane

Return type

float

get_lanes() List[str]

Get a list of all lane IDs on the HD Map

Returns

list of lane IDs

Return type

List[str]

get_lanes_not_in_junction() Set[str]

Get the set of all lanes that are not in the junction.

Returns

ID of lanes who is not in a junction

Return type

Set[str]

get_path_from(lane_id: str) List[List[str]]

Get possible paths starting from a specified lane

Parameters

lane_id (str) – ID of the starting lane

Returns

list of possible paths, each consisten multiple lanes

Return type

List[List[str]]

get_signal_by_id(s_id: str) modules.map.proto.map_signal_pb2.Signal

Get a specific signal object based on ID

Parameters

s_id (str) – ID of the signal interested in

Returns

signal object

Return type

Signal

get_signals() List[str]

Get a list of all signal IDs on the HD Map

Returns

list of signal IDs

Return type

List[str]

get_signals_wrt(signal_id: str) List[Tuple[str, str]]

Get signals that have constraint with the specified signal

Parameters

signal_id (str) – ID of the signal interested in

Returns

list of tuple each indicates the signal and the constraint

Return type

List[Tuple[str, str]]

Example

[('signal_5', 'EQ'), ('signal_6', 'NE')] indicates signal_5 should have the same color, signal_6 cannot be green if the signal passed in is green.

get_stop_sign_by_id(ss_id: str) modules.map.proto.map_stop_sign_pb2.StopSign

Get a specific stop sign object based on ID

Parameters

ss_id (str) – ID of the stop sign interested in

Returns

stop sign object

Return type

StopSign

get_stop_signs() List[str]

Get a list of all stop sign IDs on the HD Map

Returns

list of stop sign IDs

Return type

List[str]

is_conflict_lanes(lane_id1: List[str], lane_id2: List[str]) bool

Check if 2 groups of lanes intersect with each other

Parameters
  • lane_id1 (List[str]) – list of lane ids

  • lane_id2 (List[str]) – another list of lane ids

Returns

True if at least 1 lane from lhs intersects with another from rhs, False otherwise.

Return type

bool

load_crosswalks()

Load crosswalks on the HD Map

load_junctions()

Load junctions on the HD Map

load_lanes()

Load lanes on the HD Map

load_signals()

Load traffic signals on the HD Map

load_stop_signs()

Load stop signs on the HD Map

parse_lane_relations()

Analyze the relation between lanes (e.g., which lane is connected to which lane)

Note

the relation is supposed to be included in the HD Map via predecessor and successor relation, but experimentally we found HD Map may be buggy and leave out some information, causing Routing module to fail.

parse_relations()

Parse relations between signals and junctions, lanes and junctions, and lanes and signals

parse_signal_relations()

Analyze the relation between signals (e.g., signals that cannot be green at the same time)