pycram.ros_utils.viz_marker_publisher#

Classes#

VizMarkerPublisher

Publishes an Array of visualization marker which represent the situation in the World

ManualMarkerPublisher

Class to manually add and remove marker of objects and poses.

TrajectoryPublisher

Publishes a trajectory as a MarkerArray to visualize it in rviz.

Module Contents#

class pycram.ros_utils.viz_marker_publisher.VizMarkerPublisher(topic_name='/pycram/viz_marker', interval=0.1, reference_frame='map', use_prospection_world=False, publish_visuals=False)#

Publishes an Array of visualization marker which represent the situation in the World

use_prospection_world = False#
interval = 0.1#
reference_frame = 'map'#
pub#
thread#
kill_event#
publish_visuals = False#
lock#
_publish() None#

Constantly publishes the Marker Array. To the given topic name at a fixed rate.

_make_marker_array() visualization_msgs.msg.MarkerArray#

Creates the Marker Array to be published. There is one Marker for link for each object in the Array, each Object creates a name space in the visualization Marker. The type of Visualization Marker is decided by the collision tag of the URDF.

Returns:

An Array of Visualization Marker

_stop_publishing() None#

Stops the publishing of the Visualization Marker update by setting the kill event and collecting the thread.

class pycram.ros_utils.viz_marker_publisher.ManualMarkerPublisher(topic_name: str = '/pycram/manual_marker', interval: float = 0.1)#

Class to manually add and remove marker of objects and poses.

start_time = None#
marker_array_pub#
marker_array#
marker_overview#
current_id = 0#
interval = 0.1#
log_message = None#
publish(pose: pycram.datastructures.pose.PoseStamped, color: List | None = None, bw_object: pycram.designator.ObjectDesignatorDescription | None = None, name: str | None = None)#

Publish a pose or an object into the MarkerArray. Priorities to add an object if possible

Parameters:
  • pose – Pose of the marker

  • color – Color of the marker if no object is given

  • bw_object – Object to add as a marker

  • name – Name of the marker

_publish(pose: pycram.datastructures.pose.PoseStamped, bw_object: pycram.designator.ObjectDesignatorDescription | None = None, name: str | None = None, color: List | None = None)#

Publish the marker into the MarkerArray

_publish_pose(name: str, pose: pycram.datastructures.pose.PoseStamped, color: List | None = None)#

Publish a Pose as a marker

Parameters:
  • name – Name of the marker

  • pose – Pose of the marker

  • color – Color of the marker

_publish_object(name: str | None, pose: pycram.datastructures.pose.PoseStamped, bw_object: pycram.designator.ObjectDesignatorDescription)#

Publish an Object as a marker

Parameters:
  • name – Name of the marker

  • pose – Pose of the marker

  • bw_object – ObjectDesignatorDescription for the marker

_make_marker_array(name, marker_type: int, marker_pose: pycram.datastructures.pose.PoseStamped, marker_scales: Tuple = (1.0, 1.0, 1.0), color_rgba: std_msgs.msg.ColorRGBA = ColorRGBA(None=dict(zip(['r', 'g', 'b', 'a'], [1.0, 1.0, 1.0, 1.0]))), path_to_resource: str | None = None)#

Create a Marker and add it to the MarkerArray

Parameters:
  • name – Name of the Marker

  • marker_type – Type of the marker to create

  • marker_pose – Pose of the marker

  • marker_scales – individual scaling of the markers axes

  • color_rgba – Color of the marker as RGBA

  • path_to_resource – Path to the resource of a Bulletworld object

_update_marker(marker_id: int, new_pose: pycram.datastructures.pose.PoseStamped) bool#

Update an existing marker to a new pose

Parameters:
  • marker_id – id of the marker that should be updated

  • new_pose – Pose where the updated marker is set

Returns:

True if update was successful, False otherwise

remove_marker(bw_object: pycram.designator.ObjectDesignatorDescription | None = None, name: str | None = None)#

Remove a marker by object or name

Parameters:
  • bw_object – Object which marker should be removed

  • name – Name of object that should be removed

clear_all_marker()#

Clear all existing markers

class pycram.ros_utils.viz_marker_publisher.TrajectoryPublisher#

Publishes a trajectory as a MarkerArray to visualize it in rviz.

property publisher#
visualize_trajectory(trajectory: List[pycram.datastructures.pose.PoseStamped])#

Visualize a trajectory in rviz as a series of arrows.

Parameters:

trajectory – The trajectory to visualize as a list of points where an arrow should be drawn

from point to point.