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: Point | Sequence[float]) 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: kitcar_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: RoadSection

Attributes:

p1

Control point 1.

p2

Control point 2.

p1: Point | Sequence[float] = None

Control point 1.

p2: 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: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.List[~simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, p1: ~kitcar_utils.geometry.point.Point | ~typing.Sequence[float] | None = None, p2: ~kitcar_utils.geometry.point.Point | ~typing.Sequence[float] | None = None)[source]

Bases: 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.

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.

__transform

Transform to origin of the object.

TYPE = 3

Type of the road section.

property middle_line: 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: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.List[~simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, p1: ~kitcar_utils.geometry.point.Point | ~typing.Sequence[float] | None = None, p2: ~kitcar_utils.geometry.point.Point | ~typing.Sequence[float] | None = None, p3: ~kitcar_utils.geometry.point.Point | ~typing.Sequence[float] | None = None)[source]

Bases: 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: 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: 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: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.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: 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: Polygon

Frame of the blocked area surface marking.

It has the shape of a symmetrical trapezoid.

Type:

Polygon

property _poly: 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: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.List[~simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, radius: float | None = None, angle: float | None = None)[source]

Bases: 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: Line

Middle line of the road section.

Type:

Line

get_ending() Tuple[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: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.List[~simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, radius: float | None = None, angle: float | None = None)[source]

Bases: 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.

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.

__transform

Transform to origin of the object.

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: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.List[~simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, radius: float | None = None, angle: float | None = None)[source]

Bases: CircularArc

Part of a circle with a negative curvature.

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

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

Attributes:

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.

__transform

Transform to origin of the object.

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: kitcar_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: RoadSection, InitOptions, 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[array]

Points that make up the middle line.

property middle_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, RoadSection]], x_buffer=1) List[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)

NumPy arange, but include end point.

Classes:

Intersection(_Transformable__transform, id, ...)

Road section representing an intersection.

_get_stop_line(line1: Line, line2: Line, kind) 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) ndarray[source]

NumPy arange, but include end point.

Parameters:
  • start – Start of interval

  • end – End of interval

  • step – Spacing between values

Returns:

Array of evenly spaced values

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

Bases: RoadSection

Road section representing an intersection.

Parameters:
  • angle – Angle [radian] between crossing roads.

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

  • turn – Turning direction.

  • rule – Priority-rule at intersection.

  • size – Length of the crossing roads.

  • exit_direction – Optionally overwrite the visible turning direction.

  • invisible – Used to close loops at intersection.

Intersection internal structure:

Intersection internal structure

Attributes:

TYPE

Type of the road section.

ORIGIN

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.

invisible

Enables invisible intersection to close loops at an intersection.

sin

cos

y

x

z

u

v

w

lo

li

ro

ri

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

closing_line_east

closing_line_west

closing_line_north

left_inner_circle

Inner left turn circle.

left_outer_circle

Outer left turn circle.

right_inner_circle

Inner right turn circle.

right_outer_circle

Outer right turn circle.

middle_line

Middle line of the intersection.

lines

All road lines with their marking type.

Methods:

cp_sign_south(sign_dist)

Sign Center Point South.

cp_surface_south()

Surface Marking Center Point South.

cp_sign_west(sign_dist)

Sign Center Point West.

cp_surface_west()

Surface Marking Center Point West.

cp_sign_north(sign_dist)

Sign Center Point North.

cp_sign_east(sign_dist)

Sign Center Point East.

cp_surface_east()

Surface Marking Center Point East.

get_beginning()

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

get_ending([turn_direction])

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

get_bounding_box()

Get a polygon around the intersection.

_get_intersection_traffic_signs()

Get a list of all traffic signs.

_get_intersection_surface_markings()

Get a list of all surface markings.

add_dynamic_obstacle(start, end[, y_offset])

Add an obstacle to the road.

TYPE = 7

Type of the road section.

ORIGIN = -1
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: int | None = 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.

invisible: bool = False

Enables invisible intersection to close loops at an intersection.

property sin
property cos
property y
property x
property z
property u
property v
property w
property lo
property li
property ro
property ri
cp_sign_south(sign_dist: float) Vector[source]

Sign Center Point South.

Parameters:

sign_dist – distance from end of right line

Returns:

Center point

cp_surface_south() Vector[source]

