verse.map.lane_segment.StraightLane

class verse.map.lane_segment.StraightLane(id: str, start: ndarray | Sequence[float], end: ndarray | Sequence[float], width: float = 4, line_types: Tuple[LineType, LineType] = None, forbidden: bool = False, speed_limit: float = 20, priority: int = 0)

Bases: AbstractLane

A lane going in straight line.

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, start: ndarray | Sequence[float], end: ndarray | Sequence[float], width: float = 4, line_types: Tuple[LineType, LineType] = None, forbidden: bool = False, speed_limit: float = 20, priority: int = 0) None

New straight lane.

Parameters:
  • start – the lane starting position [m]

  • end – the lane ending position [m]

  • width – the lane width [m]

  • line_types – the type of lines on both sides of the lane

  • forbidden – is changing to this lane forbidden

  • priority – priority level of the lane, for determining who has right of way

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

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?

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?

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]

to_config() dict

Write lane parameters to dict which can be serialized to json

Returns:

dict of lane parameters

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]