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: Line, middle: Line, right: Line) Lane[source]
Create a lane message from three lines.
- class IntersectionTuple(turn, rule, south, west, east, north)
Bases:
tupleContainer 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')
- 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: Road)[source]
Bases:
objectProvide 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 surface marking in the requested road section.
Labeled polygon msg for each traffic sign in the requested road section.
- get_lane_msg(id: int) Lane[source]
Lane message for requested road section.
- Parameters:
id – section id
- get_intersection_msg(id: int) IntersectionTuple[source]
Intersection tuple for requested road section.
- Parameters:
id – section id
- get_parking_msg(id: int) tuple[Parking, Parking][source]
Parking message for the left and right side of the requested road section.
- Parameters:
id – section id
simulation.src.simulation_groundtruth.src.groundtruth.labeled_polygon_service module
Classes:
|
Small wrapper class to easily create ROS services that offer LabeledPolygonMsgs. |
- class LabeledPolygonService(node: Node, topic: str, callback: Callable[[int], list[LabeledPolygon]])[source]
Bases:
objectSmall wrapper class to easily create ROS services that offer LabeledPolygonMsgs.
Attributes:
Methods:
request(request, response)Answer service request.
shutdown()- node: Node
- topic: str
- callback: Callable[[int], list[LabeledPolygon]]
simulation.src.simulation_groundtruth.src.groundtruth.node module
Data:
Seconds to wait for the gz-sim server before spawning tile models (see |
Classes:
|
ROS node providing services to access the road's groundtruth. |
Functions:
|
Console-script entry point for the groundtruth node. |
- _GAZEBO_STARTUP_DELAY = 2.0
Seconds to wait for the gz-sim server before spawning tile models (see
GroundtruthNode._ensure_gazebo_startup()).
- class GroundtruthNode(name='groundtruth_node')[source]
Bases:
NodeBaseROS node providing services to access the road’s groundtruth.
- groundtruth
Stores road sections and allows to access groundtruth information.
- Type:
- section_srv
ROS service to access section ids and types.
- lane_srv
ROS service to access the lanes of a road section.
- parking_srv
ROS service to access parking spots and other parking information.
- intersection_srv
ROS service to access information of an intersection.
Methods:
Load road sections from current road.
Wait until Gazebo is ready to accept spawned tile models.
start()Called when activating the node.
stop()Turn off.
load()Load the groundtruth including renderer and object controller.
get_sections(request, response)Answer section service request.
get_lanes(request, response)Answer lane service request.
get_parking(request, response)Answer parking service request.
get_intersection(request, response)Answer intersection service request.
receive_model_states(model_states)_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, ...])- _ensure_gazebo_startup()[source]
Wait until Gazebo is ready to accept spawned tile models.
gz-sim Harmonic has no
gazebo_msgs/ModelStatestopic, so the old spawn-a-probe-and-wait-for-it-in-ModelStates handshake cannot be used. The tile models are spawned via theWorldPluginLinktopic, which is processed once the gz-sim server is running; a fixed short delay is sufficient and avoids depending on a topic that never publishes. The world is brought up before this node anyway.
- get_sections(request: SectionSrv_Request, response: SectionSrv_Response) SectionSrv_Response[source]
Answer section service request.
- get_lanes(request: LaneSrv_Request, response: LaneSrv_Response) LaneSrv_Response[source]
Answer lane service request.
- get_parking(request: ParkingSrv_Request, response: ParkingSrv_Response) ParkingSrv_Response[source]
Answer parking service request.
- get_intersection(request: IntersectionSrv_Request, response: IntersectionSrv_Response) IntersectionSrv_Response[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!)
simulation.src.simulation_groundtruth.src.groundtruth.object_controller_node module
Classes:
|
ROS node to place obstacles and other objects (e.g. traffic signs) in Gazebo. |
Functions:
|
Console-script entry point for the object controller node. |
- class ObjectControllerNode(*, name='object_controller_node')[source]
Bases:
NodeBaseROS node to place obstacles and other objects (e.g. traffic signs) in Gazebo.
Attributes:
Methods:
_now()receive_model_states(model_states)receive_car_state(car_state)receive_status(status_msg)Receive requests to reload the world.
receive_mission_mode(mission_mode)Load road sections from current road.
load()Reload all objects.
start()Called when activating the node.
stop()Called when deactivating or shutting down the node.
_set_model_pose(name, pose)_spawn_model(model_xml)Spawn a model in Gazebo.
_remove_model(name)Remove a model from Gazebo.
_load_and_name(*, objects, prefix)_remove_old_objects(model_names)update()Update the object controller.
Labeled polygon msg for each obstacle in the requested road section.
- active: bool = False
- car_state: CarState = gazebo_simulation_msgs.msg.CarState(pose=geometry_msgs.msg.Pose(position=geometry_msgs.msg.Point(x=0.0, y=0.0, z=0.0), orientation=geometry_msgs.msg.Quaternion(x=0.0, y=0.0, z=0.0, w=1.0)), twist=geometry_msgs.msg.Twist(linear=geometry_msgs.msg.Vector3(x=0.0, y=0.0, z=0.0), angular=geometry_msgs.msg.Vector3(x=0.0, y=0.0, z=0.0)), frame=geometry_msgs.msg.Polygon(points=[]), view_cone=geometry_msgs.msg.Polygon(points=[]))
- set_model_pose_publishers: dict = {}
- obstacle_prefix: str = 'obstacle'
- sign_prefix: str = 'sign'
- start_gate: float | None = None
- model_names = None
- _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.
- property obstacles: list[tuple[str, StaticObstacle]]
- property dynamic_obstacles: list[tuple[str, DynamicObstacle]]
- property signs: list[tuple[str, TrafficSign]]
- update()[source]
Update the object controller.
Use this function to move dynamic obstacles around and open the startbox gate.
- Parameters:
car_state – Current car state containing the position of the car.
- get_obstacle_msgs(id: int) list[LabeledPolygon][source]
Labeled polygon msg for each obstacle in the requested road section.
- Parameters:
id – section id
- _parameters: dict
- _publishers: List[Publisher]
- _subscriptions: List[Subscription]
- _clients: List[Client]
- _services: List[Service]
- _timers: List[Timer]
- _guards: List[GuardCondition]
- __waitables: List[Waitable]
- _pre_set_parameters_callbacks: List[Callable[[List[Parameter]], List[Parameter]]]
- _on_set_parameters_callbacks: List[Callable[[List[Parameter]], SetParametersResult]]
- _post_set_parameters_callbacks: List[Callable[[List[Parameter]], None]]
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:
objectAttributes:
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) 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: collections.abc.Callable[[str], None], spawn_model: collections.abc.Callable[[str], None], pause_gazebo: collections.abc.Callable[[], None], unpause_gazebo: collections.abc.Callable[[], None], info_callback: collections.abc.Callable[[int, int, int], None], logger: rclpy.impl.rcutils_logger.RcutilsLogger = None, tile_size: kitcar_utils.geometry.vector.Vector = Vector(2.0, 2.0, 0.0), tile_resolution: kitcar_utils.geometry.vector.Vector = Vector(512.0, 512.0, 0.0), force_reload: bool = False)[source]
Bases:
objectAttributes:
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.
- logger: RcutilsLogger = None
- tile_size: Vector = Vector(2.0, 2.0, 0.0)
- tile_resolution: Vector = Vector(512.0, 512.0, 0.0)
- force_reload: bool = False
- property roads_path: str
- property materials_path: str
- property prev_rendering: PreviousRendering
simulation.src.simulation_groundtruth.src.groundtruth.visualization module
Node that publishes groundtruth information for rviz.
Classes:
ROS node to visualize groundtruth objects in RVIZ. |
Functions:
|
Console-script entry point for the groundtruth visualization node. |
- class GroundtruthVisualizationNode[source]
Bases:
NodeBaseROS 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[str, Publisher]
- get_sections, get_lane, get_parking, get_obstacles, get_intersection
Can be called for groundtruth information.
- Type:
Client
Methods:
start()Start the node by creating publishers and service clients.
stop()Stop the node by destroying publishers.
_call(client, **kwargs)Call a service synchronously and return the response.
_publish_point_marker(points, ...[, ns])Publish an RVIZ marker on the publisher's topic.
_update_labeled_polygon_topic(client, ...)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.
- static _call(client: Client, **kwargs)[source]
Call a service synchronously and return the response.
- _publish_point_marker(points: list[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.