simulation.utils.road.sections package

Submodules

simulation.utils.road.sections.bezier_curve module

Quadratic- and CubicBezierCurves.

Functions:

_read_point(p)

Get numpy array from point or coordinate sequence.

_compute_cubic_bezier(t, p0, p1, p2, p3)

add_quad_bezier_points(p0, p1, p2, p3)

Classes:

BezierCurve(_Transformable__transform, id, …)

QuadBezier(_Transformable__transform, id, …)

Quadratic bezier curve, defined by two control points.

CubicBezier(_Transformable__transform, id, …)

Cubic bezier curve, defined by three control points.

_read_point(p: Union[simulation.utils.geometry.point.Point, Sequence[float]])numpy.ndarray[source]

Get numpy array from point or coordinate sequence.

_compute_cubic_bezier(t, p0, p1, p2, p3)[source]
add_quad_bezier_points(p0, p1, p2, p3)[source]
class BezierCurve(_Transformable__transform: simulation.utils.geometry.transform.Transform = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, p1: Union[ForwardRef('Point'), Sequence[float]] = None, p2: Union[ForwardRef('Point'), Sequence[float]] = None)[source]

Bases: simulation.utils.road.sections.road_section.RoadSection

Attributes:

p1

Control point 1.

p2

Control point 2.

p1: Union[Point, Sequence[float]] = None

Control point 1.

p2: Union[Point, Sequence[float]] = None

Control point 2.

obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

class QuadBezier(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, p1: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None, p2: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None)[source]

Bases: simulation.utils.road.sections.bezier_curve.BezierCurve

Quadratic bezier curve, defined by two control points.

Parameters
  • p1 (Union[Point, Sequence[float]]) – Control point 1. Y-Value has to be zero in order to match the gradient of the last section at the start.

  • p2 (Union[Point, Sequence[float]]) – Control point 2.

Attributes:

TYPE

Type of the road section.

middle_line

Middle line of the road section.

TYPE = 3

Type of the road section.

property middle_line

Middle line of the road section.

Type

Line

obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

class CubicBezier(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, p1: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None, p2: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None, p3: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None)[source]

Bases: simulation.utils.road.sections.bezier_curve.BezierCurve

Cubic bezier curve, defined by three control points.

Parameters
  • p1 (Union[Point, Sequence[float]]) – Control point 1.

  • p2 (Union[Point, Sequence[float]]) – Control point 2.

  • p3 (Union[Point, Sequence[float]]) – Control point 3.

Attributes:

TYPE

Type of the road section.

p3

Control point 3.

middle_line

Middle line of the road section.

TYPE = 4

Type of the road section.

p3: Union[simulation.utils.geometry.point.Point, Sequence[float]] = None

Control point 3.

obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

property middle_line: simulation.utils.geometry.line.Line

Middle line of the road section.

Type

Line

simulation.utils.road.sections.blocked_area module

BlockedArea.

Classes:

BlockedArea(_Transformable__transform, id, …)

Road section representing a blocked area.

class BlockedArea(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 1, width: float = 0.2, _opening_angle: float = 1.0471975511965976)[source]

Bases: simulation.utils.road.sections.straight_road.StraightRoad

Road section representing a blocked area.

Parameters

width (float) – width of the blocked area, starting from the right line.

Attributes:

TYPE

Type of the road section.

width

_opening_angle

frame

Frame of the blocked area surface marking.

_poly

TYPE = 8

Type of the road section.

width: float = 0.2
_opening_angle: float = 1.0471975511965976
property frame: simulation.utils.geometry.polygon.Polygon

Frame of the blocked area surface marking.

It has the shape of a symmetrical trapezoid.

Type

Polygon

property _poly: simulation.utils.geometry.polygon.Polygon
obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

simulation.utils.road.sections.circular_arc module

Left- and RightCircularArc.

Classes:

CircularArc(_Transformable__transform, id, …)

Road section representing a part of a circle.

LeftCircularArc(_Transformable__transform, …)

Part of a circle with a positive curvature.

RightCircularArc(_Transformable__transform, …)

Part of a circle with a negative curvature.

class CircularArc(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, radius: Optional[float] = None, angle: Optional[float] = None)[source]

Bases: simulation.utils.road.sections.road_section.RoadSection

Road section representing a part of a circle.

Attributes:

radius

Radius of the circle.

angle

Define the portion of the circle [radian].

middle_line

Middle line of the road section.

Methods:

get_ending()

Get the ending of the section as a pose and the curvature.

radius: float = None

Radius of the circle.

angle: float = None

Define the portion of the circle [radian].

property middle_line

Middle line of the road section.

Type

Line

get_ending()Tuple[simulation.utils.geometry.pose.Pose, float][source]

Get the ending of the section as a pose and the curvature.

Returns

A tuple consisting of the last point on the middle line together with the direction facing along the middle line as a pose and the curvature at the ending of the middle line.

obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

class LeftCircularArc(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, radius: Optional[float] = None, angle: Optional[float] = None)[source]

Bases: simulation.utils.road.sections.circular_arc.CircularArc

Part of a circle with a positive curvature.

Parameters
  • radius (float) – Radius [m].

  • angle (float) – Part of the circle [radian].

Attributes:

TYPE

Type of the road section.

TYPE = 1

Type of the road section.

obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

class RightCircularArc(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, radius: Optional[float] = None, angle: Optional[float] = None)[source]

Bases: simulation.utils.road.sections.circular_arc.CircularArc

Part of a circle with a negative curvature.

Parameters
  • radius (float) – Radius [m].

  • angle (float) – Part of the circle [radian].

Attributes:

TYPE

Type of the road section.

obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

TYPE = 2

Type of the road section.

simulation.utils.road.sections.custom_section module

Classes:

CustomSection(_Transformable__transform, id, …)

class CustomSection(_Transformable__transform: simulation.utils.geometry.transform.Transform = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, middle_line_points: List[<built-in function array>] = <factory>)[source]

Bases: simulation.utils.road.sections.road_section.RoadSection, simulation.utils.basics.init_options.InitOptions, simulation.utils.basics.save_options.SaveOptions

Attributes:

TYPE

Type of the road section.

middle_line_points

Points that make up the middle line.

middle_line

Middle line of the road section.

Methods:

save_as_yaml(file_path)

Save the section as a yaml file.

from_yaml(file_path)

Load from a yaml file.

split_by(sections[, x_buffer])

Add a number of other sections along this section.

TYPE = 10

Type of the road section.

middle_line_points: List[numpy.array]

Points that make up the middle line.

property middle_line: simulation.utils.geometry.line.Line

Middle line of the road section.

Type

Line

save_as_yaml(file_path: str)[source]

Save the section as a yaml file.

classmethod from_yaml(file_path: str)[source]

Load from a yaml file.

split_by(sections: List[Tuple[int, simulation.utils.road.sections.road_section.RoadSection]], x_buffer=1)List[simulation.utils.road.sections.road_section.RoadSection][source]

Add a number of other sections along this section.

Parameters
  • sections – Road sections and arc lengths at which they should be added.

  • x_buffer – Buffer after a road section to improve the adjustment of the end pose.

Returns

New road sections that replace this section.

obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

simulation.utils.road.sections.intersection module

Intersection.

Functions:

_get_stop_line(line1, line2, kind)

Return a line perpendicular to both provided (assumed parallel) lines.

arange_with_end(start, end, step)

Classes:

Intersection(_Transformable__transform, id, …)

Road section representing an intersection.

_get_stop_line(line1: simulation.utils.geometry.line.Line, line2: simulation.utils.geometry.line.Line, kind)simulation.utils.road.sections.surface_marking.SurfaceMarkingRect[source]

Return a line perpendicular to both provided (assumed parallel) lines.

The returned line will be at the first point where both lines are parallel to each other plus 2cm offset.

arange_with_end(start: float, end: float, step: float)[source]
class Intersection(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, angle: float = 1.5707963267948966, closing: Optional[str] = None, turn: int = 0, rule: int = 0, size: float = 1.8, exit_direction: Optional[int] = None)[source]

Bases: simulation.utils.road.sections.road_section.RoadSection

Road section representing an intersection.

Parameters
  • angle (float) – Angle [radian] between crossing roads.

  • closing (int) – Optionally close one direction to create a T-intersection.

  • turn (int) – Direction in which the road continues.

  • rule (int) – Priority-rule at intersection.

  • size (float) – Length of the crossing roads.

Attributes:

TYPE

Type of the road section.

STRAIGHT

Possible value for turn.

LEFT

Possible value for turn.

RIGHT

Possible value for turn.

EQUAL

Possible value for rule.

YIELD

Possible value for rule.

STOP

Possible value for rule.

PRIORITY_YIELD

Possible value for rule.

PRIORITY_STOP

Possible value for rule.

angle

Angle between intersecting roads [radian].

closing

Closed direction (T-intersection).

turn

Direction in which road continues.

rule

Priority rule at intersection.

size

Size of intersection (from one side to the other).

exit_direction

Optional parameter to overwrite the visible turning direction.

sin

cos

y

x

z

u

v

w

ll

ls

rl

rs

middle_line_south

left_line_south

right_line_south

middle_line_east

left_line_east

right_line_east

middle_line_north

left_line_north

right_line_north

middle_line_west

left_line_west

right_line_west

ls_circle

ll_circle

rs_circle

rl_circle

middle_line

Middle line of the intersection.

lines

All road lines with their marking type.

Methods:

cp_sign_south(sign_dist)

cp_surface_south()

cp_sign_west(sign_dist)

cp_surface_west()

cp_sign_north(sign_dist)

cp_sign_east(sign_dist)

cp_surface_east()

get_points()

get_beginning()

Get the beginning of the section as a pose and the curvature.

get_ending()

Get the ending of the section as a pose and the curvature.

get_bounding_box()

Get a polygon around the road section.

_get_intersection_traffic_signs()

_get_intersection_surface_markings()

TYPE = 7

Type of the road section.

STRAIGHT = 0

Possible value for turn. Drive straight through the intersection.

LEFT = 1

Possible value for turn. Turn left at the intersection.

RIGHT = 2

Possible value for turn. Turn right at the intersection.

EQUAL = 0

Possible value for rule. Rechts vor links.

YIELD = 1

Possible value for rule. Car must yield.

STOP = 2

Possible value for rule. Car must stop.

PRIORITY_YIELD = 3

Possible value for rule. Car will have the right of way.

Intersecting road must yield.

PRIORITY_STOP = 4

Possible value for rule. Car will have the right of way.

Intersecting road must stop.

angle: float = 1.5707963267948966

Angle between intersecting roads [radian].

closing: str = None

Closed direction (T-intersection).

turn: int = 0

Direction in which road continues.

rule: int = 0

Priority rule at intersection.

size: float = 1.8

Size of intersection (from one side to the other).

exit_direction: int = None

Optional parameter to overwrite the visible turning direction.

