opendrive.opendrive_parser.elements package

Submodules

opendrive.opendrive_parser.elements.eulerspiral module

class opendrive.opendrive_parser.elements.eulerspiral.EulerSpiral(gamma)[source]

Bases: object

Class which finds the parameters of the ASAM OpenDrive spiral element.

calc(s, x0=0, y0=0, kappa0=0, theta0=0)[source]

Calculates x and y position, angle of the tangent and the curvature at position s. The position is described in complex representation with x being the real part of the number and y the imaginary part. The angle of the tangent is measured w.r.t. the x-axis.

Parameters:
  • s (float) – position on the spiral

  • x0 (float) – initial x position

  • y0 (float) – initial y position

  • kappa0 (float) – curvature at the starting position

  • theta0 (float) – angle of the tangent at the initial position

Return type:

Tuple[float, float, float, Tuple[float, float]]

Returns:

x and y positions, theta and the curvature at point s in the form (x-position, y-position, theta, curvature)

static createFromLengthAndCurvature(length, curvStart, curvEnd)[source]

Create an EulerSpiral from a given length with curveStart and curvEnd. This is how the OpenDrive format specifies EulerSpirals.

Parameters:
  • length (float) – Length of EulerSpiral

  • curvStart (float) – Curvature at start of EulerSpiral

  • curvEnd (float) – Curvature at end of EulerSpiral

Return type:

EulerSpiral

Returns:

EulerSpiral - a new Clothoid

curvature(s, kappa0=0)[source]

Returns curvature at position s The curvature in the Euler curve is represented as K(s) = gamma * s + k

Parameters:
  • s (float) – position on the spiral

  • kappa0 (float) – curvature at the starting point

Return type:

Tuple[float, float]

Returns:

The new curvature at position s and the magnitude by which the curvature changes with s in the form of (new curvature, magnitude of change)

opendrive.opendrive_parser.elements.geometry module

opendrive.opendrive_parser.elements.junction module

class opendrive.opendrive_parser.elements.junction.Connection[source]

Bases: object

Class which describes connecting roads and correspond to the connection elements on a junction element. It corresponds to the t_junction_connection element in the UML model of ASAM OpenDrive.

Variables:
  • _id – ID of the connection element

  • _incomingRoad – ID of the incoming road

  • _connectingRoad – ID of the connecting road

  • _contactPoint – contact point of the connecting road

  • _laneLinks – list of laneLinks associated with the connection

Adds new laneLinks which are associated with the connection element.

Param:

laneLink which needs to be an object of class LaneLink

Returns:

appended list of laneLinks

property connectingRoad: int

ID of the connecting road.

Getter:

returns the ID of the connecting road

Setter:

sets the ID of the connecting road

Type:

int

Return type:

int

property contactPoint: str

Contact Point on the connecting road. Valid options are “start” and “end”.

Getter:

returns the contact point

Setter:

sets the contact point

Type:

string

Return type:

str

property id: int

ID of the connection.

Getter:

returns the ID of the connection

Setter:

sets the ID of the connection

Type:

int

Return type:

int

property incomingRoad: int

ID of the incoming road.

Getter:

returns the ID of the incoming road

Setter:

sets the ID of the incoming road

Type:

int

Return type:

int

Shows the laneLinks associated with the connection element.

Getter:

returns the laneLink objects in the form of a list [laneLink1, laneLink2, …]

Type:

list of object instances of class LaneLink

class opendrive.opendrive_parser.elements.junction.Junction[source]

Bases: object

Class which describes some attributes of the junction element in OpenDrive.

Variables:
  • _id – ID of the junction element

  • _name – name of the junction

  • _connections – list of connection elements associated with the junction

addConnection(connection)[source]

Adds new connections which are associated with the junction element.

Param:

connection which needs to be an object of class Connection

Returns:

appended list of connections

property connections: list[Connection]

Shows the connections associated with the junction.

Getter:

returns the connection objects in the form of a list [connection1, connection2, …]

Type:

list of object instances of class Connection

property id: int

Junction ID.

Getter:

returns the junction ID

Setter:

sets the junction ID

Type:

int

Return type:

int

property name: str

Junction name.

Getter:

returns the junction name

Setter:

sets the junction name

Type:

string

Return type:

str

Bases: object

Class which describes the lanes that are linked between an incoming road and a connecting road. It corresponds to the t_junction_connection_laneLink element in the UML model in ASAM OpenDrive.

Variables:
  • _from – ID of the incoming lane

  • _to – ID of the connection lane

property fromId: int

ID of the incoming lane.

Getter:

returns ID

Setter:

sets ID

Type:

int

Return type:

int

property toId: int

ID of the connection lane.

Getter:

returns ID

Setter:

sets ID

Type:

int

Return type:

int

opendrive.opendrive_parser.elements.opendrive module

opendrive.opendrive_parser.elements.road module

opendrive.opendrive_parser.elements.roadElevationProfile module

opendrive.opendrive_parser.elements.roadLanes module

