simulation.utils.road.sections package
Submodules
simulation.utils.road.sections.bezier_curve module
Quadratic- and CubicBezierCurves.
Functions:
|
Get numpy array from point or coordinate sequence. |
|
|
|
Classes:
|
|
|
Quadratic bezier curve, defined by two control points. |
|
Cubic bezier curve, defined by three control points. |
- _read_point(p: Point | Sequence[float]) ndarray[source]
Get numpy array from point or coordinate sequence.
- 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:
RoadSectionAttributes:
Control point 1.
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:
BezierCurveQuadratic 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 of the road section.
Middle line of the road section.
Obstacles in the road section.
Traffic signs in the road section.
Surface markings in the road section.
Speed limits in the road section.
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:
BezierCurveCubic 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 of the road section.
Control point 3.
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:
|
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:
StraightRoadRoad section representing a blocked area.
- Parameters:
width (float) – width of the blocked area, starting from the right line.
Attributes:
Type of the road section.
Frame of the blocked area surface marking.
- 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:
|
Road section representing a part of a circle. |
|
Part of a circle with a positive curvature. |
|
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:
RoadSectionRoad section representing a part of a circle.
Attributes:
Radius of the circle.
Define the portion of the circle [radian].
Middle line of the road section.
Methods:
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:
CircularArcPart of a circle with a positive curvature.
- Parameters:
radius (float) – Radius [m].
angle (float) – Part of the circle [radian].
Attributes:
Type of the road section.
Obstacles in the road section.
Traffic signs in the road section.
Surface markings in the road section.
Speed limits in the road section.
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:
CircularArcPart of a circle with a negative curvature.
- Parameters:
radius (float) – Radius [m].
angle (float) – Part of the circle [radian].
Attributes:
Obstacles in the road section.
Traffic signs in the road section.
Surface markings in the road section.
Speed limits in the road section.
Transform to origin of the object.
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:
|
- 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,SaveOptionsAttributes:
Type of the road section.
Points that make up the 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
- 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:
|
Return a line perpendicular to both provided (assumed parallel) lines. |
|
NumPy arange, but include end point. |
Classes:
|
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:
RoadSectionRoad 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:
Attributes:
Type of the road section.
Possible value for
turn.Possible value for
turn.Possible value for
turn.Possible value for
rule.Possible value for
rule.Possible value for
rule.Possible value for
rule.Possible value for
rule.Angle between intersecting roads [radian].
Closed direction (T-intersection).
Direction in which road continues.
Priority rule at intersection.
Size of intersection (from one side to the other).
Optional parameter to overwrite the visible turning direction.
Enables invisible intersection to close loops at an intersection.
Inner left turn circle.
Outer left turn circle.
Inner right turn circle.
Outer right turn circle.
Middle line of the intersection.
All road lines with their marking type.
Methods:
cp_sign_south(sign_dist)Sign Center Point South.
Surface Marking Center Point South.
cp_sign_west(sign_dist)Sign Center Point West.
Surface Marking Center Point West.
cp_sign_north(sign_dist)Sign Center Point North.
cp_sign_east(sign_dist)Sign Center Point East.
Surface Marking Center Point East.
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 a polygon around the intersection.
Get a list of all traffic signs.
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
- 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_sign_west(sign_dist: float) Vector[source]
Sign Center Point West.
- Parameters:
sign_dist – distance from end of right line
- 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
- 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
simulation.utils.road.sections.line_tuple module
Classes:
|
A line tuple can be created from the lines of a section. |
- class LineTuple(left, middle, right)
Bases:
tupleA 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:
Left line of the section.
Middle line of the section.
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:
|
Obstacle that can be placed on the road. |
|
Obstacle that can be placed on a parking spot. |
|
DynamicObstacle that can be placed on all road sections. |
|
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:
RoadElementRectObstacle 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_ = 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:
StaticObstacleObstacle 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:
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:
StaticObstacleDynamicObstacle that can be placed on all road sections.
Attributes:
Width of the obstacle.
Width of the obstacle.
The current pose of the obstacle.
Speed of the obstacle.
Distance to car along the road at which the obstacle should be triggered.
Distance to car along the road at which resets the obstacle.
Defines the time at which the obstacle is triggered.
Wait for this amount of seconds after first trigger.
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.
- __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 Pedestrian(arc_length: float = 0.225, y: float = -0.5)[source]
Bases:
DynamicObstaclePedestrian to use at zebra crossing.
Attributes:
Width of the pedestrian.
Width of the pedestrian.
Height of the pedestrian.
Speed of the obstacle.
Defines the time at which the pedestrian is triggered.
Wait for this amount of seconds after first trigger.
Distance to car along the road at which the pedestrian should start walking.
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:
|
Parking spot with a type and optionally an obstacle placed on top. |
|
Outline of a parking lot (right/left side) and all parking spots contained within. |
|
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:
RoadElementRectParking 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:
Possible value of
kind.Possible value of
kind.Possible value of
kind.Side of the road.
Classification of the parking spot.
Obstacle within the spot.
Borderlines for spot if spot is on the left.
Methods:
set_transform(tf)Calculate the correct transform to this element.
- _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_xthe positional behavior is different. Ifself.normalize_xis 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:
TransformableOutline 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:
Possible value of
side.Possible value of
side.Default value for the depth of parking spots on the left side.
Default value for the depth of parking spots on the right side.
Start of the parking lot along the middle line relative to the parking area.
Parking spots within this parking lot.
Side of the road.
Opening angle of parking lot.
Depth of parking spots within this lot.
Sum of the widths of all parking spots.
Outside border of the parking lot.
All obstacles on spots.
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.
- 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:
StraightRoadPart 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 of the road section.
If the parking area has a start line.
Length of the start line (if one is added.
Parking lots on the left side.
Parking lots on the right side.
All obstacles on parking spots.
All borderlines with their marking type.
Methods:
set_transform(new_tf)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.
- 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:
|
|
|
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:
TransformableAttributes:
If true, all x-values are substracted by the lowest x-value.
Frame of the element in local coordinates.
Frame of the element in global coordinates.
Center point of the element in global coordinates.
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_xthe positional behavior is different. Ifself.normalize_xis 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:
RoadElementGeneric 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 of the element.
Depth (length) of the element.
Angle [radian] between the middle line and the element (measured at the center).
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:
|
Line with a defined line marking style. |
|
Base class of all road sections. |
- class MarkedLine(*args, **kwargs)[source]
Bases:
LineLine with a defined line marking style.
Methods:
from_line(line, style[, prev_length])
- 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:
TransformableBase class of all road sections.
Attributes:
Continuous white line.
Dashed white line.
No line at all.
Double solid line.
Double dashed line.
Double line, left dashed, right solid.
Double line, left solid, right dashed.
Road section id (consecutive integers by default).
Road section is beginning of the road.
Marking type of the left line.
Marking type of the middle line.
Marking type of the right line.
Obstacles in the road section.
Traffic signs in the road section.
Surface markings in the road section.
Speed limits in the road section.
Type of the road section.
Length of Road up to this section.
Middle line of the road section.
Left line of the road section.
Right line of the road section.
All road lines with their marking type.
Speed limits in the road section.
Methods:
set_transform(tf)Get a polygon around the road section.
Get the beginning of the section as a pose and the curvature.
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.
- 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.
- 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:
|
- class SpeedLimit(x_position: float, limit: int)[source]
Bases:
objectAttributes:
The position on the road.
The speed limit.
The traffic sign for this speed limit.
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:
- property surface_marking: SurfaceMarkingRect
The surface marking for this speed limit.
- Type:
simulation.utils.road.sections.start_box module
StartBox.
Exceptions:
Classes:
|
Road section representing the start box. |
- 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:
RoadSectionRoad section representing the start box.
Todo
Change TYPE?
Attributes:
Type of the road section.
Marking type of the left line.
Marking type of the middle line.
Marking type of the right line.
Middle line of the road section.
Left line of the road section.
Right line of the road section.
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.
- 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
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:
|
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:
RoadSectionStraight 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 of the road section.
Length of the section.
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:
|
|
|
|
|
- class SurfaceMarking(kind: Tuple[int, str] = None)[source]
Bases:
objectAttributes:
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,SurfaceMarkingAttributes:
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,SurfaceMarkingAttributes:
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:
|
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:
RoadSectionRoad 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 of the road section.
Possible value for
zebra_marking_type.Possible value for
zebra_marking_type.Width of island in the middle.
Length of the zebra crossing area.
Length of the bezier curve area at start and end of island.
Define where along the curve area the control points are located.
Type of zebra marking type.
Distance of the directions signs from the mid island part.
Length of the entire section.
Middle line on the right side of the traffic island.
Middle line on the left side of the traffic island.
Middle line of the road section.
Right line of the road section.
Left line of the road section.
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:
|
|
|
Functions:
- 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:
objectAttributes:
- 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)
- 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:
RoadElementRectAttributes:
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().
- visible: bool = True
Indicate whether the traffic sign is visible while driving on the road.
simulation.utils.road.sections.transformable module
Classes:
|
Object which defines a transform property. |
- class Transformable(_Transformable__transform: Transform | None = None)[source]
Bases:
objectObject which defines a transform property.
The transform can only be modified through the
set_transform().Attributes:
Transform to origin of the object.
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
simulation.utils.road.sections.type module
Definition of all road section types.
Data:
- 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:
|
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:
StraightRoadRoad section representing a zebra crossing.
- Parameters:
length (float) – length of the crossing and thus the section.
Attributes:
Type of the road section.
Length of the section.
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:
|
Quadratic bezier curve, defined by two control points. |
|
Cubic bezier curve, defined by three control points. |
|
Part of a circle with a positive curvature. |
|
Part of a circle with a negative curvature. |
|
Road section representing an intersection. |
|
Obstacle that can be placed on the road. |
|
Obstacle that can be placed on a parking spot. |
|
DynamicObstacle that can be placed on all road sections. |
|
Pedestrian to use at zebra crossing. |
|
|
|
|
|
|
|
Part of the road with parking lots and a start line. |
|
Outline of a parking lot (right/left side) and all parking spots contained within. |
|
Parking spot with a type and optionally an obstacle placed on top. |
|
Straight section of the road. |
|
Road section representing a zebra crossing. |
|
Base class of all road sections. |
|
Road section representing a blocked area. |
|
Road section representing an traffic island. |
|
|
|
|
|
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:
BezierCurveQuadratic 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 of the road section.
Middle line of the road section.
Obstacles in the road section.
Traffic signs in the road section.
Surface markings in the road section.
Speed limits in the road section.
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:
BezierCurveCubic 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 of the road section.
Control point 3.
Obstacles in the road section.
Traffic signs in the road section.
Surface markings in the road section.
Speed limits in the road section.
Transform to origin of the object.
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:
CircularArcPart of a circle with a positive curvature.
- Parameters:
radius (float) – Radius [m].
angle (float) – Part of the circle [radian].
Attributes:
Type of the road section.
Obstacles in the road section.
Traffic signs in the road section.
Surface markings in the road section.
Speed limits in the road section.
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:
CircularArcPart of a circle with a negative curvature.
- Parameters:
radius (float) – Radius [m].
angle (float) – Part of the circle [radian].
Attributes:
Obstacles in the road section.
Traffic signs in the road section.
Surface markings in the road section.
Speed limits in the road section.
Transform to origin of the object.
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:
RoadSectionRoad 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:
Attributes:
Type of the road section.
Possible value for
turn.Possible value for
turn.Possible value for
turn.Possible value for
rule.Possible value for
rule.Possible value for
rule.Possible value for
rule.Possible value for
rule.Angle between intersecting roads [radian].
Closed direction (T-intersection).
Direction in which road continues.
Priority rule at intersection.
Size of intersection (from one side to the other).
Optional parameter to overwrite the visible turning direction.
Enables invisible intersection to close loops at an intersection.
Obstacles in the road section.
Traffic signs in the road section.
Surface markings in the road section.
Speed limits in the road section.
Transform to origin of the object.
Inner left turn circle.
Outer left turn circle.
Inner right turn circle.
Outer right turn circle.
Middle line of the intersection.
All road lines with their marking type.
Methods:
cp_sign_south(sign_dist)Sign Center Point South.
Surface Marking Center Point South.
cp_sign_west(sign_dist)Sign Center Point West.
Surface Marking Center Point West.
cp_sign_north(sign_dist)Sign Center Point North.
cp_sign_east(sign_dist)Sign Center Point East.
Surface Marking Center Point East.
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 a polygon around the intersection.
Get a list of all traffic signs.
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
- 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_sign_west(sign_dist: float) Vector[source]
Sign Center Point West.
- Parameters:
sign_dist – distance from end of right line
- 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
- 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
- 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:
RoadElementRectObstacle 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:
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:
StaticObstacleObstacle 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:
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:
StaticObstacleDynamicObstacle that can be placed on all road sections.
Attributes:
Width of the obstacle.
Width of the obstacle.
The current pose of the obstacle.
Speed of the obstacle.
Distance to car along the road at which the obstacle should be triggered.
Distance to car along the road at which resets the obstacle.
Defines the time at which the obstacle is triggered.
Wait for this amount of seconds after first trigger.
Height of the obstacle.
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.
- __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 Pedestrian(arc_length: float = 0.225, y: float = -0.5)[source]
Bases:
DynamicObstaclePedestrian to use at zebra crossing.
Attributes:
Transform to origin of the object.
Width of the pedestrian.
Width of the pedestrian.
Height of the pedestrian.
Speed of the obstacle.
Defines the time at which the pedestrian is triggered.
Wait for this amount of seconds after first trigger.
Distance to car along the road at which the pedestrian should start walking.
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:
RoadElementRectAttributes:
Transform to origin of the object.
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().
- 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,SurfaceMarkingAttributes:
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,SurfaceMarkingAttributes:
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:
StraightRoadPart 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 in the road section.
Traffic signs in the road section.
Surface markings in the road section.
Speed limits in the road section.
Transform to origin of the object.
Type of the road section.
If the parking area has a start line.
Length of the start line (if one is added.
Parking lots on the left side.
Parking lots on the right side.
All obstacles on parking spots.
All borderlines with their marking type.
Methods:
set_transform(new_tf)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.
- 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:
TransformableOutline 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:
Possible value of
side.Possible value of
side.Default value for the depth of parking spots on the left side.
Default value for the depth of parking spots on the right side.
Start of the parking lot along the middle line relative to the parking area.
Parking spots within this parking lot.
Side of the road.
Opening angle of parking lot.
Transform to origin of the object.
Depth of parking spots within this lot.
Sum of the widths of all parking spots.
Outside border of the parking lot.
All obstacles on spots.
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.
- 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:
RoadElementRectParking 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:
Possible value of
kind.Possible value of
kind.Possible value of
kind.Side of the road.
Classification of the parking spot.
Obstacle within the spot.
Borderlines for spot if spot is on the left.
Transform to origin of the object.
Methods:
set_transform(tf)Calculate the correct transform to this element.
- _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_xthe positional behavior is different. Ifself.normalize_xis 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:
RoadSectionStraight 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 of the road section.
Length of the section.
Middle line of the road section.
Obstacles in the road section.
Traffic signs in the road section.
Surface markings in the road section.
Speed limits in the road section.
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:
StraightRoadRoad section representing a zebra crossing.
- Parameters:
length (float) – length of the crossing and thus the section.
Attributes:
Type of the road section.
Length of the section.
Frame for the zebra crossing surface marking.
Obstacles in the road section.
Traffic signs in the road section.
Surface markings in the road section.
Speed limits in the road section.
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:
TransformableBase class of all road sections.
Attributes:
Continuous white line.
Dashed white line.
No line at all.
Double solid line.
Double dashed line.
Double line, left dashed, right solid.
Double line, left solid, right dashed.
Road section id (consecutive integers by default).
Road section is beginning of the road.
Marking type of the left line.
Marking type of the middle line.
Marking type of the right line.
Obstacles in the road section.
Traffic signs in the road section.
Surface markings in the road section.
Speed limits in the road section.
Type of the road section.
Transform to origin of the object.
Length of Road up to this section.
Middle line of the road section.
Left line of the road section.
Right line of the road section.
All road lines with their marking type.
Speed limits in the road section.
Methods:
set_transform(tf)Get a polygon around the road section.
Get the beginning of the section as a pose and the curvature.
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.
- 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.
- 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:
StraightRoadRoad section representing a blocked area.
- Parameters:
width (float) – width of the blocked area, starting from the right line.
Attributes:
Type of the road section.
Frame of the blocked area surface marking.
Obstacles in the road section.
Traffic signs in the road section.
Surface markings in the road section.
Speed limits in the road section.
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:
RoadSectionRoad 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 of the road section.
Possible value for
zebra_marking_type.Possible value for
zebra_marking_type.Width of island in the middle.
Length of the zebra crossing area.
Length of the bezier curve area at start and end of island.
Define where along the curve area the control points are located.
Type of zebra marking type.
Distance of the directions signs from the mid island part.
Length of the entire section.
Obstacles in the road section.
Traffic signs in the road section.
Surface markings in the road section.
Speed limits in the road section.
Transform to origin of the object.
Middle line on the right side of the traffic island.
Middle line on the left side of the traffic island.
Middle line of the road section.
Right line of the road section.
Left line of the road section.
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:
objectAttributes:
The position on the road.
The speed limit.
The traffic sign for this speed limit.
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:
- property surface_marking: SurfaceMarkingRect
The surface marking for this speed limit.
- Type:
- 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,SaveOptionsAttributes:
Type of the road section.
Points that make up the middle line.
Middle line of the road section.
Obstacles in the road section.
Traffic signs in the road section.
Surface markings in the road section.
Speed limits in the road section.
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
- 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:
RoadSectionRoad section representing the start box.
Todo
Change TYPE?
Attributes:
Type of the road section.
Marking type of the left line.
Marking type of the middle line.
Marking type of the right line.
Middle line of the road section.
Left line of the road section.
Right line of the road section.
Obstacles in the road section.
Traffic signs in the road section.
Surface markings in the road section.
Speed limits in the road section.
Transform to origin of the object.
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.
- 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