property sin
property cos
property y
property x
property z
property u
property v
property w
property ll
property ls
property rl
property rs
cp_sign_south(sign_dist)[source]
cp_surface_south()[source]
cp_sign_west(sign_dist)[source]
cp_surface_west()[source]
cp_sign_north(sign_dist)[source]
cp_sign_east(sign_dist)[source]
cp_surface_east()[source]
get_points()[source]
property middle_line_south: simulation.utils.geometry.line.Line
property left_line_south: simulation.utils.geometry.line.Line
property right_line_south: simulation.utils.geometry.line.Line
property middle_line_east: simulation.utils.geometry.line.Line
property left_line_east: simulation.utils.geometry.line.Line
property right_line_east: simulation.utils.geometry.line.Line
property middle_line_north: simulation.utils.geometry.line.Line
property left_line_north: simulation.utils.geometry.line.Line
property right_line_north: simulation.utils.geometry.line.Line
property middle_line_west: simulation.utils.geometry.line.Line
obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

property left_line_west: simulation.utils.geometry.line.Line
property right_line_west: simulation.utils.geometry.line.Line
property ls_circle: simulation.utils.geometry.line.Line
property ll_circle: simulation.utils.geometry.line.Line
property rs_circle: simulation.utils.geometry.line.Line
property rl_circle: simulation.utils.geometry.line.Line
property middle_line

Middle line of the intersection.

Type

Line

property lines: List[simulation.utils.road.sections.road_section.MarkedLine]

All road lines with their marking type.

Type

List[MarkedLine]

get_beginning()Tuple[simulation.utils.geometry.pose.Pose, float][source]

Get the beginning of the section as a pose and the curvature.

Returns

A tuple consisting of the first point on the middle line together with the direction facing away from the road section as a pose and the curvature at the beginning of the middle line.

get_ending()Tuple[simulation.utils.geometry.pose.Pose, float][source]

Get the ending of the section as a pose and the curvature.

Returns

A tuple consisting of the last point on the middle line together with the direction facing along the middle line as a pose and the curvature at the ending of the middle line.

get_bounding_box()simulation.utils.geometry.polygon.Polygon[source]

Get a polygon around the road section.

Bounding box is an approximate representation of all points within a given distance of this geometric object.

_get_intersection_traffic_signs()List[simulation.utils.road.sections.traffic_sign.TrafficSign][source]
_get_intersection_surface_markings()List[simulation.utils.road.sections.surface_marking.SurfaceMarkingRect][source]

simulation.utils.road.sections.line_tuple module

Classes:

LineTuple(left, middle, right)

A line tuple can be created from the lines of a section.

class LineTuple(left, middle, right)

Bases: tuple

A line tuple can be created from the lines of a section.

Methods:

_asdict()

Return a new dict which maps field names to their values.

_make(iterable)

Make a new LineTuple object from a sequence or iterable

_replace(**kwds)

Return a new LineTuple object replacing specified fields with new values

Attributes:

_field_defaults

_fields

_fields_defaults

left

Left line of the section.

middle

Middle line of the section.

right

Right line of the section.

_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {}
_fields = ('left', 'middle', 'right')
_fields_defaults = {}
classmethod _make(iterable)

Make a new LineTuple object from a sequence or iterable

_replace(**kwds)

Return a new LineTuple object replacing specified fields with new values

left

Left line of the section.

Type

left (Line)

middle

Middle line of the section.

Type

middle (Line)

right

Right line of the section.

Type

right (Line)

simulation.utils.road.sections.obstacle module

StaticObstacle on road and ParkingObstacle on ParkingSpot.

Classes:

StaticObstacle(arc_length, y, width, depth, …)

Obstacle that can be placed on the road.

ParkingObstacle(x, y, width, depth, height)

Obstacle that can be placed on a parking spot.

class StaticObstacle(arc_length: float = 0.4, y: float = - 0.2, width: float = 0.2, depth: float = 0.2, height: float = 0.2, angle=0)[source]

Bases: simulation.utils.road.sections.road_element.RoadElementRect

Obstacle that can be placed on the road.

Parameters
  • arc_length – x coordinate of the element along the road.

  • y – y coordinate of the element. (Perpendicular to the road.)

  • width – Width of the element.

  • depth – Depth of the element. Component of the size in the direction of the road.

  • height – Height of the element.

  • angle – Angle [radian] between the middle line and the element (measured at the center).

Attributes:

id_

desc

id_ = 1
desc = 'StaticObstacle'
__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

class ParkingObstacle(x: float = 0.15, y: float = - 0.15, width: float = 0.15, depth: float = 0.15, height: float = 0.2, angle=0)[source]

Bases: simulation.utils.road.sections.obstacle.StaticObstacle

Obstacle that can be placed on a parking spot.

Parameters
  • x – x coordinate of the element along the road.

  • y – y coordinate of the element. (Perpendicular to the road.)

  • width – Width of the element.

  • depth – Depth of the element. Component of the size in the direction of the spot.

  • height – Height of the element.

  • angle – Angle [radian] between the parking spot and the element (measured at the center).

Attributes:

id_

desc

id_ = 2
desc = 'ParkingObstacle'
__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

simulation.utils.road.sections.parking_area module

ParkingArea, ParkingLot, ParkingSpot and StartLine.

Classes:

ParkingSpot(kind, width, obstacle)

Parking spot with a type and optionally an obstacle placed on top.

ParkingLot(_Transformable__transform, start, …)

Outline of a parking lot (right/left side) and all parking spots contained within.

ParkingArea(_Transformable__transform, id, …)

Part of the road with parking lots and a start line.

class ParkingSpot(kind: float = 0, width: float = 0.35, obstacle: Optional[simulation.utils.road.sections.obstacle.ParkingObstacle] = None)[source]

Bases: simulation.utils.road.sections.road_element.RoadElementRect

Parking spot with a type and optionally an obstacle placed on top.

Parameters
  • width – Width of the spot.

  • kind – Type of the spot.

  • obstacle – Obstacle within the spot.

Attributes:

FREE

Possible value of kind.

OCCUPIED

Possible value of kind.

BLOCKED

Possible value of kind.

_side

Side of the road.

kind

Classification of the parking spot.

obstacle

Obstacle within the spot.

x_surface_marking

lines

Borderlines for spot if spot is on the left.

Methods:

set_transform(tf)

Calculate the correct transform to this element.

FREE = 0

Possible value of kind.

OCCUPIED = 1

Possible value of kind.

BLOCKED = 2

Possible value of kind.

_side: str = None

Side of the road.

kind: str = 0

Classification of the parking spot.

obstacle: simulation.utils.road.sections.obstacle.ParkingObstacle = None

Obstacle within the spot.

x_surface_marking: simulation.utils.road.sections.surface_marking.SurfaceMarkingRect = None
set_transform(tf: simulation.utils.geometry.transform.Transform)[source]

Calculate the correct transform to this element.

Depending on self.normalize_x the positional behavior is different. If self.normalize_x is True, the element is aligned along the provided line.

property lines: List[simulation.utils.road.sections.road_section.MarkedLine]

Borderlines for spot if spot is on the left.

Marking type is always solid.

Type

List[MarkedLine]

__transform: simulation.utils.geometry.transform.Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

class ParkingLot(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, start: float = 0, spots: List[simulation.utils.road.sections.parking_area.ParkingSpot] = <factory>, _side: str = 'right', opening_angle: float = 1.0471975511965976, depth: Optional[float] = None)[source]

Bases: simulation.utils.road.sections.transformable.Transformable

Outline of a parking lot (right/left side) and all parking spots contained within.

The origin is invariant of the side of the road (left, right). It is always in the left corner of the left most parking spot, with the x-direction pointing away from the road.

Parameters
  • start (float) – Beginning relative to the start of the section.

  • opening_angle (float) – Opening angle of the outside border of the parking lot.

  • depth (float) – Depth of the parking spots within the parking lot.

  • spots (List[ParkingSpot]) – Parking spots within the lot.

Attributes:

RIGHT_SIDE

Possible value of side.

LEFT_SIDE

Possible value of side.

DEFAULT_LEFT_DEPTH

Default value for the depth of parking spots on the left side.

DEFAULT_RIGHT_DEPTH

Default value for the depth of parking spots on the right side.

start

Start of the parking lot along the middle line relative to the parking area.

spots

Parking spots within this parking lot.

_side

Side of the road.

opening_angle

Opening angle of parking lot.

depth

Depth of parking spots within this lot.

length

Sum of the widths of all parking spots.

border

Outside border of the parking lot.

obstacles

All obstacles on spots.

lines

All border lines with solid marking type.

Methods:

set_transform(new_tf)

RIGHT_SIDE = 'right'

Possible value of side. Parking lot is on the left side of the road.

LEFT_SIDE = 'left'

Possible value of side. Parking lot is on the right side of the road.

DEFAULT_LEFT_DEPTH = 0.5

Default value for the depth of parking spots on the left side.

DEFAULT_RIGHT_DEPTH = 0.3

Default value for the depth of parking spots on the right side.

start: float = 0

Start of the parking lot along the middle line relative to the parking area.

spots: List[simulation.utils.road.sections.parking_area.ParkingSpot]

Parking spots within this parking lot.

_side: str = 'right'

Side of the road.

opening_angle: float = 1.0471975511965976

Opening angle of parking lot.

__transform: simulation.utils.geometry.transform.Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

depth: float = None

Depth of parking spots within this lot.

If no other value is provided, the default depth of parking lots is 0.5m on the left side and 0.3m on the right side.

set_transform(new_tf: simulation.utils.geometry.transform.Transform)[source]
property length: float

Sum of the widths of all parking spots.

Type

float

property border: simulation.utils.geometry.line.Line

Outside border of the parking lot.

Type

Line

property obstacles: List[simulation.utils.road.sections.obstacle.ParkingObstacle]

All obstacles on spots.

Type

List[ParkingObstacle]

property lines: List[simulation.utils.road.sections.road_section.MarkedLine]

All border lines with solid marking type.

Type

List[MarkedLine]

class ParkingArea(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 1, start_line: bool = False, start_line_length: float = 0.06, left_lots: List[simulation.utils.road.sections.parking_area.ParkingLot] = <factory>, right_lots: List[simulation.utils.road.sections.parking_area.ParkingLot] = <factory>)[source]

Bases: simulation.utils.road.sections.straight_road.StraightRoad

Part of the road with parking lots and a start line.

Parameters
  • left_lots (List[ParkingLot]) – Parking lots on the left side.

  • right_lots (List[ParkingLot]) – Parking lots on the right side.

  • start_line (bool) – Indicate whether the parking area starts with a start line.

  • start_line_length (float) – Manually set the length of the start line.

Attributes:

TYPE

Type of the road section.

start_line

If the parking area has a start line.

start_line_length

