simulation.src.simulation_groundtruth.src.groundtruth package

Submodules

simulation.src.simulation_groundtruth.src.groundtruth.groundtruth module

Functions:

_lane_msg_from_lines(left, middle, right)

Create a lane message from three lines.

Classes:

IntersectionTuple(turn, rule, south, west, …)

Container for information about an intersection.

Groundtruth(road)

Provide functionality to extract groundtruth information as ROS messages.

_lane_msg_from_lines(left: simulation.utils.geometry.line.Line, middle: simulation.utils.geometry.line.Line, right: simulation.utils.geometry.line.Line)simulation_groundtruth.msg._Lane.Lane[source]

Create a lane message from three lines.

class IntersectionTuple(turn, rule, south, west, east, north)

Bases: tuple

Container for information about an intersection.

Methods:

_asdict()

Return a new dict which maps field names to their values.

_make(iterable)

Make a new IntersectionTuple object from a sequence or iterable

_replace(**kwds)

Return a new IntersectionTuple object replacing specified fields with new values

Attributes:

_field_defaults

_fields

_fields_defaults

east

Lane markings on the right side when coming from south.

north

Lane markings straight ahead when coming from south.

rule

Priority rule.

south

Lane markings approaching the intersection.

turn

Direction the road follows.

west

Lane markings on the left side when coming from south.

_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {}
_fields = ('turn', 'rule', 'south', 'west', 'east', 'north')
_fields_defaults = {}
classmethod _make(iterable)

Make a new IntersectionTuple object from a sequence or iterable

_replace(**kwds)

Return a new IntersectionTuple object replacing specified fields with new values

east

Lane markings on the right side when coming from south.

Type

LaneMsg

north

Lane markings straight ahead when coming from south.

Type

LaneMsg

rule

Priority rule.

Type

int

south

Lane markings approaching the intersection.

Type

LaneMsg

turn

Direction the road follows.

Type

int

west

Lane markings on the left side when coming from south.

Type

LaneMsg

class Groundtruth(road: simulation.utils.road.road.Road)[source]

Bases: object

Provide functionality to extract groundtruth information as ROS messages.

Attributes:

road

Store the current road.

Methods:

get_section_msgs()

Section message for all sections.

get_lane_msg(id)

Lane message for requested road section.

get_intersection_msg(id)

Intersection tuple for requested road section.

get_parking_msg(id)

Parking message for the left and right side of the requested road section.

get_obstacle_msgs(id)

Labeled polygon msg for each obstacle in the requested road section.

get_surface_marking_msgs(id)

Labeled polygon msg for each surface marking in the requested road section.

get_traffic_sign_msgs(id)

Labeled polygon msg for each traffic sign in the requested road section.

road: simulation.utils.road.road.Road

Store the current road.

get_section_msgs()List[simulation_groundtruth.msg._Section.Section][source]

Section message for all sections.

get_lane_msg(id: int)simulation_groundtruth.msg._Lane.Lane[source]

Lane message for requested road section.

Parameters

id – section id

get_intersection_msg(id: int)simulation.src.simulation_groundtruth.src.groundtruth.groundtruth.IntersectionTuple[source]

Intersection tuple for requested road section.

Parameters

id – section id

get_parking_msg(id: int)Tuple[simulation_groundtruth.msg._Parking.Parking, simulation_groundtruth.msg._Parking.Parking][source]

Parking message for the left and right side of the requested road section.

Parameters

id – section id

get_obstacle_msgs(id: int)List[simulation_groundtruth.msg._LabeledPolygon.LabeledPolygon][source]

Labeled polygon msg for each obstacle in the requested road section.

Parameters

id – section id

get_surface_marking_msgs(id: int)List[simulation_groundtruth.msg._LabeledPolygon.LabeledPolygon][source]

Labeled polygon msg for each surface marking in the requested road section.

Parameters

id – section id

get_traffic_sign_msgs(id: int)List[simulation_groundtruth.msg._LabeledPolygon.LabeledPolygon][source]

Labeled polygon msg for each traffic sign in the requested road section.

