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: Union[simulation.utils.geometry.point.Point, Sequence[float]]) → numpy.ndarray[source]¶
Get numpy array from point or coordinate sequence.
- class BezierCurve(_Transformable__transform: simulation.utils.geometry.transform.Transform = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, p1: Union[ForwardRef('Point'), Sequence[float]] = None, p2: Union[ForwardRef('Point'), Sequence[float]] = None)[source]¶
Bases:
simulation.utils.road.sections.road_section.RoadSection
Attributes:
Control point 1.
Control point 2.
- p1: Union[Point, Sequence[float]] = None¶
Control point 1.
- p2: Union[Point, Sequence[float]] = None¶
Control point 2.
- obstacles: List[StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[SpeedLimit]¶
Speed limits in the road section.
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- class QuadBezier(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, p1: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None, p2: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None)[source]¶
Bases:
simulation.utils.road.sections.bezier_curve.BezierCurve
Quadratic bezier curve, defined by two control points.
- Parameters
Attributes:
Type of the road section.
Middle line of the road section.
- TYPE = 3¶
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 CubicBezier(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, p1: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None, p2: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None, p3: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None)[source]¶
Bases:
simulation.utils.road.sections.bezier_curve.BezierCurve
Cubic bezier curve, defined by three control points.
- Parameters
Attributes:
Type of the road section.
Control point 3.
Middle line of the road section.
- TYPE = 4¶
Type of the road section.
- p3: Union[simulation.utils.geometry.point.Point, Sequence[float]] = None¶
Control point 3.
- obstacles: List[StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[SpeedLimit]¶
Speed limits in the road section.
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
simulation.utils.road.sections.blocked_area module¶
BlockedArea.
Classes:
|
Road section representing a blocked area. |
- class BlockedArea(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 1, width: float = 0.2, _opening_angle: float = 1.0471975511965976)[source]¶
Bases:
simulation.utils.road.sections.straight_road.StraightRoad
Road section representing a blocked area.
- Parameters
width (float) – width of the blocked area, starting from the right line.
Attributes:
Type 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: simulation.utils.geometry.polygon.Polygon¶
Frame of the blocked area surface marking.
It has the shape of a symmetrical trapezoid.
- Type
- property _poly: simulation.utils.geometry.polygon.Polygon¶
- obstacles: List[StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[SpeedLimit]¶
Speed limits in the road section.
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
simulation.utils.road.sections.circular_arc module¶
Left- and RightCircularArc.
Classes:
|
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: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, radius: Optional[float] = None, angle: Optional[float] = None)[source]¶
Bases:
simulation.utils.road.sections.road_section.RoadSection
Road section representing a part of a circle.
Attributes:
Radius 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].
- get_ending() → Tuple[simulation.utils.geometry.pose.Pose, float][source]¶
Get the ending of the section as a pose and the curvature.
- Returns
A tuple consisting of the last point on the middle line together with the direction facing along the middle line as a pose and the curvature at the ending of the middle line.
- obstacles: List[StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[SpeedLimit]¶
Speed limits in the road section.
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- class LeftCircularArc(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, radius: Optional[float] = None, angle: Optional[float] = None)[source]¶
Bases:
simulation.utils.road.sections.circular_arc.CircularArc
Part of a circle with a positive curvature.
- Parameters
radius (float) – Radius [m].
angle (float) – Part of the circle [radian].
Attributes:
Type of the road section.
- TYPE = 1¶
Type of the road section.
- obstacles: List[StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[SpeedLimit]¶
Speed limits in the road section.
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- class RightCircularArc(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, radius: Optional[float] = None, angle: Optional[float] = None)[source]¶
Bases:
simulation.utils.road.sections.circular_arc.CircularArc
Part of a circle with a negative curvature.
- Parameters
radius (float) – Radius [m].
angle (float) – Part of the circle [radian].
Attributes:
Type 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: simulation.utils.geometry.transform.Transform = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, middle_line_points: List[<built-in function array>] = <factory>)[source]¶
Bases:
simulation.utils.road.sections.road_section.RoadSection
,simulation.utils.basics.init_options.InitOptions
,simulation.utils.basics.save_options.SaveOptions
Attributes:
Type 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[numpy.array]¶
Points that make up the middle line.
- property middle_line: simulation.utils.geometry.line.Line¶
Middle line of the road section.
- Type
- split_by(sections: List[Tuple[int, simulation.utils.road.sections.road_section.RoadSection]], x_buffer=1) → List[simulation.utils.road.sections.road_section.RoadSection][source]¶
Add a number of other sections along this section.
- Parameters
sections – Road sections and arc lengths at which they should be added.
x_buffer – Buffer after a road section to improve the adjustment of the end pose.
- Returns
New road sections that replace this section.
- obstacles: List[StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[SpeedLimit]¶
Speed limits in the road section.
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
simulation.utils.road.sections.intersection module¶
Intersection.
Functions:
|
Return a line perpendicular to both provided (assumed parallel) lines. |
|
Classes:
|
Road section representing an intersection. |
- _get_stop_line(line1: simulation.utils.geometry.line.Line, line2: simulation.utils.geometry.line.Line, kind) → simulation.utils.road.sections.surface_marking.SurfaceMarkingRect[source]¶
Return a line perpendicular to both provided (assumed parallel) lines.
The returned line will be at the first point where both lines are parallel to each other plus 2cm offset.
- class Intersection(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, angle: float = 1.5707963267948966, closing: Optional[str] = None, turn: int = 0, rule: int = 0, size: float = 1.8, exit_direction: Optional[int] = None)[source]¶
Bases:
simulation.utils.road.sections.road_section.RoadSection
Road section representing an intersection.
- Parameters
angle (float) – Angle [radian] between crossing roads.
closing (int) – Optionally close one direction to create a T-intersection.
turn (int) – Direction in which the road continues.
rule (int) – Priority-rule at intersection.
size (float) – Length of the crossing roads.
Attributes:
Type 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.
Middle line of the intersection.
All road lines with their marking type.
Methods:
cp_sign_south
(sign_dist)cp_sign_west
(sign_dist)cp_sign_north
(sign_dist)cp_sign_east
(sign_dist)Get the beginning of the section as a pose and the curvature.
Get the ending of the section as a pose and the curvature.
Get a polygon around the road section.
- TYPE = 7¶
Type of the road section.
- PRIORITY_YIELD = 3¶
Possible value for
rule
. Car will have the right of way.Intersecting road must yield.
- PRIORITY_STOP = 4¶
Possible value for
rule
. Car will have the right of way.Intersecting road must stop.
- angle: float = 1.5707963267948966¶
Angle between intersecting roads [radian].
- closing: str = None¶
Closed direction (T-intersection).
- turn: int = 0¶
Direction in which road continues.
- rule: int = 0¶
Priority rule at intersection.
- size: float = 1.8¶
Size of intersection (from one side to the other).
- exit_direction: int = None¶
Optional parameter to overwrite the visible turning direction.
- property sin¶
- property cos¶
- property y¶
- property x¶
- property z¶
- property u¶
- property v¶
- property w¶
- property ll¶
- property ls¶
- property rl¶
- property rs¶
- property middle_line_south: simulation.utils.geometry.line.Line¶
- property left_line_south: simulation.utils.geometry.line.Line¶
- property right_line_south: simulation.utils.geometry.line.Line¶
- property middle_line_east: simulation.utils.geometry.line.Line¶
- property left_line_east: simulation.utils.geometry.line.Line¶
- property right_line_east: simulation.utils.geometry.line.Line¶
- property middle_line_north: simulation.utils.geometry.line.Line¶
- property left_line_north: simulation.utils.geometry.line.Line¶
- property right_line_north: simulation.utils.geometry.line.Line¶
- property middle_line_west: simulation.utils.geometry.line.Line¶
- obstacles: List[StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[SpeedLimit]¶
Speed limits in the road section.
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- property left_line_west: simulation.utils.geometry.line.Line¶
- property right_line_west: simulation.utils.geometry.line.Line¶
- property ls_circle: simulation.utils.geometry.line.Line¶
- property ll_circle: simulation.utils.geometry.line.Line¶
- property rs_circle: simulation.utils.geometry.line.Line¶
- property rl_circle: simulation.utils.geometry.line.Line¶
- property lines: List[simulation.utils.road.sections.road_section.MarkedLine]¶
All road lines with their marking type.
- Type
List[MarkedLine]
- get_beginning() → Tuple[simulation.utils.geometry.pose.Pose, float][source]¶
Get the beginning of the section as a pose and the curvature.
- Returns
A tuple consisting of the first point on the middle line together with the direction facing away from the road section as a pose and the curvature at the beginning of the middle line.
- get_ending() → Tuple[simulation.utils.geometry.pose.Pose, float][source]¶
Get the ending of the section as a pose and the curvature.
- Returns
A tuple consisting of the last point on the middle line together with the direction facing along the middle line as a pose and the curvature at the ending of the middle line.
- get_bounding_box() → simulation.utils.geometry.polygon.Polygon[source]¶
Get a polygon around the road section.
Bounding box is an approximate representation of all points within a given distance of this geometric object.
- _get_intersection_traffic_signs() → List[simulation.utils.road.sections.traffic_sign.TrafficSign][source]¶
- _get_intersection_surface_markings() → List[simulation.utils.road.sections.surface_marking.SurfaceMarkingRect][source]¶
simulation.utils.road.sections.line_tuple module¶
Classes:
|
A line tuple can be created from the lines of a section. |
- class LineTuple(left, middle, right)¶
Bases:
tuple
A line tuple can be created from the lines of a section.
Methods:
_asdict
()Return a new dict which maps field names to their values.
_make
(iterable)Make a new LineTuple object from a sequence or iterable
_replace
(**kwds)Return a new LineTuple object replacing specified fields with new values
Attributes:
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
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. |
- class StaticObstacle(arc_length: float = 0.4, y: float = - 0.2, width: float = 0.2, depth: float = 0.2, height: float = 0.2, angle=0)[source]¶
Bases:
simulation.utils.road.sections.road_element.RoadElementRect
Obstacle that can be placed on the road.
- Parameters
arc_length – x coordinate of the element along the road.
y – y coordinate of the element. (Perpendicular to the road.)
width – Width of the element.
depth – Depth of the element. Component of the size in the direction of the road.
height – Height of the element.
angle – Angle [radian] between the middle line and the element (measured at the center).
Attributes:
- id_ = 1¶
- desc = 'StaticObstacle'¶
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- class ParkingObstacle(x: float = 0.15, y: float = - 0.15, width: float = 0.15, depth: float = 0.15, height: float = 0.2, angle=0)[source]¶
Bases:
simulation.utils.road.sections.obstacle.StaticObstacle
Obstacle that can be placed on a parking spot.
- Parameters
x – x coordinate of the element along the road.
y – y coordinate of the element. (Perpendicular to the road.)
width – Width of the element.
depth – Depth of the element. Component of the size in the direction of the spot.
height – Height of the element.
angle – Angle [radian] between the parking spot and the element (measured at the center).
Attributes:
- id_ = 2¶
- desc = 'ParkingObstacle'¶
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
simulation.utils.road.sections.parking_area module¶
ParkingArea, ParkingLot, ParkingSpot and StartLine.
Classes:
|
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: Optional[simulation.utils.road.sections.obstacle.ParkingObstacle] = None)[source]¶
Bases:
simulation.utils.road.sections.road_element.RoadElementRect
Parking spot with a type and optionally an obstacle placed on top.
- Parameters
width – Width of the spot.
kind – Type of the spot.
obstacle – Obstacle within the spot.
Attributes:
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: simulation.utils.road.sections.obstacle.ParkingObstacle = None¶
Obstacle within the spot.
- x_surface_marking: simulation.utils.road.sections.surface_marking.SurfaceMarkingRect = None¶
- set_transform(tf: simulation.utils.geometry.transform.Transform)[source]¶
Calculate the correct transform to this element.
Depending on
self.normalize_x
the positional behavior is different. Ifself.normalize_x
is True, the element is aligned along the provided line.
- property lines: List[simulation.utils.road.sections.road_section.MarkedLine]¶
Borderlines for spot if spot is on the left.
Marking type is always solid.
- Type
List[MarkedLine]
- __transform: simulation.utils.geometry.transform.Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- class ParkingLot(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, start: float = 0, spots: List[simulation.utils.road.sections.parking_area.ParkingSpot] = <factory>, _side: str = 'right', opening_angle: float = 1.0471975511965976, depth: Optional[float] = None)[source]¶
Bases:
simulation.utils.road.sections.transformable.Transformable
Outline of a parking lot (right/left side) and all parking spots contained within.
The origin is invariant of the side of the road (left, right). It is always in the left corner of the left most parking spot, with the x-direction pointing away from the road.
- Parameters
start (float) – Beginning relative to the start of the section.
opening_angle (float) – Opening angle of the outside border of the parking lot.
depth (float) – Depth of the parking spots within the parking lot.
spots (List[ParkingSpot]) – Parking spots within the lot.
Attributes:
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[simulation.utils.road.sections.parking_area.ParkingSpot]¶
Parking spots within this parking lot.
- _side: str = 'right'¶
Side of the road.
- opening_angle: float = 1.0471975511965976¶
Opening angle of parking lot.
- __transform: simulation.utils.geometry.transform.Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- depth: float = None¶
Depth of parking spots within this lot.
If no other value is provided, the default depth of parking lots is 0.5m on the left side and 0.3m on the right side.
- set_transform(new_tf: simulation.utils.geometry.transform.Transform)[source]¶
- property length: float¶
Sum of the widths of all parking spots.
- Type
float
- property obstacles: List[simulation.utils.road.sections.obstacle.ParkingObstacle]¶
All obstacles on spots.
- Type
List[ParkingObstacle]
- property lines: List[simulation.utils.road.sections.road_section.MarkedLine]¶
All border lines with solid marking type.
- Type
List[MarkedLine]
- class ParkingArea(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 1, start_line: bool = False, start_line_length: float = 0.06, left_lots: List[simulation.utils.road.sections.parking_area.ParkingLot] = <factory>, right_lots: List[simulation.utils.road.sections.parking_area.ParkingLot] = <factory>)[source]¶
Bases:
simulation.utils.road.sections.straight_road.StraightRoad
Part of the road with parking lots and a start line.
- Parameters
left_lots (List[ParkingLot]) – Parking lots on the left side.
right_lots (List[ParkingLot]) – Parking lots on the right side.
start_line (bool) – Indicate whether the parking area starts with a start line.
start_line_length (float) – Manually set the length of the start line.
Attributes:
Type 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[simulation.utils.road.sections.parking_area.ParkingLot]¶
Parking lots on the left side.
- right_lots: List[simulation.utils.road.sections.parking_area.ParkingLot]¶
Parking lots on the right side.
- set_transform(new_tf: simulation.utils.geometry.transform.Transform)[source]¶
- get_bounding_box() → simulation.utils.geometry.polygon.Polygon[source]¶
Get a polygon around the road section.
Bounding box is an approximate representation of all points within a given distance of this geometric object.
- property parking_obstacles: List[simulation.utils.road.sections.obstacle.ParkingObstacle]¶
All obstacles on parking spots.
- Type
List[ParkingObstacle]
- property lines: List[simulation.utils.road.sections.road_section.MarkedLine]¶
All borderlines with their marking type.
- Type
List[MarkedLine]
simulation.utils.road.sections.road_element module¶
Road elements are simple individual components of the road that have a frame.
Examples are traffic signs, obstacles or surface markings (e.g. turn arrow on the ground.
Classes:
|
|
|
Generic element of the road that has a frame. |
- class RoadElement(_Transformable__transform: simulation.utils.geometry.transform.Transform = None, normalize_x: bool = True, _frame: simulation.utils.geometry.polygon.Polygon = Polygon([Point(- 0.1, - 0.2, 0.0), Point(0.1, - 0.2, 0.0), Point(0.1, 0.2, 0.0), Point(- 0.1, 0.2, 0.0), Point(- 0.1, - 0.2, 0.0)]))[source]¶
Bases:
simulation.utils.road.sections.transformable.Transformable
Attributes:
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: simulation.utils.geometry.polygon.Polygon = Polygon([Point(-0.1, -0.2, 0.0), Point(0.1, -0.2, 0.0), Point(0.1, 0.2, 0.0), Point(-0.1, 0.2, 0.0), Point(-0.1, -0.2, 0.0)])¶
Frame of the element in local coordinates.
- Type
- set_transform(obj: Union[simulation.utils.geometry.line.Line, simulation.utils.geometry.transform.Transform])[source]¶
Calculate the correct transform to this element.
Depending on
self.normalize_x
the positional behavior is different. Ifself.normalize_x
is True, the element is aligned along the provided line.
- property frame: simulation.utils.geometry.polygon.Polygon¶
Frame of the element in global coordinates.
- Type
- property center: simulation.utils.geometry.point.Point¶
Center point of the element in global coordinates.
- Type
- property _center: simulation.utils.geometry.point.Point¶
Center point of the element in local coordinates.
- Type
- __transform: simulation.utils.geometry.transform.Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- class RoadElementRect(arc_length: float = 0.4, y: float = - 0.2, width: float = 0.2, depth: float = 0.2, angle: float = 0, normalize_x: bool = True, z: float = 0, height: float = 0)[source]¶
Bases:
simulation.utils.road.sections.road_element.RoadElement
Generic element of the road that has a frame.
Examples of road elements are obstacles and traffic signs.
- Parameters
arc_length – x coordinate of the element along the road.
y – y coordinate of the element. (Perpendicular to the road.)
width – Width of the element.
depth – Depth of the element. Component of the size in the direction of the road.
angle – Angle [radian] between the middle line and the element (measured at the center).
Attributes:
Width 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: simulation.utils.geometry.transform.Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- width: float = 0.2¶
Width of the element.
- depth: float = 0.2¶
Depth (length) of the element.
- angle: float = 0¶
Angle [radian] between the middle line and the element (measured at the center).
- property orientation: float¶
Orientation of the element in global coordinates in radians.
- Type
float
simulation.utils.road.sections.road_section module¶
The RoadSection is parent to all other RoadSection classes.
Classes:
|
Line with a defined line marking style. |
|
Base class of all road sections. |
- class MarkedLine(*args, **kwargs)[source]¶
Bases:
simulation.utils.geometry.line.Line
Line with a defined line marking style.
Methods:
from_line
(line, style[, prev_length])- classmethod from_line(line: simulation.utils.geometry.line.Line, style, prev_length=0)[source]¶
- class RoadSection(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0)[source]¶
Bases:
simulation.utils.road.sections.transformable.Transformable
Base class of all road sections.
Attributes:
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.
fit_ending
(current_ending, desired_ending[, …])Add a cubic bezier curve to adjust the current ending to equal a desired ending.
- SOLID_LINE_MARKING = 'solid'¶
Continuous white line.
- DASHED_LINE_MARKING = 'dashed'¶
Dashed white line.
- MISSING_LINE_MARKING = 'missing'¶
No line at all.
- DOUBLE_SOLID_LINE_MARKING = 'double_solid'¶
Double solid line.
- DOUBLE_DASHED_LINE_MARKING = 'double_dashed'¶
Double dashed line.
- DASHED_SOLID_LINE_MARKING = 'dashed_solid'¶
Double line, left dashed, right solid
- SOLID_DASHED_LINE_MARKING = 'solid_dashed'¶
Double line, left solid, right dashed
- id: int = 0¶
Road section id (consecutive integers by default).
- is_start: bool = False¶
Road section is beginning of the road.
- left_line_marking: str = 'solid'¶
Marking type of the left line.
- middle_line_marking: str = 'dashed'¶
Marking type of the middle line.
- right_line_marking: str = 'solid'¶
Marking type of the right line.
- obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit]¶
Speed limits in the road section.
- __transform: simulation.utils.geometry.transform.Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- TYPE = None¶
Type of the road section.
- prev_length: float = 0¶
Length of Road up to this section.
- property lines: List[simulation.utils.road.sections.road_section.MarkedLine]¶
All road lines with their marking type.
- Type
List[MarkedLine]
- property speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit]¶
Speed limits in the road section.
- get_bounding_box() → simulation.utils.geometry.polygon.Polygon[source]¶
Get a polygon around the road section.
Bounding box is an approximate representation of all points within a given distance of this geometric object.
- get_beginning() → Tuple[simulation.utils.geometry.pose.Pose, float][source]¶
Get the beginning of the section as a pose and the curvature.
- Returns
A tuple consisting of the first point on the middle line together with the direction facing away from the road section as a pose and the curvature at the beginning of the middle line.
- get_ending() → Tuple[simulation.utils.geometry.pose.Pose, float][source]¶
Get the ending of the section as a pose and the curvature.
- Returns
A tuple consisting of the last point on the middle line together with the direction facing along the middle line as a pose and the curvature at the ending of the middle line.
- add_speed_limit(arc_length: float, speed: int)[source]¶
Add a speed limit to this road section.
- Parameters
arc_length – Direction along the road to the speed limit.
speed – Speed limit. Negative values correspond to the end of a speed limit zone.
- add_obstacle(arc_length: float = 0.2, y_offset: float = - 0.2, angle: float = 0, width: float = 0.2, length: float = 0.3, height: float = 0.25)[source]¶
Add an obstacle to the road.
Args: arc_length: Direction along the road to the obstacle. y_offset: Offset orthogonal to the middle line. angle: Orientation offset of the obstacle. width: Width of the obstacle. length: Length of the obstacle. height: Heigth of the obstacle.
- classmethod fit_ending(current_ending: simulation.utils.geometry.pose.Pose, desired_ending: simulation.utils.geometry.pose.Pose, control_point_distance=0.4) → simulation.utils.road.sections.road_section.RoadSection[source]¶
Add a cubic bezier curve to adjust the current ending to equal a desired ending.
- Parameters
current_ending – Current ending of the last section.
desired_ending – Ending that the last section should have.
control_point_distance – Distance to the bezier curve’s control points.
simulation.utils.road.sections.speed_limit module¶
Classes:
|
- class SpeedLimit(x_position: float, limit: int)[source]¶
Bases:
object
Attributes:
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: simulation.utils.road.sections.traffic_sign.TrafficSign¶
The traffic sign for this speed limit.
- Type
- property surface_marking: simulation.utils.road.sections.surface_marking.SurfaceMarkingRect¶
The surface marking for this speed limit.
- Type
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: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 1)[source]¶
Bases:
simulation.utils.road.sections.road_section.RoadSection
Straight section of the road.
- Parameters
length (float) – Length [m] of the section.
Example
>>> from simulation.utils.road.sections import StraightRoad >>> from simulation.utils.road.road import Road >>> road = Road() >>> straight_road = road.append(StraightRoad(length=2)) >>> road Road(_name=None, _seed=None, use_seed=True, sections=[StraightRoad(_Transformable__transform=Transform(translation=Vector(0.0, 0.0, 0.0),rotation=Quaternion(1.0, 0.0, 0.0, 0.0)), id=0, is_start=False, left_line_marking='solid', middle_line_marking='dashed', right_line_marking='solid', obstacles=[], traffic_signs=[], surface_markings=[], _speed_limits=[], prev_length=0, length=2)], length=2.0)
Attributes:
Type 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.
- 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:
object
Attributes:
Kind of the surface marking.
- START_LINE = (201, 'Startline')¶
- ZEBRA_CROSSING = (202, 'CrosswalkLines')¶
- BLOCKED_AREA = (203, 'Blockedarea')¶
- PARKING_SPOT_X = (204, 'ParkingspotX')¶
- TRAFFIC_ISLAND_BLOCKED = (205, 'Trafficisland')¶
- ZEBRA_LINES = (206, 'CrosswalkNoLines')¶
- RIGHT_TURN_MARKING = (207, 'RightArrow')¶
- LEFT_TURN_MARKING = (208, 'LeftArrow')¶
- STOP_LINE = (209, 'Stopline')¶
- GIVE_WAY_LINE = (210, 'GiveWayLine')¶
- ZONE_10_START = (211, 'ZONE_10_START')¶
- ZONE_20_START = (212, 'ZONE_20_START')¶
- ZONE_30_START = (213, 'ZONE_30_START')¶
- ZONE_40_START = (214, 'ZONE_40_START')¶
- ZONE_50_START = (215, 'ZONE_50_START')¶
- ZONE_60_START = (216, 'ZONE_60_START')¶
- ZONE_70_START = (217, 'ZONE_70_START')¶
- ZONE_80_START = (218, 'ZONE_80_START')¶
- ZONE_90_START = (219, 'ZONE_90_START')¶
- ZONE_10_END = (220, 'ZONE_10_END')¶
- ZONE_20_END = (221, 'ZONE_20_END')¶
- ZONE_30_END = (222, 'ZONE_30_END')¶
- ZONE_40_END = (223, 'ZONE_40_END')¶
- ZONE_50_END = (224, 'ZONE_50_END')¶
- ZONE_60_END = (225, 'ZONE_60_END')¶
- ZONE_70_END = (226, 'ZONE_70_END')¶
- ZONE_80_END = (227, 'ZONE_80_END')¶
- ZONE_90_END = (228, 'ZONE_90_END')¶
- kind: Tuple[int, str] = None¶
Kind of the surface marking.
- class SurfaceMarkingPoly(kind: Tuple[int, str] = None, _Transformable__transform: simulation.utils.geometry.transform.Transform = None, normalize_x: bool = True, _frame: simulation.utils.geometry.polygon.Polygon = Polygon([Point(- 0.1, - 0.2, 0.0), Point(0.1, - 0.2, 0.0), Point(0.1, 0.2, 0.0), Point(- 0.1, 0.2, 0.0), Point(- 0.1, - 0.2, 0.0)]))[source]¶
Bases:
simulation.utils.road.sections.road_element.RoadElement
,simulation.utils.road.sections.surface_marking.SurfaceMarking
Attributes:
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- class SurfaceMarkingRect(kind: Tuple[int, str], arc_length: float, y: float = - 0.5, depth: float = 0.4, width: float = 0.4, angle=0, normalize_x: bool = True)[source]¶
Bases:
simulation.utils.road.sections.road_element.RoadElementRect
,simulation.utils.road.sections.surface_marking.SurfaceMarking
Attributes:
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
simulation.utils.road.sections.traffic_island module¶
TrafficIsland.
Classes:
|
Road section representing an traffic island. |
- class TrafficIsland(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, island_width: float = 0.3, zebra_length: float = 0.45, curve_area_length: float = 0.8, curvature: float = 0.4, zebra_marking_type: int = 1, _sign_distance: float = 0.3)[source]¶
Bases:
simulation.utils.road.sections.road_section.RoadSection
Road section representing an traffic island.
- Parameters
island_width (float) – width of the island in the middle
zebra_length (float) – length of zebra section on the island
curve_area_length (float) – length of curve area section
curvature (float) – amount of curvature ranging from 0 to 1
zebra_marking_type (int) – marking on the middle of the island
Attributes:
Type 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: simulation.utils.geometry.vector.Vector¶
- property middle_r_zebra_start: simulation.utils.geometry.vector.Vector¶
- property middle_r_zebra_end: simulation.utils.geometry.vector.Vector¶
- property middle_end: simulation.utils.geometry.vector.Vector¶
- property right_zebra_start: simulation.utils.geometry.vector.Vector¶
- property right_zebra_end: simulation.utils.geometry.vector.Vector¶
- property left_zebra_start: simulation.utils.geometry.vector.Vector¶
- property left_zebra_end: simulation.utils.geometry.vector.Vector¶
- property middle_l_zebra_start: simulation.utils.geometry.vector.Vector¶
- property middle_l_zebra_end: simulation.utils.geometry.vector.Vector¶
- property bezier_points_mid_r_start: List[simulation.utils.geometry.point.Point]¶
- property bezier_points_mid_r_end: List[simulation.utils.geometry.point.Point]¶
- property bezier_points_mid_l_start: List[simulation.utils.geometry.point.Point]¶
- obstacles: List[StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[SpeedLimit]¶
Speed limits in the road section.
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- property bezier_points_mid_l_end: List[simulation.utils.geometry.point.Point]¶
- property middle_line_r: simulation.utils.geometry.line.Line¶
Middle line on the right side of the traffic island.
- Type
- property middle_line_l: simulation.utils.geometry.line.Line¶
Middle line on the left side of the traffic island.
- Type
- property lines: List[simulation.utils.road.sections.road_section.MarkedLine]¶
All road lines with their marking type.
- Type
List[MarkedLine]
simulation.utils.road.sections.traffic_sign module¶
Classes:
|
|
|
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:
object
Attributes:
- 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:
simulation.utils.road.sections.road_element.RoadElementRect
Attributes:
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: Optional[simulation.utils.geometry.transform.Transform] = None)[source]¶
Bases:
object
Object which defines a transform property.
The transform can only be modified through the
set_transform()
.Attributes:
Transform to origin of the object.
Methods:
set_transform
(new_tf)- __transform: simulation.utils.geometry.transform.Transform = None¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- property transform¶
- set_transform(new_tf: simulation.utils.geometry.transform.Transform)[source]¶
simulation.utils.road.sections.type module¶
Definition of all road section types.
Data:
- STRAIGHT_ROAD = 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: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 0.45)[source]¶
Bases:
simulation.utils.road.sections.straight_road.StraightRoad
Road section representing a zebra crossing.
- Parameters
length (float) – length of the crossing and thus the section.
Attributes:
Type 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: simulation.utils.geometry.polygon.Polygon¶
Frame for the zebra crossing surface marking.
- Type
- 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. |
|
|
|
|
|
|
|
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. |
|
|
|
- class QuadBezier(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, p1: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None, p2: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None)[source]¶
Bases:
simulation.utils.road.sections.bezier_curve.BezierCurve
Quadratic bezier curve, defined by two control points.
- Parameters
Attributes:
Type of the road section.
Middle line of the road section.
- TYPE = 3¶
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 CubicBezier(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, p1: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None, p2: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None, p3: Optional[Union[simulation.utils.geometry.point.Point, Sequence[float]]] = None)[source]¶
Bases:
simulation.utils.road.sections.bezier_curve.BezierCurve
Cubic bezier curve, defined by three control points.
- Parameters
Attributes:
Type of the road section.
Control point 3.
Middle line of the road section.
- TYPE = 4¶
Type of the road section.
- p3: Union[simulation.utils.geometry.point.Point, Sequence[float]] = None¶
Control point 3.
- obstacles: List[StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[SpeedLimit]¶
Speed limits in the road section.
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- class LeftCircularArc(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, radius: Optional[float] = None, angle: Optional[float] = None)[source]¶
Bases:
simulation.utils.road.sections.circular_arc.CircularArc
Part of a circle with a positive curvature.
- Parameters
radius (float) – Radius [m].
angle (float) – Part of the circle [radian].
Attributes:
Type of the road section.
- TYPE = 1¶
Type of the road section.
- obstacles: List[StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[SpeedLimit]¶
Speed limits in the road section.
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- class RightCircularArc(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, radius: Optional[float] = None, angle: Optional[float] = None)[source]¶
Bases:
simulation.utils.road.sections.circular_arc.CircularArc
Part of a circle with a negative curvature.
- Parameters
radius (float) – Radius [m].
angle (float) – Part of the circle [radian].
Attributes:
Type of the road section.
- obstacles: List[StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[SpeedLimit]¶
Speed limits in the road section.
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- TYPE = 2¶
Type of the road section.
- class Intersection(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, angle: float = 1.5707963267948966, closing: Optional[str] = None, turn: int = 0, rule: int = 0, size: float = 1.8, exit_direction: Optional[int] = None)[source]¶
Bases:
simulation.utils.road.sections.road_section.RoadSection
Road section representing an intersection.
- Parameters
angle (float) – Angle [radian] between crossing roads.
closing (int) – Optionally close one direction to create a T-intersection.
turn (int) – Direction in which the road continues.
rule (int) – Priority-rule at intersection.
size (float) – Length of the crossing roads.
Attributes:
Type 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.
Middle line of the intersection.
All road lines with their marking type.
Methods:
cp_sign_south
(sign_dist)cp_sign_west
(sign_dist)cp_sign_north
(sign_dist)cp_sign_east
(sign_dist)Get the beginning of the section as a pose and the curvature.
Get the ending of the section as a pose and the curvature.
Get a polygon around the road section.
- TYPE = 7¶
Type of the road section.
- PRIORITY_YIELD = 3¶
Possible value for
rule
. Car will have the right of way.Intersecting road must yield.
- PRIORITY_STOP = 4¶
Possible value for
rule
. Car will have the right of way.Intersecting road must stop.
- angle: float = 1.5707963267948966¶
Angle between intersecting roads [radian].
- closing: str = None¶
Closed direction (T-intersection).
- turn: int = 0¶
Direction in which road continues.
- rule: int = 0¶
Priority rule at intersection.
- size: float = 1.8¶
Size of intersection (from one side to the other).
- exit_direction: int = None¶
Optional parameter to overwrite the visible turning direction.
- property sin¶
- property cos¶
- property y¶
- property x¶
- property z¶
- property u¶
- property v¶
- property w¶
- property ll¶
- property ls¶
- property rl¶
- property rs¶
- property middle_line_south: simulation.utils.geometry.line.Line¶
- property left_line_south: simulation.utils.geometry.line.Line¶
- property right_line_south: simulation.utils.geometry.line.Line¶
- property middle_line_east: simulation.utils.geometry.line.Line¶
- property left_line_east: simulation.utils.geometry.line.Line¶
- property right_line_east: simulation.utils.geometry.line.Line¶
- property middle_line_north: simulation.utils.geometry.line.Line¶
- property left_line_north: simulation.utils.geometry.line.Line¶
- property right_line_north: simulation.utils.geometry.line.Line¶
- property middle_line_west: simulation.utils.geometry.line.Line¶
- obstacles: List[StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[SpeedLimit]¶
Speed limits in the road section.
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- property left_line_west: simulation.utils.geometry.line.Line¶
- property right_line_west: simulation.utils.geometry.line.Line¶
- property ls_circle: simulation.utils.geometry.line.Line¶
- property ll_circle: simulation.utils.geometry.line.Line¶
- property rs_circle: simulation.utils.geometry.line.Line¶
- property rl_circle: simulation.utils.geometry.line.Line¶
- property lines: List[simulation.utils.road.sections.road_section.MarkedLine]¶
All road lines with their marking type.
- Type
List[MarkedLine]
- get_beginning() → Tuple[simulation.utils.geometry.pose.Pose, float][source]¶
Get the beginning of the section as a pose and the curvature.
- Returns
A tuple consisting of the first point on the middle line together with the direction facing away from the road section as a pose and the curvature at the beginning of the middle line.
- get_ending() → Tuple[simulation.utils.geometry.pose.Pose, float][source]¶
Get the ending of the section as a pose and the curvature.
- Returns
A tuple consisting of the last point on the middle line together with the direction facing along the middle line as a pose and the curvature at the ending of the middle line.
- get_bounding_box() → simulation.utils.geometry.polygon.Polygon[source]¶
Get a polygon around the road section.
Bounding box is an approximate representation of all points within a given distance of this geometric object.
- _get_intersection_traffic_signs() → List[simulation.utils.road.sections.traffic_sign.TrafficSign][source]¶
- _get_intersection_surface_markings() → List[simulation.utils.road.sections.surface_marking.SurfaceMarkingRect][source]¶
- class StaticObstacle(arc_length: float = 0.4, y: float = - 0.2, width: float = 0.2, depth: float = 0.2, height: float = 0.2, angle=0)[source]¶
Bases:
simulation.utils.road.sections.road_element.RoadElementRect
Obstacle that can be placed on the road.
- Parameters
arc_length – x coordinate of the element along the road.
y – y coordinate of the element. (Perpendicular to the road.)
width – Width of the element.
depth – Depth of the element. Component of the size in the direction of the road.
height – Height of the element.
angle – Angle [radian] between the middle line and the element (measured at the center).
Attributes:
- id_ = 1¶
- desc = 'StaticObstacle'¶
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- class ParkingObstacle(x: float = 0.15, y: float = - 0.15, width: float = 0.15, depth: float = 0.15, height: float = 0.2, angle=0)[source]¶
Bases:
simulation.utils.road.sections.obstacle.StaticObstacle
Obstacle that can be placed on a parking spot.
- Parameters
x – x coordinate of the element along the road.
y – y coordinate of the element. (Perpendicular to the road.)
width – Width of the element.
depth – Depth of the element. Component of the size in the direction of the spot.
height – Height of the element.
angle – Angle [radian] between the parking spot and the element (measured at the center).
Attributes:
- id_ = 2¶
- desc = 'ParkingObstacle'¶
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- class TrafficSign(kind: simulation.utils.road.sections.traffic_sign.SignTuple, arc_length: float, y: float = - 0.5, angle=0, normalize_x: bool = True, visible: bool = True)[source]¶
Bases:
simulation.utils.road.sections.road_element.RoadElementRect
Attributes:
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: simulation.utils.geometry.transform.Transform = None, normalize_x: bool = True, _frame: simulation.utils.geometry.polygon.Polygon = Polygon([Point(- 0.1, - 0.2, 0.0), Point(0.1, - 0.2, 0.0), Point(0.1, 0.2, 0.0), Point(- 0.1, 0.2, 0.0), Point(- 0.1, - 0.2, 0.0)]))[source]¶
Bases:
simulation.utils.road.sections.road_element.RoadElement
,simulation.utils.road.sections.surface_marking.SurfaceMarking
Attributes:
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- class SurfaceMarkingRect(kind: Tuple[int, str], arc_length: float, y: float = - 0.5, depth: float = 0.4, width: float = 0.4, angle=0, normalize_x: bool = True)[source]¶
Bases:
simulation.utils.road.sections.road_element.RoadElementRect
,simulation.utils.road.sections.surface_marking.SurfaceMarking
Attributes:
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- class ParkingArea(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 1, start_line: bool = False, start_line_length: float = 0.06, left_lots: List[simulation.utils.road.sections.parking_area.ParkingLot] = <factory>, right_lots: List[simulation.utils.road.sections.parking_area.ParkingLot] = <factory>)[source]¶
Bases:
simulation.utils.road.sections.straight_road.StraightRoad
Part of the road with parking lots and a start line.
- Parameters
left_lots (List[ParkingLot]) – Parking lots on the left side.
right_lots (List[ParkingLot]) – Parking lots on the right side.
start_line (bool) – Indicate whether the parking area starts with a start line.
start_line_length (float) – Manually set the length of the start line.
Attributes:
Type of the road section.
If the parking area has a start line.
Length of the start line (if one is added.
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[simulation.utils.road.sections.parking_area.ParkingLot]¶
Parking lots on the left side.
- right_lots: List[simulation.utils.road.sections.parking_area.ParkingLot]¶
Parking lots on the right side.
- set_transform(new_tf: simulation.utils.geometry.transform.Transform)[source]¶
- get_bounding_box() → simulation.utils.geometry.polygon.Polygon[source]¶
Get a polygon around the road section.
Bounding box is an approximate representation of all points within a given distance of this geometric object.
- property parking_obstacles: List[simulation.utils.road.sections.obstacle.ParkingObstacle]¶
All obstacles on parking spots.
- Type
List[ParkingObstacle]
- property lines: List[simulation.utils.road.sections.road_section.MarkedLine]¶
All borderlines with their marking type.
- Type
List[MarkedLine]
- class ParkingLot(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, start: float = 0, spots: List[simulation.utils.road.sections.parking_area.ParkingSpot] = <factory>, _side: str = 'right', opening_angle: float = 1.0471975511965976, depth: Optional[float] = None)[source]¶
Bases:
simulation.utils.road.sections.transformable.Transformable
Outline of a parking lot (right/left side) and all parking spots contained within.
The origin is invariant of the side of the road (left, right). It is always in the left corner of the left most parking spot, with the x-direction pointing away from the road.
- Parameters
start (float) – Beginning relative to the start of the section.
opening_angle (float) – Opening angle of the outside border of the parking lot.
depth (float) – Depth of the parking spots within the parking lot.
spots (List[ParkingSpot]) – Parking spots within the lot.
Attributes:
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.
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[simulation.utils.road.sections.parking_area.ParkingSpot]¶
Parking spots within this parking lot.
- _side: str = 'right'¶
Side of the road.
- opening_angle: float = 1.0471975511965976¶
Opening angle of parking lot.
- __transform: simulation.utils.geometry.transform.Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- depth: float = None¶
Depth of parking spots within this lot.
If no other value is provided, the default depth of parking lots is 0.5m on the left side and 0.3m on the right side.
- set_transform(new_tf: simulation.utils.geometry.transform.Transform)[source]¶
- property length: float¶
Sum of the widths of all parking spots.
- Type
float
- property obstacles: List[simulation.utils.road.sections.obstacle.ParkingObstacle]¶
All obstacles on spots.
- Type
List[ParkingObstacle]
- property lines: List[simulation.utils.road.sections.road_section.MarkedLine]¶
All border lines with solid marking type.
- Type
List[MarkedLine]
- class ParkingSpot(kind: float = 0, width: float = 0.35, obstacle: Optional[simulation.utils.road.sections.obstacle.ParkingObstacle] = None)[source]¶
Bases:
simulation.utils.road.sections.road_element.RoadElementRect
Parking spot with a type and optionally an obstacle placed on top.
- Parameters
width – Width of the spot.
kind – Type of the spot.
obstacle – Obstacle within the spot.
Attributes:
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: simulation.utils.road.sections.obstacle.ParkingObstacle = None¶
Obstacle within the spot.
- x_surface_marking: simulation.utils.road.sections.surface_marking.SurfaceMarkingRect = None¶
- set_transform(tf: simulation.utils.geometry.transform.Transform)[source]¶
Calculate the correct transform to this element.
Depending on
self.normalize_x
the positional behavior is different. Ifself.normalize_x
is True, the element is aligned along the provided line.
- property lines: List[simulation.utils.road.sections.road_section.MarkedLine]¶
Borderlines for spot if spot is on the left.
Marking type is always solid.
- Type
List[MarkedLine]
- __transform: simulation.utils.geometry.transform.Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- class StraightRoad(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 1)[source]¶
Bases:
simulation.utils.road.sections.road_section.RoadSection
Straight section of the road.
- Parameters
length (float) – Length [m] of the section.
Example
>>> from simulation.utils.road.sections import StraightRoad >>> from simulation.utils.road.road import Road >>> road = Road() >>> straight_road = road.append(StraightRoad(length=2)) >>> road Road(_name=None, _seed=None, use_seed=True, sections=[StraightRoad(_Transformable__transform=Transform(translation=Vector(0.0, 0.0, 0.0),rotation=Quaternion(1.0, 0.0, 0.0, 0.0)), id=0, is_start=False, left_line_marking='solid', middle_line_marking='dashed', right_line_marking='solid', obstacles=[], traffic_signs=[], surface_markings=[], _speed_limits=[], prev_length=0, length=2)], length=2.0)
Attributes:
Type 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.
- obstacles: List[StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[SpeedLimit]¶
Speed limits in the road section.
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- class ZebraCrossing(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 0.45)[source]¶
Bases:
simulation.utils.road.sections.straight_road.StraightRoad
Road section representing a zebra crossing.
- Parameters
length (float) – length of the crossing and thus the section.
Attributes:
Type 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: simulation.utils.geometry.polygon.Polygon¶
Frame for the zebra crossing surface marking.
- Type
- obstacles: List[StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[SpeedLimit]¶
Speed limits in the road section.
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- class RoadSection(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0)[source]¶
Bases:
simulation.utils.road.sections.transformable.Transformable
Base class of all road sections.
Attributes:
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.
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.
fit_ending
(current_ending, desired_ending[, …])Add a cubic bezier curve to adjust the current ending to equal a desired ending.
- SOLID_LINE_MARKING = 'solid'¶
Continuous white line.
- DASHED_LINE_MARKING = 'dashed'¶
Dashed white line.
- MISSING_LINE_MARKING = 'missing'¶
No line at all.
- DOUBLE_SOLID_LINE_MARKING = 'double_solid'¶
Double solid line.
- DOUBLE_DASHED_LINE_MARKING = 'double_dashed'¶
Double dashed line.
- DASHED_SOLID_LINE_MARKING = 'dashed_solid'¶
Double line, left dashed, right solid
- SOLID_DASHED_LINE_MARKING = 'solid_dashed'¶
Double line, left solid, right dashed
- id: int = 0¶
Road section id (consecutive integers by default).
- is_start: bool = False¶
Road section is beginning of the road.
- left_line_marking: str = 'solid'¶
Marking type of the left line.
- middle_line_marking: str = 'dashed'¶
Marking type of the middle line.
- right_line_marking: str = 'solid'¶
Marking type of the right line.
- obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit]¶
Speed limits in the road section.
- __transform: simulation.utils.geometry.transform.Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- TYPE = None¶
Type of the road section.
- prev_length: float = 0¶
Length of Road up to this section.
- property lines: List[simulation.utils.road.sections.road_section.MarkedLine]¶
All road lines with their marking type.
- Type
List[MarkedLine]
- property speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit]¶
Speed limits in the road section.
- get_bounding_box() → simulation.utils.geometry.polygon.Polygon[source]¶
Get a polygon around the road section.
Bounding box is an approximate representation of all points within a given distance of this geometric object.
- get_beginning() → Tuple[simulation.utils.geometry.pose.Pose, float][source]¶
Get the beginning of the section as a pose and the curvature.
- Returns
A tuple consisting of the first point on the middle line together with the direction facing away from the road section as a pose and the curvature at the beginning of the middle line.
- get_ending() → Tuple[simulation.utils.geometry.pose.Pose, float][source]¶
Get the ending of the section as a pose and the curvature.
- Returns
A tuple consisting of the last point on the middle line together with the direction facing along the middle line as a pose and the curvature at the ending of the middle line.
- add_speed_limit(arc_length: float, speed: int)[source]¶
Add a speed limit to this road section.
- Parameters
arc_length – Direction along the road to the speed limit.
speed – Speed limit. Negative values correspond to the end of a speed limit zone.
- add_obstacle(arc_length: float = 0.2, y_offset: float = - 0.2, angle: float = 0, width: float = 0.2, length: float = 0.3, height: float = 0.25)[source]¶
Add an obstacle to the road.
Args: arc_length: Direction along the road to the obstacle. y_offset: Offset orthogonal to the middle line. angle: Orientation offset of the obstacle. width: Width of the obstacle. length: Length of the obstacle. height: Heigth of the obstacle.
- classmethod fit_ending(current_ending: simulation.utils.geometry.pose.Pose, desired_ending: simulation.utils.geometry.pose.Pose, control_point_distance=0.4) → simulation.utils.road.sections.road_section.RoadSection[source]¶
Add a cubic bezier curve to adjust the current ending to equal a desired ending.
- Parameters
current_ending – Current ending of the last section.
desired_ending – Ending that the last section should have.
control_point_distance – Distance to the bezier curve’s control points.
- class BlockedArea(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, length: float = 1, width: float = 0.2, _opening_angle: float = 1.0471975511965976)[source]¶
Bases:
simulation.utils.road.sections.straight_road.StraightRoad
Road section representing a blocked area.
- Parameters
width (float) – width of the blocked area, starting from the right line.
Attributes:
Type 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: simulation.utils.geometry.polygon.Polygon¶
Frame of the blocked area surface marking.
It has the shape of a symmetrical trapezoid.
- Type
- property _poly: simulation.utils.geometry.polygon.Polygon¶
- obstacles: List[StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[SpeedLimit]¶
Speed limits in the road section.
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- class TrafficIsland(_Transformable__transform: Optional[simulation.utils.geometry.transform.Transform] = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, island_width: float = 0.3, zebra_length: float = 0.45, curve_area_length: float = 0.8, curvature: float = 0.4, zebra_marking_type: int = 1, _sign_distance: float = 0.3)[source]¶
Bases:
simulation.utils.road.sections.road_section.RoadSection
Road section representing an traffic island.
- Parameters
island_width (float) – width of the island in the middle
zebra_length (float) – length of zebra section on the island
curve_area_length (float) – length of curve area section
curvature (float) – amount of curvature ranging from 0 to 1
zebra_marking_type (int) – marking on the middle of the island
Attributes:
Type 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: simulation.utils.geometry.vector.Vector¶
- property middle_r_zebra_start: simulation.utils.geometry.vector.Vector¶
- property middle_r_zebra_end: simulation.utils.geometry.vector.Vector¶
- property middle_end: simulation.utils.geometry.vector.Vector¶
- property right_zebra_start: simulation.utils.geometry.vector.Vector¶
- property right_zebra_end: simulation.utils.geometry.vector.Vector¶
- property left_zebra_start: simulation.utils.geometry.vector.Vector¶
- property left_zebra_end: simulation.utils.geometry.vector.Vector¶
- property middle_l_zebra_start: simulation.utils.geometry.vector.Vector¶
- property middle_l_zebra_end: simulation.utils.geometry.vector.Vector¶
- property bezier_points_mid_r_start: List[simulation.utils.geometry.point.Point]¶
- property bezier_points_mid_r_end: List[simulation.utils.geometry.point.Point]¶
- property bezier_points_mid_l_start: List[simulation.utils.geometry.point.Point]¶
- obstacles: List[StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[SpeedLimit]¶
Speed limits in the road section.
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.
- property bezier_points_mid_l_end: List[simulation.utils.geometry.point.Point]¶
- property middle_line_r: simulation.utils.geometry.line.Line¶
Middle line on the right side of the traffic island.
- Type
- property middle_line_l: simulation.utils.geometry.line.Line¶
Middle line on the left side of the traffic island.
- Type
- property lines: List[simulation.utils.road.sections.road_section.MarkedLine]¶
All road lines with their marking type.
- Type
List[MarkedLine]
- class SpeedLimit(x_position: float, limit: int)[source]¶
Bases:
object
Attributes:
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: simulation.utils.road.sections.traffic_sign.TrafficSign¶
The traffic sign for this speed limit.
- Type
- property surface_marking: simulation.utils.road.sections.surface_marking.SurfaceMarkingRect¶
The surface marking for this speed limit.
- Type
- class CustomSection(_Transformable__transform: simulation.utils.geometry.transform.Transform = None, id: int = 0, is_start: bool = False, left_line_marking: str = 'solid', middle_line_marking: str = 'dashed', right_line_marking: str = 'solid', obstacles: List[simulation.utils.road.sections.obstacle.StaticObstacle] = <factory>, traffic_signs: List[simulation.utils.road.sections.traffic_sign.TrafficSign] = <factory>, surface_markings: List[simulation.utils.road.sections.surface_marking.SurfaceMarking] = <factory>, _speed_limits: List[simulation.utils.road.sections.speed_limit.SpeedLimit] = <factory>, prev_length: float = 0, middle_line_points: List[<built-in function array>] = <factory>)[source]¶
Bases:
simulation.utils.road.sections.road_section.RoadSection
,simulation.utils.basics.init_options.InitOptions
,simulation.utils.basics.save_options.SaveOptions
Attributes:
Type of the road section.
Middle line of the road section.
Methods:
save_as_yaml
(file_path)Save the section as a yaml file.
from_yaml
(file_path)Load from a yaml file.
split_by
(sections[, x_buffer])Add a number of other sections along this section.
- TYPE = 10¶
Type of the road section.
- middle_line_points: List[numpy.array]¶
Points that make up the middle line.
- property middle_line: simulation.utils.geometry.line.Line¶
Middle line of the road section.
- Type
- split_by(sections: List[Tuple[int, simulation.utils.road.sections.road_section.RoadSection]], x_buffer=1) → List[simulation.utils.road.sections.road_section.RoadSection][source]¶
Add a number of other sections along this section.
- Parameters
sections – Road sections and arc lengths at which they should be added.
x_buffer – Buffer after a road section to improve the adjustment of the end pose.
- Returns
New road sections that replace this section.
- obstacles: List[StaticObstacle]¶
Obstacles in the road section.
- traffic_signs: List[TrafficSign]¶
Traffic signs in the road section.
- surface_markings: List[SurfaceMarking]¶
Surface markings in the road section.
- _speed_limits: List[SpeedLimit]¶
Speed limits in the road section.
- __transform: Transform¶
Transform to origin of the object.
The name of the transform starts with __ to prevent subclasses from changing it’s values without running
set_transform()
.