Length of the start line (if one is added.

left_lots

Parking lots on the left side.

right_lots

Parking lots on the right side.

parking_obstacles

All obstacles on parking spots.

lines

All borderlines with their marking type.

Methods:

set_transform(new_tf)

get_bounding_box()

Get a polygon around the road section.

obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

TYPE = 5

Type of the road section.

start_line: bool = False

If the parking area has a start line.

start_line_length: float = 0.06

Length of the start line (if one is added.

left_lots: List[simulation.utils.road.sections.parking_area.ParkingLot]

Parking lots on the left side.

right_lots: List[simulation.utils.road.sections.parking_area.ParkingLot]

Parking lots on the right side.

set_transform(new_tf: simulation.utils.geometry.transform.Transform)[source]
get_bounding_box()simulation.utils.geometry.polygon.Polygon[source]

Get a polygon around the road section.

Bounding box is an approximate representation of all points within a given distance of this geometric object.

property parking_obstacles: List[simulation.utils.road.sections.obstacle.ParkingObstacle]

All obstacles on parking spots.

Type

List[ParkingObstacle]

property lines: List[simulation.utils.road.sections.road_section.MarkedLine]

All borderlines with their marking type.

Type

List[MarkedLine]

simulation.utils.road.sections.road_element module

Road elements are simple individual components of the road that have a frame.

Examples are traffic signs, obstacles or surface markings (e.g. turn arrow on the ground.

Classes:

RoadElement(_Transformable__transform, …)

RoadElementRect(arc_length, y, width, depth, …)

Generic element of the road that has a frame.

class RoadElement(_Transformable__transform: simulation.utils.geometry.transform.Transform = None, normalize_x: bool = True, _frame: simulation.utils.geometry.polygon.Polygon = Polygon([Point(- 0.1, - 0.2, 0.0), Point(0.1, - 0.2, 0.0), Point(0.1, 0.2, 0.0), Point(- 0.1, 0.2, 0.0), Point(- 0.1, - 0.2, 0.0)]))[source]

Bases: simulation.utils.road.sections.transformable.Transformable

Attributes:

normalize_x

If true, all x-values are substracted by the lowest x-value.

_frame

Frame of the element in local coordinates.

frame

Frame of the element in global coordinates.

center

Center point of the element in global coordinates.

_center

Center point of the element in local coordinates.

Methods:

set_transform(obj)

Calculate the correct transform to this element.

normalize_x: bool = True

If true, all x-values are substracted by the lowest x-value.

_frame: simulation.utils.geometry.polygon.Polygon = Polygon([Point(-0.1, -0.2, 0.0), Point(0.1, -0.2, 0.0), Point(0.1, 0.2, 0.0), Point(-0.1, 0.2, 0.0), Point(-0.1, -0.2, 0.0)])

Frame of the element in local coordinates.

Type

Polygon

set_transform(obj: Union[simulation.utils.geometry.line.Line, simulation.utils.geometry.transform.Transform])[source]

Calculate the correct transform to this element.

Depending on self.normalize_x the positional behavior is different. If self.normalize_x is True, the element is aligned along the provided line.

property frame: simulation.utils.geometry.polygon.Polygon

Frame of the element in global coordinates.

Type

Polygon

property center: simulation.utils.geometry.point.Point

Center point of the element in global coordinates.

Type

Point

property _center: simulation.utils.geometry.point.Point

Center point of the element in local coordinates.

Type

Point

__transform: simulation.utils.geometry.transform.Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

class RoadElementRect(arc_length: float = 0.4, y: float = - 0.2, width: float = 0.2, depth: float = 0.2, angle: float = 0, normalize_x: bool = True, z: float = 0, height: float = 0)[source]

Bases: simulation.utils.road.sections.road_element.RoadElement

Generic element of the road that has a frame.

Examples of road elements are obstacles and traffic signs.

Parameters
  • arc_length – x coordinate of the element along the road.

  • y – y coordinate of the element. (Perpendicular to the road.)

  • width – Width of the element.

  • depth – Depth of the element. Component of the size in the direction of the road.

  • angle – Angle [radian] between the middle line and the element (measured at the center).

Attributes:

width

Width of the element.

depth

Depth (length) of the element.

angle

Angle [radian] between the middle line and the element (measured at the center).

orientation

Orientation of the element in global coordinates in radians.

__transform: simulation.utils.geometry.transform.Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

width: float = 0.2

Width of the element.

depth: float = 0.2

Depth (length) of the element.

angle: float = 0

Angle [radian] between the middle line and the element (measured at the center).

property orientation: float

Orientation of the element in global coordinates in radians.

Type

float

simulation.utils.road.sections.road_section module

The RoadSection is parent to all other RoadSection classes.

Classes:

MarkedLine(*args, **kwargs)

Line with a defined line marking style.

RoadSection(_Transformable__transform, id, …)

Base class of all road sections.

class MarkedLine(*args, **kwargs)[source]

Bases: simulation.utils.geometry.line.Line

Line with a defined line marking style.

Methods:

from_line(line, style[, prev_length])

classmethod from_line(line: simulation.utils.geometry.line.Line, style, prev_length=0)[source]
class RoadSection(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0)[source]

Bases: simulation.utils.road.sections.transformable.Transformable

Base class of all road sections.

Attributes:

SOLID_LINE_MARKING

Continuous white line.

DASHED_LINE_MARKING

Dashed white line.

MISSING_LINE_MARKING

No line at all.

DOUBLE_SOLID_LINE_MARKING

Double solid line.

DOUBLE_DASHED_LINE_MARKING

Double dashed line.

DASHED_SOLID_LINE_MARKING

Double line, left dashed, right solid

SOLID_DASHED_LINE_MARKING

Double line, left solid, right dashed

id

Road section id (consecutive integers by default).

is_start

Road section is beginning of the road.

left_line_marking

Marking type of the left line.

middle_line_marking

Marking type of the middle line.

right_line_marking

Marking type of the right line.

obstacles

Obstacles in the road section.

traffic_signs

Traffic signs in the road section.

surface_markings

Surface markings in the road section.

_speed_limits

Speed limits in the road section.

TYPE

Type of the road section.

prev_length

Length of Road up to this section.

middle_line

Middle line of the road section.

left_line

Left line of the road section.

right_line

Right line of the road section.

lines

All road lines with their marking type.

speed_limits

Speed limits in the road section.

Methods:

set_transform(tf)

get_bounding_box()

Get a polygon around the road section.

get_beginning()

Get the beginning of the section as a pose and the curvature.

get_ending()

Get the ending of the section as a pose and the curvature.

add_speed_limit(arc_length, speed)

Add a speed limit to this road section.

add_obstacle([arc_length, y_offset, angle, …])

Add an obstacle to the road.

fit_ending(current_ending, desired_ending[, …])

Add a cubic bezier curve to adjust the current ending to equal a desired ending.

SOLID_LINE_MARKING = 'solid'

Continuous white line.

DASHED_LINE_MARKING = 'dashed'

Dashed white line.

MISSING_LINE_MARKING = 'missing'

No line at all.

DOUBLE_SOLID_LINE_MARKING = 'double_solid'

Double solid line.

DOUBLE_DASHED_LINE_MARKING = 'double_dashed'

Double dashed line.

DASHED_SOLID_LINE_MARKING = 'dashed_solid'

Double line, left dashed, right solid

SOLID_DASHED_LINE_MARKING = 'solid_dashed'

Double line, left solid, right dashed

id: int = 0

Road section id (consecutive integers by default).

is_start: bool = False

Road section is beginning of the road.

left_line_marking: str = 'solid'

Marking type of the left line.

middle_line_marking: str = 'dashed'

Marking type of the middle line.

right_line_marking: str = 'solid'

Marking type of the right line.

obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle]

Obstacles in the road section.

traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign]

Traffic signs in the road section.

surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit]

Speed limits in the road section.

__transform: simulation.utils.geometry.transform.Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

TYPE = None

Type of the road section.

prev_length: float = 0

Length of Road up to this section.

set_transform(tf)[source]
property middle_line

Middle line of the road section.

Type

Line

property left_line: simulation.utils.geometry.line.Line

Left line of the road section.

Type

Line

property right_line: simulation.utils.geometry.line.Line

Right line of the road section.

Type

Line

property lines: List[simulation.utils.road.sections.road_section.MarkedLine]

All road lines with their marking type.

Type

List[MarkedLine]

property speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit]

Speed limits in the road section.

get_bounding_box()simulation.utils.geometry.polygon.Polygon[source]

Get a polygon around the road section.

Bounding box is an approximate representation of all points within a given distance of this geometric object.

get_beginning()Tuple[simulation.utils.geometry.pose.Pose, float][source]

Get the beginning of the section as a pose and the curvature.

Returns

A tuple consisting of the first point on the middle line together with the direction facing away from the road section as a pose and the curvature at the beginning of the middle line.

get_ending()Tuple[simulation.utils.geometry.pose.Pose, float][source]

Get the ending of the section as a pose and the curvature.

Returns

A tuple consisting of the last point on the middle line together with the direction facing along the middle line as a pose and the curvature at the ending of the middle line.

add_speed_limit(arc_length: float, speed: int)[source]

Add a speed limit to this road section.

Parameters
  • arc_length – Direction along the road to the speed limit.

  • speed – Speed limit. Negative values correspond to the end of a speed limit zone.

add_obstacle(arc_length: float = 0.2, y_offset: float = - 0.2, angle: float = 0, width: float = 0.2, length: float = 0.3, height: float = 0.25)[source]

Add an obstacle to the road.

Args: arc_length: Direction along the road to the obstacle. y_offset: Offset orthogonal to the middle line. angle: Orientation offset of the obstacle. width: Width of the obstacle. length: Length of the obstacle. height: Heigth of the obstacle.

classmethod fit_ending(current_ending: simulation.utils.geometry.pose.Pose, desired_ending: simulation.utils.geometry.pose.Pose, control_point_distance=0.4)simulation.utils.road.sections.road_section.RoadSection[source]

Add a cubic bezier curve to adjust the current ending to equal a desired ending.

Parameters
  • current_ending – Current ending of the last section.

  • desired_ending – Ending that the last section should have.

  • control_point_distance – Distance to the bezier curve’s control points.

simulation.utils.road.sections.speed_limit module

Classes:

SpeedLimit(x_position, limit)

class SpeedLimit(x_position: float, limit: int)[source]

Bases: object

Attributes:

x_position

The position on the road

limit

The speed limit

traffic_sign

The traffic sign for this speed limit.

surface_marking

The surface marking for this speed limit.

x_position: float

The position on the road

limit: int

The speed limit

property traffic_sign: simulation.utils.road.sections.traffic_sign.TrafficSign

The traffic sign for this speed limit.

Type

TrafficSign

property surface_marking: simulation.utils.road.sections.surface_marking.SurfaceMarkingRect

The surface marking for this speed limit.

Type

SurfaceMarking

simulation.utils.road.sections.straight_road module

The StraightRoad can be used to create straight sections of a road.

As any other road sections, line markings can be variied and obstacles created on the road.

Classes:

StraightRoad(_Transformable__transform, id, …)

Straight section of the road.

class StraightRoad(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 1)[source]

Bases: simulation.utils.road.sections.road_section.RoadSection

Straight section of the road.

Parameters

length (float) – Length [m] of the section.

Example

>>> from simulation.utils.road.sections import StraightRoad
>>> from simulation.utils.road.road import Road
>>> road = Road()
>>> straight_road = road.append(StraightRoad(length=2))
>>> road
Road(_name=None, _seed=None, use_seed=True, sections=[StraightRoad(_Transformable__transform=Transform(translation=Vector(0.0, 0.0, 0.0),rotation=Quaternion(1.0, 0.0, 0.0, 0.0)), id=0, is_start=False, left_line_marking='solid', middle_line_marking='dashed', right_line_marking='solid', obstacles=[], traffic_signs=[], surface_markings=[], _speed_limits=[], prev_length=0, length=2)], length=2.0)