Surface Marking Center Point South.

Returns:

Center point

cp_sign_west(sign_dist: float) Vector[source]

Sign Center Point West.

Parameters:

sign_dist – distance from end of right line

Returns:

Center point

cp_surface_west() Vector[source]

Surface Marking Center Point West.

Returns:

Center point

cp_sign_north(sign_dist: float) Vector[source]

Sign Center Point North.

Parameters:

sign_dist – distance from end of right line

Returns:

Center point

cp_sign_east(sign_dist: float) Vector[source]

Sign Center Point East.

Parameters:

sign_dist – distance from end of right line

Returns:

Center point

cp_surface_east() Vector[source]

Surface Marking Center Point East.

Returns:

Center point

property middle_line_south: Line
property left_line_south: Line
property right_line_south: Line
property middle_line_east: Line
property left_line_east: Line
property right_line_east: Line
property middle_line_north: Line
property left_line_north: Line
property right_line_north: Line
property middle_line_west: Line
property left_line_west: Line
property right_line_west: Line
property closing_line_east: 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 closing_line_west: Line
property closing_line_north: Line
property left_inner_circle: Line

Inner left turn circle.

Circle provides guidance during turn Circle starts at end point of south middle line Circle ends at start of west middle line

Returns:

Circle

property left_outer_circle: Line

Outer left turn circle.

Circle provides guidance during turn Circle starts at end point of south right line Circle ends at start of west right line

Returns:

Circle

property right_inner_circle: Line

Inner right turn circle.

Circle provides guidance during turn Circle starts at end point of south middle line Circle ends at start of east middle line

Returns:

Circle

property right_outer_circle: Line

Outer right turn circle.

Circle provides guidance during turn Circle starts at end point of south left line Circle ends at start of east left line

Returns:

Circle

property middle_line: Line

Middle line of the intersection.

property lines: List[MarkedLine]

All road lines with their marking type.

get_beginning() Tuple[Pose, float][source]

Get the beginning of the intersection 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(turn_direction: int | None = None) Tuple[Pose, float][source]

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

Parameters:

turn_direction – Get ending for given direction.

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() Polygon[source]

Get a polygon around the intersection.

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

Returns:

Bounding box

_get_intersection_traffic_signs() List[TrafficSign][source]

Get a list of all traffic signs.

Returns:

All traffic signs

_get_intersection_surface_markings() List[SurfaceMarkingRect][source]

Get a list of all surface markings.

Returns:

All surface markings

add_dynamic_obstacle(start: int, end: int, y_offset: float = 0.2, **kwargs)[source]

Add an obstacle to the road.

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, ...])

Obstacle that can be placed on the road.

ParkingObstacle([x, y, width, depth, ...])

Obstacle that can be placed on a parking spot.

DynamicObstacle(path_points[, width, depth, ...])

DynamicObstacle that can be placed on all road sections.

Pedestrian([arc_length, y])

Pedestrian to use at zebra crossing.

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: 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: 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

__transform

Transform to origin of the object.

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 DynamicObstacle(path_points: ~typing.List[~kitcar_utils.geometry.point.Point] = Field(name=None, type=None, default=<dataclasses._MISSING_TYPE object>, default_factory=<class 'list'>, init=True, repr=True, hash=None, compare=True, metadata=mappingproxy({}), _field_type=None), width=0.1, depth=0.1, height=0.15, speed=0.6, triggered_at_time=-1, waiting_time_after_trigger=0, trigger_distance=2, reset_trigger_distance=5, align_middle_line: bool = True, align_line: ~kitcar_utils.geometry.line.Line | None = None)[source]

Bases: StaticObstacle

DynamicObstacle that can be placed on all road sections.

Attributes:

id_

width

Width of the obstacle.

depth

Width of the obstacle.

current_pose

The current pose of the obstacle.

speed

Speed of the obstacle.

trigger_distance

Distance to car along the road at which the obstacle should be triggered.

reset_trigger_distance

Distance to car along the road at which resets the obstacle.

triggered_at_time

Defines the time at which the obstacle is triggered.

waiting_time_after_trigger

Wait for this amount of seconds after first trigger.

height

Height of the obstacle.

Methods:

get_pose(time)

Get pose of obstacle at provided time.

setup(road, road_section)

