simulation.src.simulation_groundtruth.src.groundtruth package¶
Subpackages¶
Submodules¶
simulation.src.simulation_groundtruth.src.groundtruth.groundtruth module¶
Functions:
|
Create a lane message from three lines. |
Classes:
|
Container for information about an intersection. |
|
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:
Lane markings on the right side when coming from south.
Lane markings straight ahead when coming from south.
Priority rule.
Lane markings approaching the intersection.
Direction the road follows.
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:
Store the current road.
Methods:
Section message for all sections.
get_lane_msg
(id)Lane message for requested road section.
Intersection tuple for requested road section.
get_parking_msg
(id)Parking message for the left and right side of the requested road section.
Labeled polygon msg for each obstacle in the requested road section.
Labeled polygon msg for each surface marking in the requested road section.
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
simulation.src.simulation_groundtruth.src.groundtruth.node module¶
Classes:
|
Small wrapper class to easily create ROS services that offer LabeledPolygonMsgs. |
|
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]]¶
- 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
- object_controller¶
Create and track objects (e.g. obstacles, signs) in Gazebo.
- Type
- 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 sections from current road.
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.
Request to start Gazebo.
Receive requests to reload the world.
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!
- 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.
- _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.
simulation.src.simulation_groundtruth.src.groundtruth.object_controller module¶
Classes:
|
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:
Methods:
load
(model_names)Reload all objects.
update
(car_state)Update the object controller.
- 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]¶
simulation.src.simulation_groundtruth.src.groundtruth.renderer module¶
Functions:
Classes:
|
|
|
- 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:
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.
- 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:
Function that is called, when the renderer’s state changes.
Methods:
save_state
(tiles)_remove_displayed_tiles
(model_names)load
(model_names)- 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¶
- _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]¶
simulation.src.simulation_groundtruth.src.groundtruth.visualization module¶
Node that publishes groundtruth information for rviz.
Classes:
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.
Publish markers for all lane markings of road.
Publish markers for all parking lines and spots of road.
Publish lanes and surface markings of all intersections.
update
()Update all markers.
- _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.