Parameters

id – section id

simulation.src.simulation_groundtruth.src.groundtruth.node module

Classes:

LabeledPolygonService(topic, callback, …)

Small wrapper class to easily create ROS services that offer LabeledPolygonMsgs.

GroundtruthNode([name, log_level])

ROS node providing services to access the road’s groundtruth.

class LabeledPolygonService(topic: str, callback: Callable[[id], List[simulation_groundtruth.msg._LabeledPolygon.LabeledPolygon]])[source]

Bases: object

Small wrapper class to easily create ROS services that offer LabeledPolygonMsgs.

Attributes:

Methods:

request(request)

Answer service request.

shutdown()

topic: str
callback: Callable[[id], List[simulation_groundtruth.msg._LabeledPolygon.LabeledPolygon]]
request(request: simulation_groundtruth.srv._LabeledPolygonSrv.LabeledPolygonSrv)simulation_groundtruth.srv._LabeledPolygonSrv.LabeledPolygonSrvResponse[source]

Answer service request.

shutdown()[source]
class GroundtruthNode(name='groundtruth_node', log_level=2)[source]

Bases: simulation.utils.ros_base.node_base.NodeBase

ROS node providing services to access the road’s groundtruth.

groundtruth

Stores road sections and allows to access groundtruth information.

Type

Groundtruth

renderer

Render and update the road in Gazebo.

Type

Renderer

object_controller

Create and track objects (e.g. obstacles, signs) in Gazebo.

Type

ObjectController

section_srv

ROS service to access section ids and types.

Type

rospy.Service

lane_srv

ROS service to access the lanes of a road section.

Type

rospy.Service

obstacle_srv

ROS service to access obstacles in a road section.

Type

rospy.Service

parking_srv

ROS service to access parking spots and other parking information.

Type

rospy.Service

surface_marking_srv

ROS service to access surface markings in a road section.

Type

rospy.Service

intersection_srv

ROS service to access information of an intersection.

Type

rospy.Service

Methods:

_load_road()

Load road sections from current road.

_ensure_gazebo_startup()

Make sure that gazebo is correctly launched.

start()

Called when activating the node.

stop()

Turn off.

update()

Update the groundtruth including renderer and object controller.

get_sections(request)

Answer section service request.

get_lanes(request)

Answer lane service request.

get_parking(request)

Answer parking service request.

get_intersection(request)

Answer intersection service request.

receive_model_states(model_states)

receive_car_state(car_state)

_spawn_model(model_xml)

Spawn a model in Gazebo.

_remove_model(name)

Remove a model from Gazebo.

_pause_gazebo()

Pause Gazebo.

_unpause_gazebo()

Request to start Gazebo.

receive_reload_request(_)

Receive requests to reload the world.

receive_interrupt_request(_)

Receive requests to stop rendering processes.

update_groundtruth_status([status, …])

_load_road()simulation.utils.road.road.Road[source]

Load road sections from current road.

_ensure_gazebo_startup()[source]

Make sure that gazebo is correctly launched.

Waiting for Gazebo is not as easy as it should be. This function, however, is a workaround. It attempts to spawn a model until it is there. Once the model has been spawned, it is directly removed again. At this point, Gazebo has been completely launched.

Beware: The model has no collision box and is not visible. It is therefore not problematic if it is not correctly removed!

start()[source]

Called when activating the node.

stop()[source]

Turn off.

update()[source]

Update the groundtruth including renderer and object controller.

get_sections(request: simulation_groundtruth.srv._SectionSrv.SectionSrvRequest)simulation_groundtruth.srv._SectionSrv.SectionSrvResponse[source]

Answer section service request.

get_lanes(request: simulation_groundtruth.srv._LaneSrv.LaneSrvRequest)simulation_groundtruth.srv._LaneSrv.LaneSrvResponse[source]

Answer lane service request.

get_parking(request: simulation_groundtruth.srv._ParkingSrv.ParkingSrvRequest)simulation_groundtruth.srv._ParkingSrv.ParkingSrvResponse[source]

Answer parking service request.