_align_line(line[, x_offset])

Align the dynamic obstacle relative to a given line.

set_transform(obj)

Calculate the correct transform to this element.

id_ = 3
width: float = 0.1

Width of the obstacle.

depth: float = 0.1

Width of the obstacle.

current_pose: Pose | None = None

The current pose of the obstacle.

Updated via the obstacle controller node

speed: float = 0.6

Speed of the obstacle.

trigger_distance: float = 2

Distance to car along the road at which the obstacle should be triggered.

reset_trigger_distance: float = 5

Distance to car along the road at which resets the obstacle.

triggered_at_time: float = -1

Defines the time at which the obstacle is triggered.

waiting_time_after_trigger: float = 0

Wait for this amount of seconds after first trigger.

height: float = 0.15

Height of the obstacle.

get_pose(time: float)[source]

Get pose of obstacle at provided time.

setup(road, road_section)[source]
__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().

_align_line(line, x_offset: int = 0)[source]

Align the dynamic obstacle relative to a given line.

set_transform(obj: Line | 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.

class Pedestrian(arc_length: float = 0.225, y: float = -0.5)[source]

Bases: DynamicObstacle

Pedestrian to use at zebra crossing.

Attributes:

id_

width

Width of the pedestrian.

depth

Width of the pedestrian.

height

Height of the pedestrian.

speed

Speed of the obstacle.

triggered_at_time

Defines the time at which the pedestrian is triggered.

waiting_time_after_trigger

Wait for this amount of seconds after first trigger.

trigger_distance

Distance to car along the road at which the pedestrian should start walking.

reset_trigger_distance

Distance to car along the road at which resets the pedestrian.

__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().

id_ = 4
width: float = 0.1

Width of the pedestrian.

depth: float = 0.1

Width of the pedestrian.

height: float = 0.15

Height of the pedestrian.

speed: float = 0.3

Speed of the obstacle.

triggered_at_time: float = -1

Defines the time at which the pedestrian is triggered.

waiting_time_after_trigger: float = 1

Wait for this amount of seconds after first trigger.

trigger_distance: float = 2

Distance to car along the road at which the pedestrian should start walking.

reset_trigger_distance: float = 9

Distance to car along the road at which resets the pedestrian.

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: ParkingObstacle | None = None)[source]

Bases: 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: ParkingObstacle = None

Obstacle within the spot.

x_surface_marking: SurfaceMarkingRect = None
set_transform(tf: 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[MarkedLine]

Borderlines for spot if spot is on the left.

Marking type is always solid.

Type:

List[MarkedLine]

__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: ~kitcar_utils.geometry.transform.Transform | None = None, start: float = 0, spots: ~typing.List[~simulation.utils.road.sections.parking_area.ParkingSpot] = <factory>, _side: str = 'right', opening_angle: float = 1.0471975511965976, depth: float | None = None)[source]

Bases: 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[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: 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: Transform)[source]
property length: float

Sum of the widths of all parking spots.

Type:

float

property border: Line

Outside border of the parking lot.

Type:

Line

property obstacles: List[ParkingObstacle]

All obstacles on spots.

Type:

List[ParkingObstacle]

property lines: List[MarkedLine]

All border lines with solid marking type.

Type:

List[MarkedLine]

class ParkingArea(_Transformable__transform: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.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: ~typing.List[~simulation.utils.road.sections.parking_area.ParkingLot] = <factory>, right_lots: ~typing.List[~simulation.utils.road.sections.parking_area.ParkingLot] = <factory>)[source]

Bases: 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[ParkingLot]

Parking lots on the left side.

right_lots: List[ParkingLot]

Parking lots on the right side.

set_transform(new_tf: Transform)[source]
get_bounding_box() 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[ParkingObstacle]

All obstacles on parking spots.

Type:

List[ParkingObstacle]

property lines: List[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, ...])

Generic element of the road that has a frame.