Attributes:

TYPE

Type of the road section.

length

Length of the section.

middle_line

Middle line of the road section.

TYPE = 0

Type of the road section.

length: float = 1

Length of the section.

property middle_line

Middle line of the road section.

Type

Line

obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

simulation.utils.road.sections.surface_marking module

Classes:

SurfaceMarking(kind, str] = None)

SurfaceMarkingPoly(kind, str] = None, …)

SurfaceMarkingRect(kind, str], arc_length, …)

class SurfaceMarking(kind: Tuple[int, str] = None)[source]

Bases: object

Attributes:

START_LINE

ZEBRA_CROSSING

BLOCKED_AREA

PARKING_SPOT_X

TRAFFIC_ISLAND_BLOCKED

ZEBRA_LINES

RIGHT_TURN_MARKING

LEFT_TURN_MARKING

STOP_LINE

GIVE_WAY_LINE

ZONE_10_START

ZONE_20_START

ZONE_30_START

ZONE_40_START

ZONE_50_START

ZONE_60_START

ZONE_70_START

ZONE_80_START

ZONE_90_START

ZONE_10_END

ZONE_20_END

ZONE_30_END

ZONE_40_END

ZONE_50_END

ZONE_60_END

ZONE_70_END

ZONE_80_END

ZONE_90_END

kind

Kind of the surface marking.

START_LINE = (201, 'Startline')
ZEBRA_CROSSING = (202, 'CrosswalkLines')
BLOCKED_AREA = (203, 'Blockedarea')
PARKING_SPOT_X = (204, 'ParkingspotX')
TRAFFIC_ISLAND_BLOCKED = (205, 'Trafficisland')
ZEBRA_LINES = (206, 'CrosswalkNoLines')
RIGHT_TURN_MARKING = (207, 'RightArrow')
LEFT_TURN_MARKING = (208, 'LeftArrow')
STOP_LINE = (209, 'Stopline')
GIVE_WAY_LINE = (210, 'GiveWayLine')
ZONE_10_START = (211, 'ZONE_10_START')
ZONE_20_START = (212, 'ZONE_20_START')
ZONE_30_START = (213, 'ZONE_30_START')
ZONE_40_START = (214, 'ZONE_40_START')
ZONE_50_START = (215, 'ZONE_50_START')
ZONE_60_START = (216, 'ZONE_60_START')
ZONE_70_START = (217, 'ZONE_70_START')
ZONE_80_START = (218, 'ZONE_80_START')
ZONE_90_START = (219, 'ZONE_90_START')
ZONE_10_END = (220, 'ZONE_10_END')
ZONE_20_END = (221, 'ZONE_20_END')
ZONE_30_END = (222, 'ZONE_30_END')
ZONE_40_END = (223, 'ZONE_40_END')
ZONE_50_END = (224, 'ZONE_50_END')
ZONE_60_END = (225, 'ZONE_60_END')
ZONE_70_END = (226, 'ZONE_70_END')
ZONE_80_END = (227, 'ZONE_80_END')
ZONE_90_END = (228, 'ZONE_90_END')
kind: Tuple[int, str] = None

Kind of the surface marking.

class SurfaceMarkingPoly(kind: Tuple[int, str] = None, _Transformable__transform: simulation.utils.geometry.transform.Transform = None, normalize_x: bool = True, _frame: simulation.utils.geometry.polygon.Polygon = Polygon([Point(- 0.1, - 0.2, 0.0), Point(0.1, - 0.2, 0.0), Point(0.1, 0.2, 0.0), Point(- 0.1, 0.2, 0.0), Point(- 0.1, - 0.2, 0.0)]))[source]

Bases: simulation.utils.road.sections.road_element.RoadElement, simulation.utils.road.sections.surface_marking.SurfaceMarking

Attributes:

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

class SurfaceMarkingRect(kind: Tuple[int, str], arc_length: float, y: float = - 0.5, depth: float = 0.4, width: float = 0.4, angle=0, normalize_x: bool = True)[source]

Bases: simulation.utils.road.sections.road_element.RoadElementRect, simulation.utils.road.sections.surface_marking.SurfaceMarking

Attributes:

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

simulation.utils.road.sections.traffic_island module

TrafficIsland.

Classes:

TrafficIsland(_Transformable__transform, id, …)

Road section representing an traffic island.

class TrafficIsland(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, island_width: float = 0.3, zebra_length: float = 0.45, curve_area_length: float = 0.8, curvature: float = 0.4, zebra_marking_type: int = 1, _sign_distance: float = 0.3)[source]

Bases: simulation.utils.road.sections.road_section.RoadSection

Road section representing an traffic island.

Parameters
  • island_width (float) – width of the island in the middle

  • zebra_length (float) – length of zebra section on the island

  • curve_area_length (float) – length of curve area section

  • curvature (float) – amount of curvature ranging from 0 to 1

  • zebra_marking_type (int) – marking on the middle of the island

Attributes:

TYPE

Type of the road section.

LINES

Possible value for zebra_marking_type.

ZEBRA

Possible value for zebra_marking_type.

island_width

Width of island in the middle.

zebra_length

Length of the zebra crossing area.

curve_area_length

Length of the bezier curve area at start and end of island.

curvature

Define where along the curve area the control points are located.

zebra_marking_type

Type of zebra marking type.

_sign_distance

Distance of the directions signs from the mid island part.

length

Length of the entire section.

middle_start

middle_r_zebra_start

middle_r_zebra_end

middle_end

right_zebra_start

right_zebra_end

left_zebra_start

left_zebra_end

middle_l_zebra_start

middle_l_zebra_end

bezier_points_mid_r_start

bezier_points_mid_r_end

bezier_points_mid_l_start

bezier_points_mid_l_end

middle_line_r

Middle line on the right side of the traffic island.

middle_line_l

Middle line on the left side of the traffic island.

middle_line

Middle line of the road section.

right_line

Right line of the road section.

left_line

Left line of the road section.

lines

All road lines with their marking type.

TYPE = 9

Type of the road section.

LINES = 0

Possible value for zebra_marking_type. Show lines on the island.

ZEBRA = 1

Possible value for zebra_marking_type. Show zebra crossing on the island.

island_width: float = 0.3

Width of island in the middle.

zebra_length: float = 0.45

Length of the zebra crossing area.

curve_area_length: float = 0.8

Length of the bezier curve area at start and end of island.

curvature: float = 0.4

Define where along the curve area the control points are located.

zebra_marking_type: int = 1

Type of zebra marking type. Can be LINES or ZEBRA.

_sign_distance: float = 0.3

Distance of the directions signs from the mid island part.

property length: float

Length of the entire section.

property middle_start: simulation.utils.geometry.vector.Vector
property middle_r_zebra_start: simulation.utils.geometry.vector.Vector
property middle_r_zebra_end: simulation.utils.geometry.vector.Vector
property middle_end: simulation.utils.geometry.vector.Vector
property right_zebra_start: simulation.utils.geometry.vector.Vector
property right_zebra_end: simulation.utils.geometry.vector.Vector
property left_zebra_start: simulation.utils.geometry.vector.Vector
property left_zebra_end: simulation.utils.geometry.vector.Vector
property middle_l_zebra_start: simulation.utils.geometry.vector.Vector
property middle_l_zebra_end: simulation.utils.geometry.vector.Vector
property bezier_points_mid_r_start: List[simulation.utils.geometry.point.Point]
property bezier_points_mid_r_end: List[simulation.utils.geometry.point.Point]
property bezier_points_mid_l_start: List[simulation.utils.geometry.point.Point]
obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

property bezier_points_mid_l_end: List[simulation.utils.geometry.point.Point]
property middle_line_r: simulation.utils.geometry.line.Line

Middle line on the right side of the traffic island.

Type

Line

property middle_line_l: simulation.utils.geometry.line.Line

Middle line on the left side of the traffic island.

Type

Line

property middle_line

Middle line of the road section. Here it is the left middle line.

Type

Line

property right_line: simulation.utils.geometry.line.Line

Right line of the road section.

Type

Line

property left_line: simulation.utils.geometry.line.Line

Left line of the road section.

Type

Line

property lines: List[simulation.utils.road.sections.road_section.MarkedLine]

All road lines with their marking type.

Type

List[MarkedLine]

simulation.utils.road.sections.traffic_sign module

Classes:

SignTuple(mesh, id_, collision_box_size, …)

TrafficSign(kind, arc_length, y[, angle])

Functions:

get_all_signs()

class SignTuple(mesh: str, id_: int = None, collision_box_size: Tuple[float, float, float] = (0.015, 0.15, 0.3), collision_box_position: Tuple[float, float, float] = (0, 0, 0.15))[source]

Bases: object

Attributes:

id_

large_sign_collision_box_size

large_sign_collision_box_position

small_sign_collision_box_size

small_sign_collision_box_position

collision_box_size

collision_box_position

mesh: str
id_: int = None
large_sign_collision_box_size = (0.015, 0.15, 0.3)
large_sign_collision_box_position = (0, 0, 0.15)
small_sign_collision_box_size = (0.015, 0.1, 0.275)
small_sign_collision_box_position = (0, 0, 0.1375)
collision_box_size: Tuple[float, float, float] = (0.015, 0.15, 0.3)
collision_box_position: Tuple[float, float, float] = (0, 0, 0.15)
get_all_signs()[source]
class TrafficSign(kind: simulation.utils.road.sections.traffic_sign.SignTuple, arc_length: float, y: float = - 0.5, angle=0, normalize_x: bool = True, visible: bool = True)[source]

Bases: simulation.utils.road.sections.road_element.RoadElementRect

Attributes:

ZONE_10_START

ZONE_20_START

ZONE_30_START

ZONE_40_START

ZONE_50_START

ZONE_60_START

ZONE_70_START

ZONE_80_START

ZONE_90_START

ZONE_10_END

ZONE_20_END

ZONE_30_END

ZONE_40_END

ZONE_50_END

ZONE_60_END

ZONE_70_END

ZONE_80_END

ZONE_90_END

RAMP_START

RAMP_END

PRIORITY

YIELD

STOP

ONCOMING_TRAFFIC

NO_OVERTAKING_START

NO_OVERTAKING_END

TURN_RIGHT

TURN_LEFT

PASS_RIGHT

PASS_LEFT

SHARP_TURN_RIGHT_SMALL

SHARP_TURN_RIGHT

SHARP_TURN_LEFT_SMALL

SHARP_TURN_LEFT

ZEBRA_CROSSING

PARKING

EXPRESSWAY_START

EXPRESSWAY_END

kind

visible

Indicate whether the traffic sign is visible while driving on the road.