get_intersection(request: simulation_groundtruth.srv._IntersectionSrv.IntersectionSrvRequest)simulation_groundtruth.srv._IntersectionSrv.IntersectionSrvResponse[source]

Answer intersection service request.

receive_model_states(model_states: gazebo_msgs.msg._ModelStates.ModelStates)[source]
receive_car_state(car_state: gazebo_simulation.msg._CarState.CarState)[source]
_spawn_model(model_xml: str)[source]

Spawn a model in Gazebo.

Parameters

model_xml – XML String that defines the model. (Without sdf declaration!)

_remove_model(name)[source]

Remove a model from Gazebo.

Parameters

name – Name of the model in Gazebo.

_pause_gazebo()[source]

Pause Gazebo.

_unpause_gazebo()[source]

Request to start Gazebo.

receive_reload_request(_: std_msgs.msg._Empty.Empty)[source]

Receive requests to reload the world.

receive_interrupt_request(_: std_msgs.msg._Empty.Empty)[source]

Receive requests to stop rendering processes.

update_groundtruth_status(status=None, processed_tiles=None, number_of_tiles=None)[source]

simulation.src.simulation_groundtruth.src.groundtruth.object_controller module

Classes:

ObjectController(road, spawn_model, None], …)

ROS node to place obstacles and other objects (e.g.

class ObjectController(road: simulation.utils.road.road.Road, spawn_model: Callable[[str], None], remove_model: Callable[[str], None], _obstacle_idx: int = 0, _sign_idx: int = 0)[source]

Bases: object

ROS node to place obstacles and other objects (e.g. traffic signs) in Gazebo.

Attributes:

_obstacle_idx

_sign_idx

obstacle_name

sign_name

Methods:

_load_static_obstacles_from_groundtruth()

load(model_names)

Reload all objects.

update(car_state)

Update the object controller.

road: simulation.utils.road.road.Road
spawn_model: Callable[[str], None]
remove_model: Callable[[str], None]
_obstacle_idx: int = 0
_sign_idx: int = 0
property obstacle_name
property sign_name
_load_static_obstacles_from_groundtruth()List[simulation.utils.road.sections.obstacle.StaticObstacle][source]
load(model_names: List[str])[source]

Reload all objects.

update(car_state: gazebo_simulation.msg._CarState.CarState)[source]

Update the object controller.

Use this function to move dynamic obstacles around.

Parameters

car_state – Current car state containing the position of the car.

simulation.src.simulation_groundtruth.src.groundtruth.renderer module

Functions:

current_pretty_time()

Classes:

PreviousRendering(seed, tile_size, float], …)

Renderer(road, remove_model, NoneType], …)

current_pretty_time()[source]
class PreviousRendering(seed: str, tile_size: Tuple[float, float], tile_resolution: Tuple[float, float], tiles: Dict[str, str] = <factory>, time: float = <factory>, pretty_time: str = <factory>)[source]

Bases: object

Attributes:

DEFAULT_FILE_NAME

Methods:

load(dir)

Load information about previous rendering from file.

save(dir)

Store information about the current rendering.

delete(dir)

Delete directory containing all materials of previous renderings.

DEFAULT_FILE_NAME = 'previous_rendering.yaml'
seed: str
tile_size: Tuple[float, float]
tile_resolution: Tuple[float, float]
tiles: Dict[str, str]
time: float
pretty_time: str
classmethod load(dir: str)simulation.src.simulation_groundtruth.src.groundtruth.renderer.PreviousRendering[source]

Load information about previous rendering from file.

Parameters

dir – Path to directory that contains previous rendering.

save(dir: str)[source]

Store information about the current rendering.

Parameters

dir – Path to directory that contains current rendering.

classmethod delete(dir: str)[source]

Delete directory containing all materials of previous renderings.

Parameters

dir – Path to directory that contains previous rendering.