opendrive.opendrive_parser.elements.roadLateralProfile module

opendrive.opendrive_parser.elements.roadObject module

class opendrive.opendrive_parser.elements.roadObject.Object[source]

Bases: object

Describes items that influence a road by expanding, delimiting and supplementing its course. E.g. Parking spaces, crosswalks, and traffic barriers. Objects are defined per road.

Class is not yet supported. It is not used in the conversion to CommonRoad.

Variables:
  • _type – type of the object

  • _name – name of the object

  • _width – width of the object bounding box

  • _height – height of the object’s bounding box

  • _zOffset – z-offset of object’s origin relative to the elevation of the reference line

  • _id – ID of object

  • _s – s-coordinate of the object’s origin

  • _t – t-coordinate of the object’s origin

  • _validLength – validity of object along s-axis

  • _orientation – orientation of the object

  • _hdg – heading angle of the object

  • _pitch – pitch angle relative to the x/y-plane

  • _roll – roll angle relative to the x/y-plane

property hdg: float

Heading angle of object relative to road direction.

Getter:

returns heading angle

Setter:

sets heading angle

Type:

float

Return type:

float

property height: float

Height of object’s bounding box.

Getter:

returns height of object’s bounding box

Setter:

sets height of object’s bounding box

Type:

float

Return type:

float

property id: int

ID of object.

Getter:

returns ID

Setter:

sets ID

Type:

int

Return type:

int

property name: str

Name of object.

Getter:

returns name of object

Setter:

sets name of object

Type:

string

Return type:

str

property orientation: str

Orientation of object which describes validity in positive/negative s-direction. ‘+’ -> valid in positive s-direction, ‘-’ -> valid in negative s-direction, ‘none’ -> valid in both directions. Does not affect heading.

Getter:

returns orientation

Setter:

sets orientation

Type:

string

Return type:

str

property outline
property pitch: float

Pitch angle relative to the x/y-plane.

Getter:

returns pitch angle

Setter:

sets pitch angle

Type:

float

Return type:

float

property roll: float

Roll angle relative to the x/y-plane.

Getter:

returns roll angle

Setter:

sets roll angle

Type:

float

Return type:

float

property s: float

s-coordinate of object’s origin.

Getter:

returns s-coordinate

Setter:

sets s-coordinate

Type:

float

Return type:

float

property t: float

t-coordinate of object’s origin.

Getter:

returns t-coordinate

Setter:

sets t-coordinate

Type:

float

Return type:

float

property type: str

Type of object.

Getter:

returns type of object

Setter:

sets type of object

Type:

string

Return type:

str

property validLength: float

Validity of object along s-axis. (0.0 for point object)

Getter:

returns validity of object

Setter:

sets validity

Type:

float

Return type:

float

property width: float

Width of object’s bounding box.

Getter:

returns width of object’s bounding box

Setter:

sets width of object’s bounding box

Type:

float

Return type:

float

property zOffset: float

z-offset of object’s origin relative to the elevation of the reference line.

Getter:

returns zOffset

Setter:

sets zOffset

Type:

float

Return type:

float

class opendrive.opendrive_parser.elements.roadObject.ObjectOutlineCorner[source]

Bases: object

property height
property id
property u
property v
property z

opendrive.opendrive_parser.elements.roadPlanView module

opendrive.opendrive_parser.elements.roadSignal module

class opendrive.opendrive_parser.elements.roadSignal.Signal[source]

Bases: object

Class which describes the signal element in OpenDRIVE. It provides information about signals along a road.

Variables:
  • _s – s-coordinate

  • _t – t-coordinate

  • _id – ID of the signal

  • _name – name of the signal

  • _dynamic – indicates whether the signal is dynamic or static

  • _orientation – indicates in which s-direction the traffic is valid

  • _type – type identifier of the signal

  • _subtype – subtype identifier of the signal

  • _country – country code of the road according to ISO 3166-1

  • _signal_value – value of the signal

  • _unit – unit of the signal value (mandatory if signal value is given)

  • _text – additional text associated with the signal

property country: str

Country code of road.

Getter:

returns country code

Setter:

sets country code

Type:

string

Return type:

str

property dynamic: str

Indicates whether signal is static or dynamic. (“Yes” for dynamic, “No” for static)

Getter:

returns whether signal is dynamic

Setter:

sets whether signal is dynamic

Type:

string

Return type:

str

property id: int

ID of the signal.

Getter:

returns ID

Setter:

sets ID

Type:

int

Return type:

int

property name: str

Name of the signal.

Getter:

returns name of the signal

Setter:

sets name

Type:

string

Return type:

str

property orientation: str

Indicates direction in which signal is enforced. (“+” = valid in positive s-direction, “-” = valid in negative s-direction, “none” = valid in both directions)

Getter:

returns orientation

Setter:

sets orientation

Type:

string

Return type:

str

property s: float

s-coordinate of the signal.

Getter:

returns s-coordinate

Setter:

sets s-coordinate

Type:

float

Return type:

float

property signal_value: float

Value of the signal.

Getter:

returns value of the signal

Setter:

sets value of the signal

Type:

float

Return type:

float

property subtype: str

Subtype identifier according to country code.

Getter:

returns subtype ID

Setter:

sets subtype ID

Type:

string

Return type:

str

property t: float

t-coordinate of the signal.

Getter:

returns t-coordinate

Setter:

sets t-coordinate

Type:

float

Return type:

float

property text: Union[None, str]

Additional text associated with signal.

Getter:

returns text

Setter:

sets text

Type:

string

Return type:

Optional[str]

property type: Union[None, str]

Type identifier of the signal according to country code.

Getter:

returns type ID

Setter:

sets type ID

Type:

string

Return type:

Optional[str]

property unit: Union[None, str]

Unit of the signal value.

Getter:

returns unit

Setter:

sets unit

Type:

string

Return type:

Optional[str]

class opendrive.opendrive_parser.elements.roadSignal.SignalReference[source]

Bases: object

In OpenDRIVE, a reference to another signal for reuse of signal information is represented by the <signalReference> element within the <signal> element. (Do not mistake it with the <reference> element within the <signal> element!!!)

Rules: The following rules apply for the purpose of reusing signal information: A lane validity element may be added for every <signalReference> element. Signal reference shall be used for signals only. For the signal that reuses the content of another signal, the direction for which it is valid shall be specified.

Variables:
  • _s – s-coordinate

  • _t – t-coordinate

  • _id – ID of the referenced signal within the database

  • _orientation – indicates in which s-direction the traffic is valid

property id: int

ID of the signal.

Getter:

returns ID

Setter:

sets ID

Type:

int

Return type:

int

property orientation: str

Indicates direction in which signal is enforced. (“+” = valid in positive s-direction, “-” = valid in negative s-direction, “none” = valid in both directions)

Getter:

returns orientation

Setter:

sets orientation

Type:

string

Return type:

str

property s: float

s-coordinate of the signal.

Getter:

returns s-coordinate

Setter:

sets s-coordinate

Type:

float

Return type:

float

property t: float

t-coordinate of the signal.

Getter:

returns t-coordinate

Setter:

sets t-coordinate

Type:

float

Return type:

float

opendrive.opendrive_parser.elements.road_record module

class opendrive.opendrive_parser.elements.road_record.RoadRecord(*polynomial_coefficients, start_pos=None)[source]

Bases: ABC

Abstract base class to model Records (e.g. ElevationRecord) of the OpenDRIVE specification.

These Records all have attributes start_pos, a, b, c, d. The attribute attr which is defined the RoadRecord at a given reference line position is calculated with the following equation:

attr = a + b*ds + c*ds² + d*ds³

where ds being the distance along the reference line between the start of the entry and the actual position. ds starts at zero for each RoadRecord. The absolute position of an elevation value is calculated by s = start_pos + ds

Variables:
  • start_pos – Position in curve parameter ds where the RoadRecord starts

  • polynomial_coefficients – List of values [a, b, c, d, …] which can be evaluated with a polynomial function.

opendrive.opendrive_parser.elements.roadtype module

class opendrive.opendrive_parser.elements.roadtype.RoadType(s_pos=None, use_type=None, speed=None)[source]

Bases: object

Class which describes the Road type element in OpenDRIVE. It defines the main purpose of a road and the associated traffic rules. It can be changed as often as needed within a road element. The attribute country which contains the country code of the road according to ISO 3166-1 is not implemented in the converter as the information will not be used.

Class is not yet supported. It is not used in the conversion to CommonRoad.

allowedTypes = ['unknown', 'rural', 'motorway', 'town', 'lowSpeed', 'pedestrian', 'bicycle', 'townArterial', 'townCollector', 'townExpressway', 'townLocal', 'townPlayStreet', 'townPrivate']
property speed: Speed

Speed limit of the road type.

Getter:

returns speed value

Setter:

sets speed value

Type:

instance of class Speed

Return type:

Speed

property start_pos: float

S-coordinate of the start position.

Getter:

returns s-coordinate

Setter:

sets s-coordinate

Type:

float

Return type:

float

property use_type: str

Type of the road.

Getter:

returns road type

Setter:

sets road type

Type:

string

Return type:

str

class opendrive.opendrive_parser.elements.roadtype.Speed(max_speed=None, unit=None)[source]

Bases: object

Class which describes the speed element of road types in OpenDRIVE. It defines the speed limit for a road type.

property max: Optional[Union[float, str]]

Maximum allowed speed. Can have the values ‘no limit’, ‘undefined’ or numerical values in the respective unit.

Getter:

returns max. allowed speed

Setter:

sets max. allowed speed

Type:

string

Return type:

Union[float, str, None]

property unit: Union[None, str]

Unit of attribute max.

Getter:

returns unit

Setter:

sets unit

Type:

string

Return type:

Optional[str]

Module contents