simulation.utils.road.renderer package¶
Submodules¶
simulation.utils.road.renderer.obstacle module¶
Functions:
|
|
|
simulation.utils.road.renderer.surface_markings module¶
Functions:
|
|
|
Draw a speed limit on the road. |
|
Draw the checkerboard pattern to mark the beginning of a parking area in the given frame. |
|
Draw a blocked area in the given frame. |
|
Draw a zebra crossing in the given frame. |
|
Draw a crossing area for pedestrian, which is only marked by dashed lines, in the given frame. |
|
Draw a blocked area, which splits the two lanes of the traffic island, in the given frame. |
|
Draw two crossing lines (X) in the given frame to represent a blocked spot. |
|
Draw white stripes onto the ground. |
- draw(ctx, surface_marking: simulation.utils.road.sections.surface_marking.SurfaceMarking)[source]¶
- draw_speed_limit(ctx: cairo.Context, surface_marking: simulation.utils.road.sections.surface_marking.SurfaceMarking, limit: int, start_zone: bool)[source]¶
Draw a speed limit on the road. Add a cross if it is the end of a speed limit zone.
- Parameters
start_zone – Is this speed limit the start or end?
- draw_start_lane(ctx, frame: simulation.utils.geometry.polygon.Polygon)[source]¶
Draw the checkerboard pattern to mark the beginning of a parking area in the given frame.
- Parameters
frame – Frame of the start lane. Points of the frame must be given in the right order! first point : start on left line second point: end on left line third point : end on right line fourth point: start on right line
- draw_blocked_area(ctx, frame: simulation.utils.geometry.polygon.Polygon)[source]¶
Draw a blocked area in the given frame.
- Parameters
frame –
Frame of the blocked area. Points of the frame must be given in the right order! first point : start on right line second point: left of first point, towards middle line third point : left of fourth point, towards middle line fourth point: end on right line
Line between second and third point has to be parallel to middle/right line.
- draw_zebra_crossing(ctx, frame: simulation.utils.geometry.polygon.Polygon, stripe_width: float = 0.04, offset: float = 0.02)[source]¶
Draw a zebra crossing in the given frame.
- Parameters
frame – Frame of the zebra crossing. Points of the frame must be given in the right order! first point : start on left line second point: end on left line third point : end on right line fourth point: start on right line
- draw_crossing_lines(ctx, frame: simulation.utils.geometry.polygon.Polygon)[source]¶
Draw a crossing area for pedestrian, which is only marked by dashed lines, in the given frame.
The dashed lines are perpendicular to the road.
- Parameters
frame – Frame of the crossing area. Points of the frame must be given in the right order! first point : start on left line second point: end on left line third point : end on right line fourth point: start on right line
- draw_traffic_island_blocked(ctx, frame: simulation.utils.geometry.polygon.Polygon)[source]¶
Draw a blocked area, which splits the two lanes of the traffic island, in the given frame.
- Parameters
frame – Frame of the blocked area. Points of the frame must be given in the right order! first half of points: left border second half: right border
- draw_parking_spot_x(ctx, frame: simulation.utils.geometry.polygon.Polygon)[source]¶
Draw two crossing lines (X) in the given frame to represent a blocked spot.
- Parameters
frame – Frame of the parking spot. Points of the frame must be given in the right order! first point : left lower corner of parking spot second point: left upper corner third point : right upper corner fourth point: right lower corner
- draw_blocked_stripes(ctx, v: simulation.utils.geometry.vector.Vector, start: simulation.utils.geometry.point.Point, line: simulation.utils.geometry.line.Line, points: List[simulation.utils.geometry.point.Point], angle: float, gap: float)[source]¶
Draw white stripes onto the ground.
White stripes are e.g. used by to signal areas on the ground where the car is not allowed to drive.
- Parameters
v – Vector along the line where the stripes start points are located.
start – Start point on the line where the stripes start points are located.
line – End points of the stripes are on this line.
points – List of points of the polygon frame.
angle – Angle of the stripes.
gap – Gap between the stripes.
simulation.utils.road.renderer.tile module¶
Classes:
|
Piece of the groundplane with lines used to display road lines on the ground. |
- class Tile(index: Tuple[int, int], size: simulation.utils.geometry.vector.Vector, resolution: simulation.utils.geometry.vector.Vector, road_folder_name: Optional[str] = None, sections: Dict[int, simulation.utils.road.sections.road_section.RoadSection] = <factory>, id: Optional[str] = None, already_rendered: bool = False)[source]¶
Bases:
object
Piece of the groundplane with lines used to display road lines on the ground.
The groundplane in simulation is made out of many rectangular tiles. Each tile displays an image on the ground.
Attributes:
Static variable used to generate unique model names in Gazebo.
Position within the lattice of tiles on the groundplane.
Size of the tile.
Resolution of the tile’s image.
Name of the folder in which all tiles of the current road are.
All sections that are (atleast partly) on this tile.
ID of the tile.
Indicate whether the tile has been rendered before.
Name of the tile’s model when spawned in Gazebo.
Transform to the center of the tile.
Frame of the tile.
Methods:
Content of the tile’s material file.
Get a model string that can be spawned in Gazebo.
render_to_file
(roads_path)Render an image of the tile and save it to a file.
- COUNTER = 0¶
Static variable used to generate unique model names in Gazebo.
To ensure that Gazebo doesn’t get confused with multiple tiles that have the same name, e.g. when reloading, the counter is increased every time a model name is generated.
- index: Tuple[int, int]¶
Position within the lattice of tiles on the groundplane.
- size: simulation.utils.geometry.vector.Vector¶
Size of the tile.
- resolution: simulation.utils.geometry.vector.Vector¶
Resolution of the tile’s image.
- road_folder_name: str = None¶
Name of the folder in which all tiles of the current road are.
(Not the complete path, just the name of the folder!)
- sections: Dict[int, simulation.utils.road.sections.road_section.RoadSection]¶
All sections that are (atleast partly) on this tile.
- id: str = None¶
ID of the tile.
Automatically generated when rendering.
- already_rendered: bool = False¶
Indicate whether the tile has been rendered before.
- property name: str¶
Name of the tile’s model when spawned in Gazebo.
- Type
str
- property transform: simulation.utils.geometry.transform.Transform¶
Transform to the center of the tile.
- Type
simulation.utils.road.renderer.traffic_sign module¶
Functions:
|
|
|
- draw(name: str, sign: simulation.utils.road.sections.traffic_sign.TrafficSign)[source]¶
simulation.utils.road.renderer.utils module¶
Functions:
|
|
|
|
|
- draw_line(ctx, marked_line: simulation.utils.road.sections.road_section.MarkedLine, line_width: float = 0.02, dash_length: float = 0.2, dash_gap: Optional[float] = None, double_line_gap: float = 0.02)[source]¶
- _draw_double_line(ctx, line: simulation.utils.road.sections.road_section.MarkedLine, style_left: str, style_right: str, line_width: float, double_line_gap: float)[source]¶
- draw_polygon(ctx, polygon: simulation.utils.geometry.polygon.Polygon, lines: Optional[List[bool]] = None)[source]¶