class Renderer(road: simulation.utils.road.road.Road, remove_model: Callable[[str], NoneType], spawn_model: Callable[[str], NoneType], pause_gazebo: Callable[], NoneType], unpause_gazebo: Callable[], NoneType], info_callback: Callable[[int, int, int], NoneType], tile_size: simulation.utils.geometry.vector.Vector = Vector(2.0, 2.0, 0.0), tile_resolution: simulation.utils.geometry.vector.Vector = Vector(512.0, 512.0, 0.0), force_reload: bool = False)[source]

Bases: object

Attributes:

info_callback

Function that is called, when the renderer’s state changes.

tile_size

tile_resolution

force_reload

roads_path

materials_path

prev_rendering

Methods:

_prev_rendering_available()

_load_prev_tiles()

save_state(tiles)

_create_new_tiles()

_remove_displayed_tiles(model_names)

interrupt()

load(model_names)

road: simulation.utils.road.road.Road
remove_model: Callable[[str], None]
spawn_model: Callable[[str], None]
pause_gazebo: Callable[], None]
unpause_gazebo: Callable[], None]
info_callback: Callable[[int, int, int], None]

Function that is called, when the renderer’s state changes.

tile_size: simulation.utils.geometry.vector.Vector = Vector(2.0, 2.0, 0.0)
tile_resolution: simulation.utils.geometry.vector.Vector = Vector(512.0, 512.0, 0.0)
force_reload: bool = False
property roads_path: str
property materials_path: str
property prev_rendering: simulation.src.simulation_groundtruth.src.groundtruth.renderer.PreviousRendering
_prev_rendering_available()bool[source]
_load_prev_tiles()List[simulation.utils.road.renderer.tile.Tile][source]
save_state(tiles: List[simulation.utils.road.renderer.tile.Tile])[source]
_create_new_tiles()List[simulation.utils.road.renderer.tile.Tile][source]
_remove_displayed_tiles(model_names: List[str])[source]
interrupt()[source]
load(model_names: List[str])[source]

simulation.src.simulation_groundtruth.src.groundtruth.visualization module

Node that publishes groundtruth information for rviz.

Classes:

GroundtruthVisualizationNode()

ROS node to visualize groundtruth objects in RVIZ.

class GroundtruthVisualizationNode[source]

Bases: simulation.utils.ros_base.node_base.NodeBase

ROS node to visualize groundtruth objects in RVIZ.

publishers

Automatically generated dictionary containing all publishers. A publisher is created for every visualization topic listed in the parameter file.

Type

Dict[rospy.Publisher]

get_sections, get_lane, get_parking, get_obstacles, get_intersection

Can be called for groundtruth information.

Type

rospy.ServiceProxy

Methods:

start()

Start the node by creating publishers and service proxies.

stop()

Stop the node by unregistering publishers.

_publish_point_marker(points, …[, ns])

Publish an RVIZ marker on the publisher’s topic.

_update_labeled_polygon_topic(proxy, …)

Publish polygons for all elements.

_show_lane_markers()

Publish markers for all lane markings of road.

_show_parking_markers()

Publish markers for all parking lines and spots of road.

_show_intersection_markers()

Publish lanes and surface markings of all intersections.

update()

Update all markers.

start()[source]

Start the node by creating publishers and service proxies.

stop()[source]

Stop the node by unregistering publishers.

_publish_point_marker(points: List[geometry_msgs.msg._Point32.Point32], publisher_name: str, id: int, rgba: List[float], ns='simulation/groundtruth')[source]

Publish an RVIZ marker on the publisher’s topic.

Parameters
  • points – Points to be published.

  • publisher_name – Key of the publisher in the publisher dictionary.

  • id – RVIZ marker id.

  • rgba – List of the marker color.

  • ns – RVIZ namespace of the marker.

_update_labeled_polygon_topic(proxy: rospy.impl.tcpros_service.ServiceProxy, publisher_name: str, marker_color: Tuple[float, float, float, float])[source]

Publish polygons for all elements.

_show_lane_markers()[source]

Publish markers for all lane markings of road.

_show_parking_markers()[source]

Publish markers for all parking lines and spots of road.

_show_intersection_markers()[source]

Publish lanes and surface markings of all intersections.

update()[source]

Update all markers.

Module contents