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.
Reference¶
-
class
RoadElement(transform: simulation.utils.geometry.transform.Transform = None, normalize_x: bool = True)[source]¶ Bases:
object-
transform: simulation.utils.geometry.transform.Transform = None¶ Transform to coordinate system in which frame is given.
-
normalize_x: bool = True¶ If true, all x-values are substracted by the lowest x-value.
-
set_transform(line: simulation.utils.geometry.line.Line)[source]¶ Calculate the correct transform to this element.
Depending on
self.normalize_xthe positional behavior is different. Ifself.normalize_xis True, the element is aligned along the provided line.Example
>>> from simulation.utils.geometry import Line, Point, Transform >>> from simulation.utils.road.sections.road_element import RoadElementRect >>> line = Line([Point(0, 0), Point(0, 10)]) # y axis >>> normalized_el = RoadElementRect(center=Point(1, 1)) ... # normalize_x is True by default >>> normalized_el.set_transform(line) >>> normalized_el.transform Transform(translation=Vector(0.0, 1.0, 0.0),rotation=Quaternion(0.7071067811865476, 0.0, 0.0, 0.7071067811865475)) >>> normalized_el._center Point(1.0, 1.0, 0.0) >>> normalized_el.center Point(-1.0, 1.0, 0.0) >>> unnormalized_el = RoadElementRect(center=Point(1,0), normalize_x=False) ... # normalize_x is True by default >>> unnormalized_el.set_transform(line) >>> unnormalized_el.transform Transform(translation=Vector(0.0, 0.0, 0.0),rotation=Quaternion(0.7071067811865476, 0.0, 0.0, 0.7071067811865475)) >>> normalized_el._center Point(1.0, 1.0, 0.0) >>> normalized_el.center Point(-1.0, 1.0, 0.0)
-
-
class
_RoadElementPoly(transform: simulation.utils.geometry.transform.Transform = None, normalize_x: bool = True, frame: simulation.utils.geometry.polygon.Polygon = Polygon([Point(0.3, - 0.4, 0.0), Point(0.5, - 0.4, 0.0), Point(0.5, 0.0, 0.0), Point(0.3, 0.0, 0.0), Point(0.3, - 0.4, 0.0)]))[source]¶ Bases:
simulation.utils.road.sections.road_element.RoadElement-
frame: simulation.utils.geometry.polygon.Polygon = Polygon([Point(0.3, -0.4, 0.0), Point(0.5, -0.4, 0.0), Point(0.5, 0.0, 0.0), Point(0.3, 0.0, 0.0), Point(0.3, -0.4, 0.0)])¶ Frame of the element in global coordinates.
- Type
-
-
class
RoadElementPoly(transform: simulation.utils.geometry.transform.Transform = None, normalize_x: bool = True, frame: simulation.utils.geometry.polygon.Polygon = Polygon([Point(0.3, - 0.4, 0.0), Point(0.5, - 0.4, 0.0), Point(0.5, 0.0, 0.0), Point(0.3, 0.0, 0.0), Point(0.3, - 0.4, 0.0)]))[source]¶ Bases:
simulation.utils.road.sections.road_element._RoadElementPoly
-
class
_RoadElementRect(transform: simulation.utils.geometry.transform.Transform = None, normalize_x: bool = True, center: simulation.utils.geometry.point.Point = Point(0.4, - 0.2, 0.0), width: float = 0.2, depth: float = 0.2, angle: float = 0)[source]¶ Bases:
simulation.utils.road.sections.road_element.RoadElement-
center: simulation.utils.geometry.point.Point = Point(0.4, -0.2, 0.0)¶ Center point of the element.
-
width: float = 0.2¶ Width of the element.
-
depth: float = 0.2¶ Depth of the element.
Component of the size in the direction of the road.
-
angle: float = 0¶ Angle [radian] between the middle line and the element (measured at the center).
-
-
class
RoadElementRect(transform: Optional[simulation.utils.geometry.transform.Transform] = None, normalize_x: bool = True, center: simulation.utils.geometry.point.Point = Point(0.4, - 0.2, 0.0), width: float = 0.2, depth: float = 0.2, angle: float = 0)[source]¶ Bases:
simulation.utils.road.sections.road_element._RoadElementRectGeneric element of the road that has a frame.
Examples of road elements are obstacles and traffic signs.
-
property
orientation¶ Orientation of the element in global coordinates in radians.
- Type
float
-
property