pycram.ros_utils.marker_publisher_base#
Classes#
Base class for publishing visualization markers of specific data in ROS/RViz. |
Module Contents#
- class pycram.ros_utils.marker_publisher_base.MarkerPublisherBase#
Bases:
abc.ABCBase class for publishing visualization markers of specific data in ROS/RViz.
This class provides common utilities for creating and publishing various types of markers, such as arrows, cubes, lines, and geometry-based visualizations. Subclasses must implement the visualize method to define how their specific data is converted into Marker objects.
- topic: str#
The name of the topic to publish to
- property publisher: rclpy.publisher.Publisher#
Create a publisher that publishes data to topic.
returns: The created publisher.
- abstract visualize(data: object) None#
Subclasses must implement this to create and publish a MarkerArray
- _create_arrow_marker(p1: geometry_msgs.msg.Point, p2: geometry_msgs.msg.Point, index: int, frame_id: str, color: List | None = (1.0, 0.0, 1.0, 1.0), scale: List | None = (0.01, 0.02, 0.02), duration: int | None = 60) visualization_msgs.msg.Marker#
Create an arrow marker.
- Parameters:
p1 – first point of the arrow
p2 – second point of the arrow
index – index of the created arrow
frame_id – frame id of the created arrow marker
color – color of the created arrow marker
scale – scale of the created arrow marker
duration – duration of visualizing the arrow
returns: The created arrow marker.
- _create_cube_marker(box: pycram.datastructures.dataclasses.BoundingBox, index: int, duration: int | None = 60) visualization_msgs.msg.Marker#
Create a cube marker.
- Parameters:
box – the bounding box the cube marker should be drawn on
index – index of the created cube
duration – duration of visualizing the cube marker
returns: The created cube marker.
- _create_line_marker(pose: pycram.datastructures.pose.PoseStamped, axis: List[float], color_rgba: List[float], index: int, duration: int | None = 60, length: float | None = 0.1, width: float | None = 0.02) visualization_msgs.msg.Marker#
Create a line marker.
- Parameters:
pose – the pose of the line
axis – the given axis
color_rgba – the color of the created line marker
index – id of the created line marker
duration – duration of visualizing the line marker
length – length of the axis
width – width of the axis
returns: The created line marker.
- _create_geometry_marker(geom: pycram.datastructures.dataclasses.MeshVisualShape | pycram.datastructures.dataclasses.CylinderVisualShape | pycram.datastructures.dataclasses.BoxVisualShape | pycram.datastructures.dataclasses.SphereVisualShape, obj: semantic_digital_twin.world_description.world_entity.Body, link: str, i: int, link_pose_with_origin: pycram.datastructures.pose.TransformStamped, reference_frame: str, use_prospection_world: bool | None = False) visualization_msgs.msg.Marker#
Creates a Marker for the given geometry type.
- Parameters:
geom – the geometry to create the marker for
obj – the object to create the marker for
link – the link to create the marker for
i – the id of the created marker
link_pose_with_origin – the pose of the link
reference_frame – the reference frame of the link
use_prospection_world – uif prospection world is used or not
returns: the created marker.
- _create_object_marker(pose: pycram.datastructures.pose.PoseStamped, name: str, path: str, current_id: int) visualization_msgs.msg.Marker#
Create a marker for an object.
- Parameters:
pose – the pose of the object
name – the name of the object
path – the path of the object
current_id – the id of the current object
returns: The created marker.