class RoadElement(_Transformable__transform: kitcar_utils.geometry.transform.Transform = None, normalize_x: bool = True, _frame: kitcar_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: 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: 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: Line | 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: Polygon

Frame of the element in global coordinates.

Type:

Polygon

property center: Point

Center point of the element in global coordinates.

Type:

Point

property _center: Point

Center point of the element in local coordinates.

Type:

Point

__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: 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: 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: Line

Line with a defined line marking style.

Methods:

from_line(line, style[, prev_length])

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

Bases: 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.

add_dynamic_obstacle(*path[, width, length, ...])

Add an obstacle to the road.

setup_dynamic_obstacles(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[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.

TYPE = None

Type of 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().

prev_length: float = 0

Length of Road up to this section.

set_transform(tf)[source]
property middle_line: Line

Middle line of the road section.

Type:

Line

property left_line: Line

Left line of the road section.

Type:

Line

property right_line: Line

Right line of the road section.

Type:

Line

property lines: List[MarkedLine]

All road lines with their marking type.

Type:

List[MarkedLine]

property speed_limits: List[SpeedLimit]

Speed limits in the road section.

get_bounding_box() 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[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[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.

add_dynamic_obstacle(*path: List[Point], width: float = 0.2, length: float = 0.3, height: float = 0.25, speed: float = 0.6, align_middle_line: bool = True, align_line: Line | None = None, trigger_distance: float = 2, waiting_time_after_trigger: float = 0, reset_trigger_distance: float = 2)[source]

Add an obstacle to the road.

setup_dynamic_obstacles(road)[source]
classmethod fit_ending(current_ending: Pose, desired_ending: Pose, control_point_distance=0.4) 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: TrafficSign

The traffic sign for this speed limit.

Type:

TrafficSign

property surface_marking: SurfaceMarkingRect

The surface marking for this speed limit.

Type:

SurfaceMarking

simulation.utils.road.sections.start_box module

StartBox.

Exceptions:

StartBoxError

Classes:

StartBox(_Transformable__transform, id, ...)

Road section representing the start box.

exception StartBoxError[source]

Bases: Exception

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

Bases: RoadSection

Road section representing the start box.

Todo

  • Change TYPE?

Attributes:

TYPE

Type of the road section.

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.

middle_line

Middle line of the road section.

left_line

Left line of the road section.

right_line

Right line of the road section.

frame

Frame of the blocked area surface marking.

Methods:

setup(road_origin, left_line, right_line)

get_intersection(road_origin, left_line, ...)

TYPE = 10

Type of the road section.

left_line_marking: str = 'missing'

Marking type of the left line.

middle_line_marking: str = 'solid'

Marking type of the middle line.

right_line_marking: str = 'solid'

Marking type of the right line.

setup(road_origin: Pose, left_line: Line, right_line: Line)[source]
property middle_line: Line

Middle line of the road section.

Type:

Line

property left_line: Line

Left line of the road section.

Type:

Line

property right_line: Line

Right 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().

property frame: Polygon

Frame of the blocked area surface marking.

It has the shape of a symmetrical trapezoid.

Type:

Polygon

get_intersection(road_origin: Pose, left_line: Line, right_line: Line) str | None[source]

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: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.List[~simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 1)[source]

Bases: 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, start_box=False)

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: 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])

SurfaceMarkingPoly([kind, ...])

SurfaceMarkingRect(kind, arc_length[, y, ...])

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

Bases: object

Attributes:

START_BOX

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

Kind of the surface marking.

class SurfaceMarkingPoly(kind: Tuple[int, str] = None, _Transformable__transform: kitcar_utils.geometry.transform.Transform = None, normalize_x: bool = True, _frame: kitcar_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: RoadElement, SurfaceMarking

Attributes:

__transform

Transform to origin of the object.

__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: RoadElementRect, SurfaceMarking

Attributes:

__transform

Transform to origin of the object.

__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: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.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: 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: Vector
property middle_r_zebra_start: Vector
property middle_r_zebra_end: Vector
property middle_end: Vector
property right_zebra_start: Vector
property right_zebra_end: Vector
property left_zebra_start: Vector
property left_zebra_end: Vector
property middle_l_zebra_start: Vector
property middle_l_zebra_end: Vector
property bezier_points_mid_r_start: List[Point]
property bezier_points_mid_r_end: List[Point]
property bezier_points_mid_l_start: List[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[Point]
property middle_line_r: Line

Middle line on the right side of the traffic island.

Type:

Line

property middle_line_l: Line

Middle line on the left side of the traffic island.

Type:

Line

property middle_line: Line

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

Type:

Line

property right_line: Line

Right line of the road section.

Type:

Line

property left_line: Line

Left line of the road section.

Type:

Line

property lines: List[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:

mesh

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: 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: 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: Transform | None = 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: 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: 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: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.List[~simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 0.45)[source]

Bases: 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: 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, ...])

Obstacle that can be placed on the road.

ParkingObstacle([x, y, width, depth, ...])

Obstacle that can be placed on a parking spot.

DynamicObstacle(path_points[, width, depth, ...])

DynamicObstacle that can be placed on all road sections.

Pedestrian([arc_length, y])

Pedestrian to use at zebra crossing.

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

SurfaceMarkingPoly([kind, ...])

SurfaceMarkingRect(kind, arc_length[, y, ...])

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, ...)

StartBox(_Transformable__transform, id, ...)

Road section representing the start box.

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

Bases: 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.

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.

__transform

Transform to origin of the object.

TYPE = 3

Type of the road section.

property middle_line: 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: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.List[~simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, p1: ~kitcar_utils.geometry.point.Point | ~typing.Sequence[float] | None = None, p2: ~kitcar_utils.geometry.point.Point | ~typing.Sequence[float] | None = None, p3: ~kitcar_utils.geometry.point.Point | ~typing.Sequence[float] | None = None)[source]

Bases: 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.

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.

__transform

Transform to origin of the object.

middle_line

Middle line of the road section.

TYPE = 4

Type of the road section.

p3: 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: Line

Middle line of the road section.

Type:

Line

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

Bases: 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.

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.

__transform

Transform to origin of the object.

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: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.List[~simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, radius: float | None = None, angle: float | None = None)[source]

Bases: CircularArc

Part of a circle with a negative curvature.

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

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

Attributes:

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.

__transform

Transform to origin of the object.

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: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.List[~simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, angle: float = 1.5707963267948966, closing: int | None = None, turn: int = 0, rule: int = 0, size: float = 1.8, exit_direction: int | None = None, invisible: bool = False)[source]

Bases: RoadSection

Road section representing an intersection.

Parameters:
  • angle – Angle [radian] between crossing roads.

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

  • turn – Turning direction.

  • rule – Priority-rule at intersection.

  • size – Length of the crossing roads.

  • exit_direction – Optionally overwrite the visible turning direction.

  • invisible – Used to close loops at intersection.

Intersection internal structure:

Intersection internal structure

Attributes:

TYPE

Type of the road section.

ORIGIN

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.

invisible

Enables invisible intersection to close loops at an intersection.

sin

cos

y

x

z

u

v

w

lo

li

ro

ri

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

closing_line_east

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.

__transform

Transform to origin of the object.

closing_line_west

closing_line_north

left_inner_circle

Inner left turn circle.

left_outer_circle

Outer left turn circle.

right_inner_circle

Inner right turn circle.

right_outer_circle

Outer right turn circle.

middle_line

Middle line of the intersection.

lines

All road lines with their marking type.

Methods:

cp_sign_south(sign_dist)

Sign Center Point South.

cp_surface_south()

Surface Marking Center Point South.

cp_sign_west(sign_dist)

Sign Center Point West.

cp_surface_west()

Surface Marking Center Point West.

cp_sign_north(sign_dist)

Sign Center Point North.

cp_sign_east(sign_dist)

Sign Center Point East.

cp_surface_east()

Surface Marking Center Point East.

get_beginning()

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

get_ending([turn_direction])

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

get_bounding_box()

Get a polygon around the intersection.

_get_intersection_traffic_signs()

Get a list of all traffic signs.

_get_intersection_surface_markings()

Get a list of all surface markings.

add_dynamic_obstacle(start, end[, y_offset])

Add an obstacle to the road.

TYPE = 7

Type of the road section.

ORIGIN = -1
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: int | None = 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.

invisible: bool = False

Enables invisible intersection to close loops at an intersection.

property sin
property cos
property y
property x
property z
property u
property v
property w
property lo
property li
property ro
property ri
cp_sign_south(sign_dist: float) Vector[source]

Sign Center Point South.

Parameters:

sign_dist – distance from end of right line

Returns:

Center point

cp_surface_south() Vector[source]

Surface Marking Center Point South.

Returns:

Center point

cp_sign_west(sign_dist: float) Vector[source]

Sign Center Point West.

Parameters:

sign_dist – distance from end of right line

Returns:

Center point

cp_surface_west() Vector[source]

Surface Marking Center Point West.

Returns:

Center point

cp_sign_north(sign_dist: float) Vector[source]

Sign Center Point North.

Parameters:

sign_dist – distance from end of right line

Returns:

Center point

cp_sign_east(sign_dist: float) Vector[source]

Sign Center Point East.

Parameters:

sign_dist – distance from end of right line

Returns:

Center point

cp_surface_east() Vector[source]

Surface Marking Center Point East.

Returns:

Center point

property middle_line_south: Line
property left_line_south: Line
property right_line_south: Line
property middle_line_east: Line
property left_line_east: Line
property right_line_east: Line
property middle_line_north: Line
property left_line_north: Line
property right_line_north: Line
property middle_line_west: Line
property left_line_west: Line
property right_line_west: Line
property closing_line_east: 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 closing_line_west: Line
property closing_line_north: Line
property left_inner_circle: Line

Inner left turn circle.

Circle provides guidance during turn Circle starts at end point of south middle line Circle ends at start of west middle line

Returns:

Circle

property left_outer_circle: Line

Outer left turn circle.

Circle provides guidance during turn Circle starts at end point of south right line Circle ends at start of west right line

Returns:

Circle

property right_inner_circle: Line

Inner right turn circle.

Circle provides guidance during turn Circle starts at end point of south middle line Circle ends at start of east middle line

Returns:

Circle

property right_outer_circle: Line

Outer right turn circle.

Circle provides guidance during turn Circle starts at end point of south left line Circle ends at start of east left line

Returns:

Circle

property middle_line: Line

Middle line of the intersection.

property lines: List[MarkedLine]

All road lines with their marking type.

get_beginning() Tuple[Pose, float][source]

Get the beginning of the intersection 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(turn_direction: int | None = None) Tuple[Pose, float][source]

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

Parameters:

turn_direction – Get ending for given direction.

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() Polygon[source]

Get a polygon around the intersection.

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

Returns:

Bounding box

_get_intersection_traffic_signs() List[TrafficSign][source]

Get a list of all traffic signs.

Returns:

All traffic signs

_get_intersection_surface_markings() List[SurfaceMarkingRect][source]

Get a list of all surface markings.

Returns:

All surface markings

add_dynamic_obstacle(start: int, end: int, y_offset: float = 0.2, **kwargs)[source]

Add an obstacle to the road.

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: 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

__transform

Transform to origin of the object.

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: 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

__transform

Transform to origin of the object.

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 DynamicObstacle(path_points: ~typing.List[~kitcar_utils.geometry.point.Point] = Field(name=None, type=None, default=<dataclasses._MISSING_TYPE object>, default_factory=<class 'list'>, init=True, repr=True, hash=None, compare=True, metadata=mappingproxy({}), _field_type=None), width=0.1, depth=0.1, height=0.15, speed=0.6, triggered_at_time=-1, waiting_time_after_trigger=0, trigger_distance=2, reset_trigger_distance=5, align_middle_line: bool = True, align_line: ~kitcar_utils.geometry.line.Line | None = None)[source]

Bases: StaticObstacle

DynamicObstacle that can be placed on all road sections.

Attributes:

id_

width

Width of the obstacle.

depth

Width of the obstacle.

current_pose

The current pose of the obstacle.

speed

Speed of the obstacle.

trigger_distance

Distance to car along the road at which the obstacle should be triggered.

reset_trigger_distance

Distance to car along the road at which resets the obstacle.

triggered_at_time

Defines the time at which the obstacle is triggered.

waiting_time_after_trigger

Wait for this amount of seconds after first trigger.

height

Height of the obstacle.

__transform

Transform to origin of the object.

Methods:

get_pose(time)

Get pose of obstacle at provided time.

setup(road, road_section)

_align_line(line[, x_offset])

Align the dynamic obstacle relative to a given line.

set_transform(obj)

Calculate the correct transform to this element.

id_ = 3
width: float = 0.1

Width of the obstacle.

depth: float = 0.1

Width of the obstacle.

current_pose: Pose | None = None

The current pose of the obstacle.

Updated via the obstacle controller node

speed: float = 0.6

Speed of the obstacle.

trigger_distance: float = 2

Distance to car along the road at which the obstacle should be triggered.

reset_trigger_distance: float = 5

Distance to car along the road at which resets the obstacle.

triggered_at_time: float = -1

Defines the time at which the obstacle is triggered.

waiting_time_after_trigger: float = 0

Wait for this amount of seconds after first trigger.

height: float = 0.15

Height of the obstacle.

get_pose(time: float)[source]

Get pose of obstacle at provided time.

setup(road, road_section)[source]
__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().

_align_line(line, x_offset: int = 0)[source]

Align the dynamic obstacle relative to a given line.

set_transform(obj: Line | 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.

class Pedestrian(arc_length: float = 0.225, y: float = -0.5)[source]

Bases: DynamicObstacle

Pedestrian to use at zebra crossing.

Attributes:

__transform

Transform to origin of the object.

id_

width

Width of the pedestrian.

depth

Width of the pedestrian.

height

Height of the pedestrian.

speed

Speed of the obstacle.

triggered_at_time

Defines the time at which the pedestrian is triggered.

waiting_time_after_trigger

Wait for this amount of seconds after first trigger.

trigger_distance

Distance to car along the road at which the pedestrian should start walking.

reset_trigger_distance

Distance to car along the road at which resets the pedestrian.

__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().

id_ = 4
width: float = 0.1

Width of the pedestrian.

depth: float = 0.1

Width of the pedestrian.

height: float = 0.15

Height of the pedestrian.

speed: float = 0.3

Speed of the obstacle.

triggered_at_time: float = -1

Defines the time at which the pedestrian is triggered.

waiting_time_after_trigger: float = 1

Wait for this amount of seconds after first trigger.

trigger_distance: float = 2

Distance to car along the road at which the pedestrian should start walking.

reset_trigger_distance: float = 9

Distance to car along the road at which resets the pedestrian.

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: 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

__transform

Transform to origin of the object.

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: 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: kitcar_utils.geometry.transform.Transform = None, normalize_x: bool = True, _frame: kitcar_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: RoadElement, SurfaceMarking

Attributes:

__transform

Transform to origin of the object.

__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: RoadElementRect, SurfaceMarking

Attributes:

__transform

Transform to origin of the object.

__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: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.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: ~typing.List[~simulation.utils.road.sections.parking_area.ParkingLot] = <factory>, right_lots: ~typing.List[~simulation.utils.road.sections.parking_area.ParkingLot] = <factory>)[source]

Bases: 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:

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.

__transform

Transform to origin of the object.

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[ParkingLot]

Parking lots on the left side.

right_lots: List[ParkingLot]

Parking lots on the right side.

set_transform(new_tf: Transform)[source]
get_bounding_box() 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[ParkingObstacle]

All obstacles on parking spots.

Type:

List[ParkingObstacle]

property lines: List[MarkedLine]

All borderlines with their marking type.

Type:

List[MarkedLine]

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

Bases: 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.

__transform

Transform to origin of the object.

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[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: 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: Transform)[source]
property length: float

Sum of the widths of all parking spots.

Type:

float

property border: Line

Outside border of the parking lot.

Type:

Line

property obstacles: List[ParkingObstacle]

All obstacles on spots.

Type:

List[ParkingObstacle]

property lines: List[MarkedLine]

All border lines with solid marking type.

Type:

List[MarkedLine]

class ParkingSpot(kind: float = 0, width: float = 0.35, obstacle: ParkingObstacle | None = None)[source]

Bases: 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.

__transform

Transform to origin of the object.

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: ParkingObstacle = None

Obstacle within the spot.

x_surface_marking: SurfaceMarkingRect = None
set_transform(tf: 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[MarkedLine]

Borderlines for spot if spot is on the left.

Marking type is always solid.

Type:

List[MarkedLine]

__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: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.List[~simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 1)[source]

Bases: 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, start_box=False)

Attributes:

TYPE

Type of the road section.

length

Length of the section.

middle_line

Middle line of the road section.

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.

__transform

Transform to origin of the object.

TYPE = 0

Type of the road section.

length: float = 1

Length of the section.

property middle_line: 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: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.List[~simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 0.45)[source]

Bases: 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.

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.

__transform

Transform to origin of the object.

TYPE = 6

Type of the road section.

length: float = 0.45

Length of the section.

property frame: 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: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.List[~simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0)[source]

Bases: 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.

__transform

Transform to origin of the object.

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.

add_dynamic_obstacle(*path[, width, length, ...])

Add an obstacle to the road.

setup_dynamic_obstacles(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[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.

TYPE = None

Type of 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().

prev_length: float = 0

Length of Road up to this section.

set_transform(tf)[source]
property middle_line: Line

Middle line of the road section.

Type:

Line

property left_line: Line

Left line of the road section.

Type:

Line

property right_line: Line

Right line of the road section.

Type:

Line

property lines: List[MarkedLine]

All road lines with their marking type.

Type:

List[MarkedLine]

property speed_limits: List[SpeedLimit]

Speed limits in the road section.

get_bounding_box() 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[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[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.

add_dynamic_obstacle(*path: List[Point], width: float = 0.2, length: float = 0.3, height: float = 0.25, speed: float = 0.6, align_middle_line: bool = True, align_line: Line | None = None, trigger_distance: float = 2, waiting_time_after_trigger: float = 0, reset_trigger_distance: float = 2)[source]

Add an obstacle to the road.

setup_dynamic_obstacles(road)[source]
classmethod fit_ending(current_ending: Pose, desired_ending: Pose, control_point_distance=0.4) 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: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.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: 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

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.

__transform

Transform to origin of the object.

TYPE = 8

Type of the road section.

width: float = 0.2
_opening_angle: float = 1.0471975511965976
property frame: Polygon

Frame of the blocked area surface marking.

It has the shape of a symmetrical trapezoid.

Type:

Polygon

property _poly: 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: ~kitcar_utils.geometry.transform.Transform | None = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: ~typing.List[~simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: ~typing.List[~simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: ~typing.List[~simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: ~typing.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: 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

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.

__transform

Transform to origin of the object.

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: Vector
property middle_r_zebra_start: Vector
property middle_r_zebra_end: Vector
property middle_end: Vector
property right_zebra_start: Vector
property right_zebra_end: Vector
property left_zebra_start: Vector
property left_zebra_end: Vector
property middle_l_zebra_start: Vector
property middle_l_zebra_end: Vector
property bezier_points_mid_r_start: List[Point]
property bezier_points_mid_r_end: List[Point]
property bezier_points_mid_l_start: List[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[Point]
property middle_line_r: Line

Middle line on the right side of the traffic island.

Type:

Line

property middle_line_l: Line

Middle line on the left side of the traffic island.

Type:

Line

property middle_line: Line

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

Type:

Line

property right_line: Line

Right line of the road section.

Type:

Line

property left_line: Line

Left line of the road section.

Type:

Line

property lines: List[MarkedLine]

All road lines with their marking type.

Type:

List[MarkedLine]

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: TrafficSign

The traffic sign for this speed limit.

Type:

TrafficSign

property surface_marking: SurfaceMarkingRect

The surface marking for this speed limit.

Type:

SurfaceMarking

class CustomSection(_Transformable__transform: kitcar_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: RoadSection, InitOptions, 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.

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.

__transform

Transform to origin of the object.

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[array]

Points that make up the middle line.

property middle_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, RoadSection]], x_buffer=1) List[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().

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

Bases: RoadSection

Road section representing the start box.

Todo

  • Change TYPE?

Attributes:

TYPE

Type of the road section.

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.

middle_line

Middle line of the road section.

left_line

Left line of the road section.

right_line

Right line of the road section.

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.

__transform

Transform to origin of the object.

frame

Frame of the blocked area surface marking.

Methods:

setup(road_origin, left_line, right_line)

get_intersection(road_origin, left_line, ...)

TYPE = 10

Type of the road section.

left_line_marking: str = 'missing'

Marking type of the left line.

middle_line_marking: str = 'solid'

Marking type of the middle line.

right_line_marking: str = 'solid'

Marking type of the right line.

setup(road_origin: Pose, left_line: Line, right_line: Line)[source]
property middle_line: Line

Middle line of the road section.

Type:

Line

property left_line: Line

Left line of the road section.

Type:

Line

property right_line: Line

Right 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().

property frame: Polygon

Frame of the blocked area surface marking.

It has the shape of a symmetrical trapezoid.

Type:

Polygon

get_intersection(road_origin: Pose, left_line: Line, right_line: Line) str | None[source]