verse.map.lane_segment.AbstractLane

class verse.map.lane_segment.AbstractLane(id: str)

Bases: object

A lane on the road, described by its central curve.

Methods

distance(position)

Compute the L1 distance [m] from a position to the lane.

distance_with_heading(position, heading[, ...])

Compute a weighted distance in position and heading to the lane.

from_config(config)

Create lane instance from config

heading_at(longitudinal)

Get the lane heading at a given longitudinal lane coordinate.

is_reachable_from(position)

Whether the lane is reachable from a given world position

local_coordinates(position)

Convert a world position to local lane coordinates.

metaclass__

alias of ABCMeta

on_lane(position[, longitudinal, lateral, ...])

Whether a given world position is on the lane.

position(longitudinal, lateral)

Convert local lane coordinates to a world position.

to_config()

Write lane parameters to dict which can be serialized to json

width_at(longitudinal)

Get the lane width at a given longitudinal lane coordinate.

after_end

__init__(id: str)
distance(position: ndarray)

Compute the L1 distance [m] from a position to the lane.

distance_with_heading(position: ndarray, heading: float | None, heading_weight: float = 1.0)

Compute a weighted distance in position and heading to the lane.

classmethod from_config(config: dict)

Create lane instance from config

Parameters:

config – json dict with lane parameters

abstract heading_at(longitudinal: float) float

Get the lane heading at a given longitudinal lane coordinate.

Parameters:

longitudinal – longitudinal lane coordinate [m]

Returns:

the lane heading [rad]

is_reachable_from(position: ndarray) bool

Whether the lane is reachable from a given world position

Parameters:

position – the world position [m]

Returns:

is the lane reachable?

abstract local_coordinates(position: ndarray) Tuple[float, float]

Convert a world position to local lane coordinates.

Parameters:

position – a world position [m]

Returns:

the (longitudinal, lateral) lane coordinates [m]

metaclass__

alias of ABCMeta

on_lane(position: ndarray, longitudinal: float = None, lateral: float = None, margin: float = 0) bool

Whether a given world position is on the lane.

Parameters:
  • position – a world position [m]

  • longitudinal – (optional) the corresponding longitudinal lane coordinate, if known [m]

  • lateral – (optional) the corresponding lateral lane coordinate, if known [m]

  • margin – (optional) a supplementary margin around the lane width

Returns:

is the position on the lane?

abstract position(longitudinal: float, lateral: float) ndarray

Convert local lane coordinates to a world position.

Parameters:
  • longitudinal – longitudinal lane coordinate [m]

  • lateral – lateral lane coordinate [m]

Returns:

the corresponding world position [m]

abstract to_config() dict

Write lane parameters to dict which can be serialized to json

Returns:

dict of lane parameters

abstract width_at(longitudinal: float) float

Get the lane width at a given longitudinal lane coordinate.

Parameters:

longitudinal – longitudinal lane coordinate [m]

Returns:

the lane width [m]