ZONE_10_START = SignTuple(mesh='speed_limit_zone_10_start_sign', id_=101, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_20_START = SignTuple(mesh='speed_limit_zone_20_start_sign', id_=102, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_30_START = SignTuple(mesh='speed_limit_zone_30_start_sign', id_=103, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_40_START = SignTuple(mesh='speed_limit_zone_40_start_sign', id_=104, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_50_START = SignTuple(mesh='speed_limit_zone_50_start_sign', id_=105, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_60_START = SignTuple(mesh='speed_limit_zone_60_start_sign', id_=106, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_70_START = SignTuple(mesh='speed_limit_zone_70_start_sign', id_=107, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_80_START = SignTuple(mesh='speed_limit_zone_80_start_sign', id_=108, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_90_START = SignTuple(mesh='speed_limit_zone_90_start_sign', id_=109, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_10_END = SignTuple(mesh='speed_limit_zone_10_end_sign', id_=110, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_20_END = SignTuple(mesh='speed_limit_zone_20_end_sign', id_=111, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_30_END = SignTuple(mesh='speed_limit_zone_30_end_sign', id_=112, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_40_END = SignTuple(mesh='speed_limit_zone_40_end_sign', id_=113, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_50_END = SignTuple(mesh='speed_limit_zone_50_end_sign', id_=114, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_60_END = SignTuple(mesh='speed_limit_zone_60_end_sign', id_=115, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_70_END = SignTuple(mesh='speed_limit_zone_70_end_sign', id_=116, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_80_END = SignTuple(mesh='speed_limit_zone_80_end_sign', id_=117, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_90_END = SignTuple(mesh='speed_limit_zone_90_end_sign', id_=118, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
RAMP_START = SignTuple(mesh='uphill_grade_sign', id_=119, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
RAMP_END = SignTuple(mesh='downhill_grade_sign', id_=120, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
PRIORITY = SignTuple(mesh='priority_sign', id_=121, collision_box_size=(0.015, 0.1, 0.275), collision_box_position=(0, 0, 0.1375))
YIELD = SignTuple(mesh='yield_sign', id_=122, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
STOP = SignTuple(mesh='stop_sign', id_=123, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ONCOMING_TRAFFIC = SignTuple(mesh='oncoming_traffic_sign', id_=124, collision_box_size=(0.015, 0.1, 0.275), collision_box_position=(0, 0, 0.1375))
NO_OVERTAKING_START = SignTuple(mesh='no_overtaking_start_sign', id_=125, collision_box_size=(0.015, 0.1, 0.275), collision_box_position=(0, 0, 0.1375))
NO_OVERTAKING_END = SignTuple(mesh='no_overtaking_end_sign', id_=126, collision_box_size=(0.015, 0.1, 0.275), collision_box_position=(0, 0, 0.1375))
TURN_RIGHT = SignTuple(mesh='turn_right_sign', id_=127, collision_box_size=(0.015, 0.1, 0.275), collision_box_position=(0, 0, 0.1375))
TURN_LEFT = SignTuple(mesh='turn_left_sign', id_=128, collision_box_size=(0.015, 0.1, 0.275), collision_box_position=(0, 0, 0.1375))
PASS_RIGHT = SignTuple(mesh='pass_right_sign', id_=129, collision_box_size=(0.015, 0.1, 0.125), collision_box_position=(0, 0, 0.0625))
PASS_LEFT = SignTuple(mesh='pass_left_sign', id_=130, collision_box_size=(0.015, 0.1, 0.125), collision_box_position=(0, 0, 0.0625))
SHARP_TURN_RIGHT_SMALL = SignTuple(mesh='sharp_turn_right_small_sign', id_=131, collision_box_size=(0.015, 0.1, 0.125), collision_box_position=(0, 0, 0.0625))
SHARP_TURN_RIGHT = SignTuple(mesh='sharp_turn_right_sign', id_=132, collision_box_size=(0.015, 0.3, 0.125), collision_box_position=(0, 0, 0.0625))
SHARP_TURN_LEFT_SMALL = SignTuple(mesh='sharp_turn_left_small_sign', id_=133, collision_box_size=(0.015, 0.1, 0.125), collision_box_position=(0, 0, 0.0625))
SHARP_TURN_LEFT = SignTuple(mesh='sharp_turn_left_sign', id_=134, collision_box_size=(0.015, 0.3, 0.125), collision_box_position=(0, 0, 0.0625))
ZEBRA_CROSSING = SignTuple(mesh='zebra_crossing_sign', id_=135, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
PARKING = SignTuple(mesh='parking_sign', id_=136, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
EXPRESSWAY_START = SignTuple(mesh='expressway_start_sign', id_=137, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
EXPRESSWAY_END = SignTuple(mesh='expressway_end_sign', id_=138, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

kind: simulation.utils.road.sections.traffic_sign.SignTuple = None
visible: bool = True

Indicate whether the traffic sign is visible while driving on the road.

simulation.utils.road.sections.transformable module

Classes:

Transformable(_Transformable__transform)

Object which defines a transform property.

class Transformable(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None)[source]

Bases: object

Object which defines a transform property.

The transform can only be modified through the set_transform().

Attributes:

__transform

Transform to origin of the object.

transform

Methods:

set_transform(new_tf)

__transform: simulation.utils.geometry.transform.Transform = None

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

property transform
set_transform(new_tf: simulation.utils.geometry.transform.Transform)[source]

simulation.utils.road.sections.type module

Definition of all road section types.

Data:

STRAIGHT_ROAD

LEFT_CIRCULAR_ARC

RIGHT_CIRCULAR_ARC

QUAD_BEZIER

CUBIC_BEZIER

PARKING_AREA

ZEBRA_CROSSING

INTERSECTION

BLOCKED_AREA

TRAFFIC_ISLAND

CUSTOM

STRAIGHT_ROAD = 0
LEFT_CIRCULAR_ARC = 1
RIGHT_CIRCULAR_ARC = 2
QUAD_BEZIER = 3
CUBIC_BEZIER = 4
PARKING_AREA = 5
ZEBRA_CROSSING = 6
INTERSECTION = 7
BLOCKED_AREA = 8
TRAFFIC_ISLAND = 9
CUSTOM = 10

simulation.utils.road.sections.zebra_crossing module

ZebraCrossing.

Classes:

ZebraCrossing(_Transformable__transform, id, …)

Road section representing a zebra crossing.

class ZebraCrossing(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 0.45)[source]

Bases: simulation.utils.road.sections.straight_road.StraightRoad

Road section representing a zebra crossing.

Parameters

length (float) – length of the crossing and thus the section.

Attributes:

TYPE

Type of the road section.

length

Length of the section.

frame

Frame for the zebra crossing surface marking.

TYPE = 6

Type of the road section.

length: float = 0.45

Length of the section.

property frame: simulation.utils.geometry.polygon.Polygon

Frame for the zebra crossing surface marking.

Type

Polygon

obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

Module contents

Definition of the road.sections module.

Collect classes and functions which should be included in the road.sections module.

If these imports are rearranged cyclic imports may occur. To prevent this: isort:skip_file

Classes:

QuadBezier(_Transformable__transform, id, …)

Quadratic bezier curve, defined by two control points.

CubicBezier(_Transformable__transform, id, …)

Cubic bezier curve, defined by three control points.

LeftCircularArc(_Transformable__transform, …)

Part of a circle with a positive curvature.

RightCircularArc(_Transformable__transform, …)

Part of a circle with a negative curvature.

Intersection(_Transformable__transform, id, …)

Road section representing an intersection.

StaticObstacle(arc_length, y, width, depth, …)

Obstacle that can be placed on the road.

ParkingObstacle(x, y, width, depth, height)

Obstacle that can be placed on a parking spot.

TrafficSign(kind, arc_length, y[, angle])

SurfaceMarkingPoly(kind, str] = None, …)

SurfaceMarkingRect(kind, str], arc_length, …)

ParkingArea(_Transformable__transform, id, …)

Part of the road with parking lots and a start line.

ParkingLot(_Transformable__transform, start, …)

Outline of a parking lot (right/left side) and all parking spots contained within.

ParkingSpot(kind, width, obstacle)

Parking spot with a type and optionally an obstacle placed on top.

StraightRoad(_Transformable__transform, id, …)

Straight section of the road.

ZebraCrossing(_Transformable__transform, id, …)

Road section representing a zebra crossing.

RoadSection(_Transformable__transform, id, …)

Base class of all road sections.

BlockedArea(_Transformable__transform, id, …)

Road section representing a blocked area.

TrafficIsland(_Transformable__transform, id, …)

Road section representing an traffic island.

SpeedLimit(x_position, limit)

CustomSection(_Transformable__transform, id, …)

class QuadBezier(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, p1: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None, p2: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None)[source]

Bases: simulation.utils.road.sections.bezier_curve.BezierCurve

Quadratic bezier curve, defined by two control points.

Parameters
  • p1 (Union[Point, Sequence[float]]) – Control point 1. Y-Value has to be zero in order to match the gradient of the last section at the start.

  • p2 (Union[Point, Sequence[float]]) – Control point 2.

Attributes:

TYPE

Type of the road section.

middle_line

Middle line of the road section.

TYPE = 3

Type of the road section.

property middle_line

Middle line of the road section.

Type

Line

obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

class CubicBezier(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, p1: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None, p2: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None, p3: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None)[source]

Bases: simulation.utils.road.sections.bezier_curve.BezierCurve

Cubic bezier curve, defined by three control points.

Parameters
  • p1 (Union[Point, Sequence[float]]) – Control point 1.

  • p2 (Union[Point, Sequence[float]]) – Control point 2.

  • p3 (Union[Point, Sequence[float]]) – Control point 3.

Attributes:

TYPE

Type of the road section.

p3

Control point 3.

middle_line

Middle line of the road section.

TYPE = 4

Type of the road section.

p3: Union[simulation.utils.geometry.point.Point, Sequence[float]] = None

Control point 3.

obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

property middle_line: simulation.utils.geometry.line.Line

Middle line of the road section.

Type

Line

class LeftCircularArc(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, radius: Optional[float] = None, angle: Optional[float] = None)[source]

Bases: simulation.utils.road.sections.circular_arc.CircularArc

Part of a circle with a positive curvature.

Parameters
  • radius (float) – Radius [m].

  • angle (float) – Part of the circle [radian].

Attributes:

TYPE

Type of the road section.

TYPE = 1

Type of the road section.

obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

class RightCircularArc(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, radius: Optional[float] = None, angle: Optional[float] = None)[source]

Bases: simulation.utils.road.sections.circular_arc.CircularArc

Part of a circle with a negative curvature.

Parameters
  • radius (float) – Radius [m].

  • angle (float) – Part of the circle [radian].

Attributes:

TYPE

Type of the road section.

obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

TYPE = 2

Type of the road section.

class Intersection(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, angle: float = 1.5707963267948966, closing: Optional[str] = None, turn: int = 0, rule: int = 0, size: float = 1.8, exit_direction: Optional[int] = None)[source]

Bases: simulation.utils.road.sections.road_section.RoadSection

Road section representing an intersection.

Parameters
  • angle (float) – Angle [radian] between crossing roads.

  • closing (int) – Optionally close one direction to create a T-intersection.

  • turn (int) – Direction in which the road continues.

  • rule (int) – Priority-rule at intersection.

  • size (float) – Length of the crossing roads.

Attributes:

TYPE

Type of the road section.

STRAIGHT

Possible value for turn.

LEFT

Possible value for turn.

RIGHT

Possible value for turn.

EQUAL

Possible value for rule.

YIELD

Possible value for rule.

STOP

Possible value for rule.

PRIORITY_YIELD

Possible value for rule.

PRIORITY_STOP

Possible value for rule.

angle

Angle between intersecting roads [radian].

closing

Closed direction (T-intersection).

turn

Direction in which road continues.

rule

Priority rule at intersection.

size

Size of intersection (from one side to the other).

exit_direction

Optional parameter to overwrite the visible turning direction.

sin

cos

y

x

z

u

v

w

ll

ls

rl

rs

middle_line_south

left_line_south

right_line_south

middle_line_east

left_line_east

right_line_east

middle_line_north

left_line_north

right_line_north

middle_line_west

left_line_west

right_line_west

ls_circle

ll_circle

rs_circle

rl_circle

middle_line

Middle line of the intersection.

lines

All road lines with their marking type.

Methods:

cp_sign_south(sign_dist)

cp_surface_south()

cp_sign_west(sign_dist)

cp_surface_west()

cp_sign_north(sign_dist)

cp_sign_east(sign_dist)

cp_surface_east()

get_points()

get_beginning()

Get the beginning of the section as a pose and the curvature.

get_ending()

Get the ending of the section as a pose and the curvature.

get_bounding_box()

Get a polygon around the road section.

_get_intersection_traffic_signs()

_get_intersection_surface_markings()

TYPE = 7

Type of the road section.

STRAIGHT = 0

Possible value for turn. Drive straight through the intersection.

LEFT = 1

Possible value for turn. Turn left at the intersection.

RIGHT = 2

Possible value for turn. Turn right at the intersection.

EQUAL = 0

Possible value for rule. Rechts vor links.

YIELD = 1

Possible value for rule. Car must yield.

STOP = 2

Possible value for rule. Car must stop.

PRIORITY_YIELD = 3

Possible value for rule. Car will have the right of way.

Intersecting road must yield.

PRIORITY_STOP = 4

Possible value for rule. Car will have the right of way.

Intersecting road must stop.

angle: float = 1.5707963267948966

Angle between intersecting roads [radian].

closing: str = None

Closed direction (T-intersection).

turn: int = 0

Direction in which road continues.

rule: int = 0

Priority rule at intersection.

size: float = 1.8

Size of intersection (from one side to the other).

exit_direction: int = None

Optional parameter to overwrite the visible turning direction.

property sin
property cos
property y
property x
property z
property u
property v
property w
property ll
property ls
property rl
property rs
cp_sign_south(sign_dist)[source]
cp_surface_south()[source]
cp_sign_west(sign_dist)[source]
cp_surface_west()[source]
cp_sign_north(sign_dist)[source]
cp_sign_east(sign_dist)[source]
cp_surface_east()[source]
get_points()[source]
property middle_line_south: simulation.utils.geometry.line.Line
property left_line_south: simulation.utils.geometry.line.Line
property right_line_south: simulation.utils.geometry.line.Line
property middle_line_east: simulation.utils.geometry.line.Line
property left_line_east: simulation.utils.geometry.line.Line
property right_line_east: simulation.utils.geometry.line.Line
property middle_line_north: simulation.utils.geometry.line.Line
property left_line_north: simulation.utils.geometry.line.Line
property right_line_north: simulation.utils.geometry.line.Line
property middle_line_west: simulation.utils.geometry.line.Line
obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

property left_line_west: simulation.utils.geometry.line.Line
property right_line_west: simulation.utils.geometry.line.Line
property ls_circle: simulation.utils.geometry.line.Line
property ll_circle: simulation.utils.geometry.line.Line
property rs_circle: simulation.utils.geometry.line.Line
property rl_circle: simulation.utils.geometry.line.Line
property middle_line

Middle line of the intersection.

Type

Line

property lines: List[simulation.utils.road.sections.road_section.MarkedLine]

All road lines with their marking type.

Type

List[MarkedLine]

get_beginning()Tuple[simulation.utils.geometry.pose.Pose, float][source]

Get the beginning of the section as a pose and the curvature.

Returns

A tuple consisting of the first point on the middle line together with the direction facing away from the road section as a pose and the curvature at the beginning of the middle line.

get_ending()Tuple[simulation.utils.geometry.pose.Pose, float][source]

Get the ending of the section as a pose and the curvature.

Returns

A tuple consisting of the last point on the middle line together with the direction facing along the middle line as a pose and the curvature at the ending of the middle line.

get_bounding_box()simulation.utils.geometry.polygon.Polygon[source]

Get a polygon around the road section.

Bounding box is an approximate representation of all points within a given distance of this geometric object.

_get_intersection_traffic_signs()List[simulation.utils.road.sections.traffic_sign.TrafficSign][source]
_get_intersection_surface_markings()List[simulation.utils.road.sections.surface_marking.SurfaceMarkingRect][source]
class StaticObstacle(arc_length: float = 0.4, y: float = - 0.2, width: float = 0.2, depth: float = 0.2, height: float = 0.2, angle=0)[source]

Bases: simulation.utils.road.sections.road_element.RoadElementRect

Obstacle that can be placed on the road.

Parameters
  • arc_length – x coordinate of the element along the road.

  • y – y coordinate of the element. (Perpendicular to the road.)

  • width – Width of the element.

  • depth – Depth of the element. Component of the size in the direction of the road.

  • height – Height of the element.

  • angle – Angle [radian] between the middle line and the element (measured at the center).

Attributes:

id_

desc

id_ = 1
desc = 'StaticObstacle'
__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

class ParkingObstacle(x: float = 0.15, y: float = - 0.15, width: float = 0.15, depth: float = 0.15, height: float = 0.2, angle=0)[source]

Bases: simulation.utils.road.sections.obstacle.StaticObstacle

Obstacle that can be placed on a parking spot.

Parameters
  • x – x coordinate of the element along the road.

  • y – y coordinate of the element. (Perpendicular to the road.)

  • width – Width of the element.

  • depth – Depth of the element. Component of the size in the direction of the spot.

  • height – Height of the element.

  • angle – Angle [radian] between the parking spot and the element (measured at the center).

Attributes:

id_

desc

id_ = 2
desc = 'ParkingObstacle'
__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

class TrafficSign(kind: simulation.utils.road.sections.traffic_sign.SignTuple, arc_length: float, y: float = - 0.5, angle=0, normalize_x: bool = True, visible: bool = True)[source]

Bases: simulation.utils.road.sections.road_element.RoadElementRect

Attributes:

ZONE_10_START

ZONE_20_START

ZONE_30_START

ZONE_40_START

ZONE_50_START

ZONE_60_START

ZONE_70_START

ZONE_80_START

ZONE_90_START

ZONE_10_END

ZONE_20_END

ZONE_30_END

ZONE_40_END

ZONE_50_END

ZONE_60_END

ZONE_70_END

ZONE_80_END

ZONE_90_END

RAMP_START

RAMP_END

PRIORITY

YIELD

STOP

ONCOMING_TRAFFIC

NO_OVERTAKING_START

NO_OVERTAKING_END

TURN_RIGHT

TURN_LEFT

PASS_RIGHT

PASS_LEFT

SHARP_TURN_RIGHT_SMALL

SHARP_TURN_RIGHT

SHARP_TURN_LEFT_SMALL

SHARP_TURN_LEFT

ZEBRA_CROSSING

PARKING

EXPRESSWAY_START

EXPRESSWAY_END

kind

visible

Indicate whether the traffic sign is visible while driving on the road.

ZONE_10_START = SignTuple(mesh='speed_limit_zone_10_start_sign', id_=101, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_20_START = SignTuple(mesh='speed_limit_zone_20_start_sign', id_=102, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_30_START = SignTuple(mesh='speed_limit_zone_30_start_sign', id_=103, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_40_START = SignTuple(mesh='speed_limit_zone_40_start_sign', id_=104, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_50_START = SignTuple(mesh='speed_limit_zone_50_start_sign', id_=105, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_60_START = SignTuple(mesh='speed_limit_zone_60_start_sign', id_=106, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_70_START = SignTuple(mesh='speed_limit_zone_70_start_sign', id_=107, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_80_START = SignTuple(mesh='speed_limit_zone_80_start_sign', id_=108, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_90_START = SignTuple(mesh='speed_limit_zone_90_start_sign', id_=109, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_10_END = SignTuple(mesh='speed_limit_zone_10_end_sign', id_=110, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_20_END = SignTuple(mesh='speed_limit_zone_20_end_sign', id_=111, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_30_END = SignTuple(mesh='speed_limit_zone_30_end_sign', id_=112, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_40_END = SignTuple(mesh='speed_limit_zone_40_end_sign', id_=113, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_50_END = SignTuple(mesh='speed_limit_zone_50_end_sign', id_=114, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_60_END = SignTuple(mesh='speed_limit_zone_60_end_sign', id_=115, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_70_END = SignTuple(mesh='speed_limit_zone_70_end_sign', id_=116, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_80_END = SignTuple(mesh='speed_limit_zone_80_end_sign', id_=117, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ZONE_90_END = SignTuple(mesh='speed_limit_zone_90_end_sign', id_=118, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
RAMP_START = SignTuple(mesh='uphill_grade_sign', id_=119, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
RAMP_END = SignTuple(mesh='downhill_grade_sign', id_=120, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
PRIORITY = SignTuple(mesh='priority_sign', id_=121, collision_box_size=(0.015, 0.1, 0.275), collision_box_position=(0, 0, 0.1375))
YIELD = SignTuple(mesh='yield_sign', id_=122, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
STOP = SignTuple(mesh='stop_sign', id_=123, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
ONCOMING_TRAFFIC = SignTuple(mesh='oncoming_traffic_sign', id_=124, collision_box_size=(0.015, 0.1, 0.275), collision_box_position=(0, 0, 0.1375))
NO_OVERTAKING_START = SignTuple(mesh='no_overtaking_start_sign', id_=125, collision_box_size=(0.015, 0.1, 0.275), collision_box_position=(0, 0, 0.1375))
NO_OVERTAKING_END = SignTuple(mesh='no_overtaking_end_sign', id_=126, collision_box_size=(0.015, 0.1, 0.275), collision_box_position=(0, 0, 0.1375))
TURN_RIGHT = SignTuple(mesh='turn_right_sign', id_=127, collision_box_size=(0.015, 0.1, 0.275), collision_box_position=(0, 0, 0.1375))
TURN_LEFT = SignTuple(mesh='turn_left_sign', id_=128, collision_box_size=(0.015, 0.1, 0.275), collision_box_position=(0, 0, 0.1375))
PASS_RIGHT = SignTuple(mesh='pass_right_sign', id_=129, collision_box_size=(0.015, 0.1, 0.125), collision_box_position=(0, 0, 0.0625))
PASS_LEFT = SignTuple(mesh='pass_left_sign', id_=130, collision_box_size=(0.015, 0.1, 0.125), collision_box_position=(0, 0, 0.0625))
SHARP_TURN_RIGHT_SMALL = SignTuple(mesh='sharp_turn_right_small_sign', id_=131, collision_box_size=(0.015, 0.1, 0.125), collision_box_position=(0, 0, 0.0625))
SHARP_TURN_RIGHT = SignTuple(mesh='sharp_turn_right_sign', id_=132, collision_box_size=(0.015, 0.3, 0.125), collision_box_position=(0, 0, 0.0625))
SHARP_TURN_LEFT_SMALL = SignTuple(mesh='sharp_turn_left_small_sign', id_=133, collision_box_size=(0.015, 0.1, 0.125), collision_box_position=(0, 0, 0.0625))
SHARP_TURN_LEFT = SignTuple(mesh='sharp_turn_left_sign', id_=134, collision_box_size=(0.015, 0.3, 0.125), collision_box_position=(0, 0, 0.0625))
ZEBRA_CROSSING = SignTuple(mesh='zebra_crossing_sign', id_=135, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
PARKING = SignTuple(mesh='parking_sign', id_=136, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
EXPRESSWAY_START = SignTuple(mesh='expressway_start_sign', id_=137, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
EXPRESSWAY_END = SignTuple(mesh='expressway_end_sign', id_=138, collision_box_size=(0.015, 0.15, 0.3), collision_box_position=(0, 0, 0.15))
__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

kind: simulation.utils.road.sections.traffic_sign.SignTuple = None
visible: bool = True

Indicate whether the traffic sign is visible while driving on the road.

class SurfaceMarkingPoly(kind: Tuple[int, str] = None, _Transformable__transform: simulation.utils.geometry.transform.Transform = None, normalize_x: bool = True, _frame: simulation.utils.geometry.polygon.Polygon = Polygon([Point(- 0.1, - 0.2, 0.0), Point(0.1, - 0.2, 0.0), Point(0.1, 0.2, 0.0), Point(- 0.1, 0.2, 0.0), Point(- 0.1, - 0.2, 0.0)]))[source]

Bases: simulation.utils.road.sections.road_element.RoadElement, simulation.utils.road.sections.surface_marking.SurfaceMarking

Attributes:

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

class SurfaceMarkingRect(kind: Tuple[int, str], arc_length: float, y: float = - 0.5, depth: float = 0.4, width: float = 0.4, angle=0, normalize_x: bool = True)[source]

Bases: simulation.utils.road.sections.road_element.RoadElementRect, simulation.utils.road.sections.surface_marking.SurfaceMarking

Attributes:

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

class ParkingArea(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 1, start_line: bool = False, start_line_length: float = 0.06, left_lots: List[simulation.utils.road.sections.parking_area.ParkingLot] = <factory>, right_lots: List[simulation.utils.road.sections.parking_area.ParkingLot] = <factory>)[source]

Bases: simulation.utils.road.sections.straight_road.StraightRoad

Part of the road with parking lots and a start line.

Parameters
  • left_lots (List[ParkingLot]) – Parking lots on the left side.

  • right_lots (List[ParkingLot]) – Parking lots on the right side.

  • start_line (bool) – Indicate whether the parking area starts with a start line.

  • start_line_length (float) – Manually set the length of the start line.

Attributes:

TYPE

Type of the road section.

start_line

If the parking area has a start line.

start_line_length

Length of the start line (if one is added.

parking_obstacles

All obstacles on parking spots.

lines

All borderlines with their marking type.

Methods:

set_transform(new_tf)

get_bounding_box()

Get a polygon around the road section.

obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

TYPE = 5

Type of the road section.

start_line: bool = False

If the parking area has a start line.

start_line_length: float = 0.06

Length of the start line (if one is added.

left_lots: List[simulation.utils.road.sections.parking_area.ParkingLot]

Parking lots on the left side.

right_lots: List[simulation.utils.road.sections.parking_area.ParkingLot]

Parking lots on the right side.

set_transform(new_tf: simulation.utils.geometry.transform.Transform)[source]
get_bounding_box()simulation.utils.geometry.polygon.Polygon[source]

Get a polygon around the road section.

Bounding box is an approximate representation of all points within a given distance of this geometric object.

property parking_obstacles: List[simulation.utils.road.sections.obstacle.ParkingObstacle]

All obstacles on parking spots.

Type

List[ParkingObstacle]

property lines: List[simulation.utils.road.sections.road_section.MarkedLine]

All borderlines with their marking type.

Type

List[MarkedLine]

class ParkingLot(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, start: float = 0, spots: List[simulation.utils.road.sections.parking_area.ParkingSpot] = <factory>, _side: str = 'right', opening_angle: float = 1.0471975511965976, depth: Optional[float] = None)[source]

Bases: simulation.utils.road.sections.transformable.Transformable

Outline of a parking lot (right/left side) and all parking spots contained within.

The origin is invariant of the side of the road (left, right). It is always in the left corner of the left most parking spot, with the x-direction pointing away from the road.

Parameters
  • start (float) – Beginning relative to the start of the section.

  • opening_angle (float) – Opening angle of the outside border of the parking lot.

  • depth (float) – Depth of the parking spots within the parking lot.

  • spots (List[ParkingSpot]) – Parking spots within the lot.

Attributes:

RIGHT_SIDE

Possible value of side.

LEFT_SIDE

Possible value of side.

DEFAULT_LEFT_DEPTH

Default value for the depth of parking spots on the left side.

DEFAULT_RIGHT_DEPTH

Default value for the depth of parking spots on the right side.

start

Start of the parking lot along the middle line relative to the parking area.

_side

Side of the road.

opening_angle

Opening angle of parking lot.

depth

Depth of parking spots within this lot.

length

Sum of the widths of all parking spots.

border

Outside border of the parking lot.

obstacles

All obstacles on spots.

lines

All border lines with solid marking type.

Methods:

set_transform(new_tf)

RIGHT_SIDE = 'right'

Possible value of side. Parking lot is on the left side of the road.

LEFT_SIDE = 'left'

Possible value of side. Parking lot is on the right side of the road.

DEFAULT_LEFT_DEPTH = 0.5

Default value for the depth of parking spots on the left side.

DEFAULT_RIGHT_DEPTH = 0.3

Default value for the depth of parking spots on the right side.

start: float = 0

Start of the parking lot along the middle line relative to the parking area.

spots: List[simulation.utils.road.sections.parking_area.ParkingSpot]

Parking spots within this parking lot.

_side: str = 'right'

Side of the road.

opening_angle: float = 1.0471975511965976

Opening angle of parking lot.

__transform: simulation.utils.geometry.transform.Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

depth: float = None

Depth of parking spots within this lot.

If no other value is provided, the default depth of parking lots is 0.5m on the left side and 0.3m on the right side.

set_transform(new_tf: simulation.utils.geometry.transform.Transform)[source]
property length: float

Sum of the widths of all parking spots.

Type

float

property border: simulation.utils.geometry.line.Line

Outside border of the parking lot.

Type

Line

property obstacles: List[simulation.utils.road.sections.obstacle.ParkingObstacle]

All obstacles on spots.

Type

List[ParkingObstacle]

property lines: List[simulation.utils.road.sections.road_section.MarkedLine]

All border lines with solid marking type.

Type

List[MarkedLine]

class ParkingSpot(kind: float = 0, width: float = 0.35, obstacle: Optional[simulation.utils.road.sections.obstacle.ParkingObstacle] = None)[source]

Bases: simulation.utils.road.sections.road_element.RoadElementRect

Parking spot with a type and optionally an obstacle placed on top.

Parameters
  • width – Width of the spot.

  • kind – Type of the spot.

  • obstacle – Obstacle within the spot.

Attributes:

FREE

Possible value of kind.

OCCUPIED

Possible value of kind.

BLOCKED

Possible value of kind.

_side

Side of the road.

kind

Classification of the parking spot.

obstacle

Obstacle within the spot.

x_surface_marking

lines

Borderlines for spot if spot is on the left.

Methods:

set_transform(tf)

Calculate the correct transform to this element.

FREE = 0

Possible value of kind.

OCCUPIED = 1

Possible value of kind.

BLOCKED = 2

Possible value of kind.

_side: str = None

Side of the road.

kind: str = 0

Classification of the parking spot.

obstacle: simulation.utils.road.sections.obstacle.ParkingObstacle = None

Obstacle within the spot.

x_surface_marking: simulation.utils.road.sections.surface_marking.SurfaceMarkingRect = None
set_transform(tf: simulation.utils.geometry.transform.Transform)[source]

Calculate the correct transform to this element.

Depending on self.normalize_x the positional behavior is different. If self.normalize_x is True, the element is aligned along the provided line.

property lines: List[simulation.utils.road.sections.road_section.MarkedLine]

Borderlines for spot if spot is on the left.

Marking type is always solid.

Type

List[MarkedLine]

__transform: simulation.utils.geometry.transform.Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

class StraightRoad(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 1)[source]

Bases: simulation.utils.road.sections.road_section.RoadSection

Straight section of the road.

Parameters

length (float) – Length [m] of the section.

Example

>>> from simulation.utils.road.sections import StraightRoad
>>> from simulation.utils.road.road import Road
>>> road = Road()
>>> straight_road = road.append(StraightRoad(length=2))
>>> road
Road(_name=None, _seed=None, use_seed=True, sections=[StraightRoad(_Transformable__transform=Transform(translation=Vector(0.0, 0.0, 0.0),rotation=Quaternion(1.0, 0.0, 0.0, 0.0)), id=0, is_start=False, left_line_marking='solid', middle_line_marking='dashed', right_line_marking='solid', obstacles=[], traffic_signs=[], surface_markings=[], _speed_limits=[], prev_length=0, length=2)], length=2.0)

Attributes:

TYPE

Type of the road section.

length

Length of the section.

middle_line

Middle line of the road section.

TYPE = 0

Type of the road section.

length: float = 1

Length of the section.

property middle_line

Middle line of the road section.

Type

Line

obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

class ZebraCrossing(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 0.45)[source]

Bases: simulation.utils.road.sections.straight_road.StraightRoad

Road section representing a zebra crossing.

Parameters

length (float) – length of the crossing and thus the section.

Attributes:

TYPE

Type of the road section.

length

Length of the section.

frame

Frame for the zebra crossing surface marking.

TYPE = 6

Type of the road section.

length: float = 0.45

Length of the section.

property frame: simulation.utils.geometry.polygon.Polygon

Frame for the zebra crossing surface marking.

Type

Polygon

obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

class RoadSection(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0)[source]

Bases: simulation.utils.road.sections.transformable.Transformable

Base class of all road sections.

Attributes:

SOLID_LINE_MARKING

Continuous white line.

DASHED_LINE_MARKING

Dashed white line.

MISSING_LINE_MARKING

No line at all.

DOUBLE_SOLID_LINE_MARKING

Double solid line.

DOUBLE_DASHED_LINE_MARKING

Double dashed line.

DASHED_SOLID_LINE_MARKING

Double line, left dashed, right solid

SOLID_DASHED_LINE_MARKING

Double line, left solid, right dashed

id

Road section id (consecutive integers by default).

is_start

Road section is beginning of the road.

left_line_marking

Marking type of the left line.

middle_line_marking

Marking type of the middle line.

right_line_marking

Marking type of the right line.

TYPE

Type of the road section.

prev_length

Length of Road up to this section.

middle_line

Middle line of the road section.

left_line

Left line of the road section.

right_line

Right line of the road section.

lines

All road lines with their marking type.

speed_limits

Speed limits in the road section.

Methods:

set_transform(tf)

get_bounding_box()

Get a polygon around the road section.

get_beginning()

Get the beginning of the section as a pose and the curvature.

get_ending()

Get the ending of the section as a pose and the curvature.

add_speed_limit(arc_length, speed)

Add a speed limit to this road section.

add_obstacle([arc_length, y_offset, angle, …])

Add an obstacle to the road.

fit_ending(current_ending, desired_ending[, …])

Add a cubic bezier curve to adjust the current ending to equal a desired ending.

SOLID_LINE_MARKING = 'solid'

Continuous white line.

DASHED_LINE_MARKING = 'dashed'

Dashed white line.

MISSING_LINE_MARKING = 'missing'

No line at all.

DOUBLE_SOLID_LINE_MARKING = 'double_solid'

Double solid line.

DOUBLE_DASHED_LINE_MARKING = 'double_dashed'

Double dashed line.

DASHED_SOLID_LINE_MARKING = 'dashed_solid'

Double line, left dashed, right solid

SOLID_DASHED_LINE_MARKING = 'solid_dashed'

Double line, left solid, right dashed

id: int = 0

Road section id (consecutive integers by default).

is_start: bool = False

Road section is beginning of the road.

left_line_marking: str = 'solid'

Marking type of the left line.

middle_line_marking: str = 'dashed'

Marking type of the middle line.

right_line_marking: str = 'solid'

Marking type of the right line.

obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle]

Obstacles in the road section.

traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign]

Traffic signs in the road section.

surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit]

Speed limits in the road section.

__transform: simulation.utils.geometry.transform.Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

TYPE = None

Type of the road section.

prev_length: float = 0

Length of Road up to this section.

set_transform(tf)[source]
property middle_line

Middle line of the road section.

Type

Line

property left_line: simulation.utils.geometry.line.Line

Left line of the road section.

Type

Line

property right_line: simulation.utils.geometry.line.Line

Right line of the road section.

Type

Line

property lines: List[simulation.utils.road.sections.road_section.MarkedLine]

All road lines with their marking type.

Type

List[MarkedLine]

property speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit]

Speed limits in the road section.

get_bounding_box()simulation.utils.geometry.polygon.Polygon[source]

Get a polygon around the road section.

Bounding box is an approximate representation of all points within a given distance of this geometric object.

get_beginning()Tuple[simulation.utils.geometry.pose.Pose, float][source]

Get the beginning of the section as a pose and the curvature.

Returns

A tuple consisting of the first point on the middle line together with the direction facing away from the road section as a pose and the curvature at the beginning of the middle line.

get_ending()Tuple[simulation.utils.geometry.pose.Pose, float][source]

Get the ending of the section as a pose and the curvature.

Returns

A tuple consisting of the last point on the middle line together with the direction facing along the middle line as a pose and the curvature at the ending of the middle line.

add_speed_limit(arc_length: float, speed: int)[source]

Add a speed limit to this road section.

Parameters
  • arc_length – Direction along the road to the speed limit.

  • speed – Speed limit. Negative values correspond to the end of a speed limit zone.

add_obstacle(arc_length: float = 0.2, y_offset: float = - 0.2, angle: float = 0, width: float = 0.2, length: float = 0.3, height: float = 0.25)[source]

Add an obstacle to the road.

Args: arc_length: Direction along the road to the obstacle. y_offset: Offset orthogonal to the middle line. angle: Orientation offset of the obstacle. width: Width of the obstacle. length: Length of the obstacle. height: Heigth of the obstacle.

classmethod fit_ending(current_ending: simulation.utils.geometry.pose.Pose, desired_ending: simulation.utils.geometry.pose.Pose, control_point_distance=0.4)simulation.utils.road.sections.road_section.RoadSection[source]

Add a cubic bezier curve to adjust the current ending to equal a desired ending.

Parameters
  • current_ending – Current ending of the last section.

  • desired_ending – Ending that the last section should have.

  • control_point_distance – Distance to the bezier curve’s control points.

class BlockedArea(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 1, width: float = 0.2, _opening_angle: float = 1.0471975511965976)[source]

Bases: simulation.utils.road.sections.straight_road.StraightRoad

Road section representing a blocked area.

Parameters

width (float) – width of the blocked area, starting from the right line.

Attributes:

TYPE

Type of the road section.

width

_opening_angle

frame

Frame of the blocked area surface marking.

_poly

TYPE = 8

Type of the road section.

width: float = 0.2
_opening_angle: float = 1.0471975511965976
property frame: simulation.utils.geometry.polygon.Polygon

Frame of the blocked area surface marking.

It has the shape of a symmetrical trapezoid.

Type

Polygon

property _poly: simulation.utils.geometry.polygon.Polygon
obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

class TrafficIsland(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, island_width: float = 0.3, zebra_length: float = 0.45, curve_area_length: float = 0.8, curvature: float = 0.4, zebra_marking_type: int = 1, _sign_distance: float = 0.3)[source]

Bases: simulation.utils.road.sections.road_section.RoadSection

Road section representing an traffic island.

Parameters
  • island_width (float) – width of the island in the middle

  • zebra_length (float) – length of zebra section on the island

  • curve_area_length (float) – length of curve area section

  • curvature (float) – amount of curvature ranging from 0 to 1

  • zebra_marking_type (int) – marking on the middle of the island

Attributes:

TYPE

Type of the road section.

LINES

Possible value for zebra_marking_type.

ZEBRA

Possible value for zebra_marking_type.

island_width

Width of island in the middle.

zebra_length

Length of the zebra crossing area.

curve_area_length

Length of the bezier curve area at start and end of island.

curvature

Define where along the curve area the control points are located.

zebra_marking_type

Type of zebra marking type.

_sign_distance

Distance of the directions signs from the mid island part.

length

Length of the entire section.

middle_start

middle_r_zebra_start

middle_r_zebra_end

middle_end

right_zebra_start

right_zebra_end

left_zebra_start

left_zebra_end

middle_l_zebra_start

middle_l_zebra_end

bezier_points_mid_r_start

bezier_points_mid_r_end

bezier_points_mid_l_start

bezier_points_mid_l_end

middle_line_r

Middle line on the right side of the traffic island.

middle_line_l

Middle line on the left side of the traffic island.

middle_line

Middle line of the road section.

right_line

Right line of the road section.

left_line

Left line of the road section.

lines

All road lines with their marking type.

TYPE = 9

Type of the road section.

LINES = 0

Possible value for zebra_marking_type. Show lines on the island.

ZEBRA = 1

Possible value for zebra_marking_type. Show zebra crossing on the island.

island_width: float = 0.3

Width of island in the middle.

zebra_length: float = 0.45

Length of the zebra crossing area.

curve_area_length: float = 0.8

Length of the bezier curve area at start and end of island.

curvature: float = 0.4

Define where along the curve area the control points are located.

zebra_marking_type: int = 1

Type of zebra marking type. Can be LINES or ZEBRA.

_sign_distance: float = 0.3

Distance of the directions signs from the mid island part.

property length: float

Length of the entire section.

property middle_start: simulation.utils.geometry.vector.Vector
property middle_r_zebra_start: simulation.utils.geometry.vector.Vector
property middle_r_zebra_end: simulation.utils.geometry.vector.Vector
property middle_end: simulation.utils.geometry.vector.Vector
property right_zebra_start: simulation.utils.geometry.vector.Vector
property right_zebra_end: simulation.utils.geometry.vector.Vector
property left_zebra_start: simulation.utils.geometry.vector.Vector
property left_zebra_end: simulation.utils.geometry.vector.Vector
property middle_l_zebra_start: simulation.utils.geometry.vector.Vector
property middle_l_zebra_end: simulation.utils.geometry.vector.Vector
property bezier_points_mid_r_start: List[simulation.utils.geometry.point.Point]
property bezier_points_mid_r_end: List[simulation.utils.geometry.point.Point]
property bezier_points_mid_l_start: List[simulation.utils.geometry.point.Point]
obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().

property bezier_points_mid_l_end: List[simulation.utils.geometry.point.Point]
property middle_line_r: simulation.utils.geometry.line.Line

Middle line on the right side of the traffic island.

Type

Line

property middle_line_l: simulation.utils.geometry.line.Line

Middle line on the left side of the traffic island.

Type

Line

property middle_line

Middle line of the road section. Here it is the left middle line.

Type

Line

property right_line: simulation.utils.geometry.line.Line

Right line of the road section.

Type

Line

property left_line: simulation.utils.geometry.line.Line

Left line of the road section.

Type

Line

property lines: List[simulation.utils.road.sections.road_section.MarkedLine]

All road lines with their marking type.

Type

List[MarkedLine]

class SpeedLimit(x_position: float, limit: int)[source]

Bases: object

Attributes:

traffic_sign

The traffic sign for this speed limit.

surface_marking

The surface marking for this speed limit.

x_position: float

The position on the road

limit: int

The speed limit

property traffic_sign: simulation.utils.road.sections.traffic_sign.TrafficSign

The traffic sign for this speed limit.

Type

TrafficSign

property surface_marking: simulation.utils.road.sections.surface_marking.SurfaceMarkingRect

The surface marking for this speed limit.

Type

SurfaceMarking

class CustomSection(_Transformable__transform: simulation.utils.geometry.transform.Transform = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, middle_line_points: List[<built-in function array>] = <factory>)[source]

Bases: simulation.utils.road.sections.road_section.RoadSection, simulation.utils.basics.init_options.InitOptions, simulation.utils.basics.save_options.SaveOptions

Attributes:

TYPE

Type of the road section.

middle_line

Middle line of the road section.

Methods:

save_as_yaml(file_path)

Save the section as a yaml file.

from_yaml(file_path)

Load from a yaml file.

split_by(sections[, x_buffer])

Add a number of other sections along this section.

TYPE = 10

Type of the road section.

middle_line_points: List[numpy.array]

Points that make up the middle line.

property middle_line: simulation.utils.geometry.line.Line

Middle line of the road section.

Type

Line

save_as_yaml(file_path: str)[source]

Save the section as a yaml file.

classmethod from_yaml(file_path: str)[source]

Load from a yaml file.

split_by(sections: List[Tuple[int, simulation.utils.road.sections.road_section.RoadSection]], x_buffer=1)List[simulation.utils.road.sections.road_section.RoadSection][source]

Add a number of other sections along this section.

Parameters
  • sections – Road sections and arc lengths at which they should be added.

  • x_buffer – Buffer after a road section to improve the adjustment of the end pose.

Returns

New road sections that replace this section.

obstacles: List[StaticObstacle]

Obstacles in the road section.

traffic_signs: List[TrafficSign]

Traffic signs in the road section.

surface_markings: List[SurfaceMarking]

Surface markings in the road section.

_speed_limits: List[SpeedLimit]

Speed limits in the road section.

__transform: Transform

Transform to origin of the object.

The name of the transform starts with __ to prevent subclasses from changing it’s values without running set_transform().