7.18.1. visualizer.PoseEstimationVisualizerRos

class visualizer.PoseEstimationVisualizerRos(*args: Any, **kwargs: Any)

Bases: PoseEstimationVisualizer

__init__(topic, image_width, image_height, intrinsics_matrix, model_dir, expose_service=False, service_name=None)

Renders the pose estimation results of the object detector into an image and publishes it

Renders model-contours and the corresponding modelnames of the detected objects into the given image and publishes the result

Parameters:
  • topic (str) – ROS Topic to publish the rendered image to

  • image_width (int) – width of input image and rendered image

  • image_height (int) – height of input image and rendered image

  • intrinsics_matrix (list or numpy array) – flattened [9x1] camera matrix, e.g. [fx, 0, cx, 0, fy, cy, 0, 0, 1]

  • expose_service (bool) – whether to expose a service which can be used to trigger the visualization

  • service_name (str) – name of the service that should be exposed, only needed if expose_service is True

Methods

__init__(topic, image_width, image_height, ...)

Renders the pose estimation results of the object detector into an image and publishes it

load_meshes(model_dir)

Load .stl meshes from the given directory and return them as a dictionary

publish_pose_estimation_result(ros_image, ...)

Renders contours of models and modelnames into an image and publishes the result

service_callback(req)

Service callback for the pose estimation visualization service.

load_meshes(model_dir)

Load .stl meshes from the given directory and return them as a dictionary

Parameters:

model_dir (str) – The directory containing the .stl meshes that should be loaded

Returns:

A dictionary containing the loaded meshes with the model name as the key. The models are scaled to meters. The names are the filenames without the .stl extension.

Return type:

dict

publish_pose_estimation_result(ros_image, ros_model_poses, model_meshes, model_names)

Renders contours of models and modelnames into an image and publishes the result

Parameters:
  • ros_image (sensor_msgs.msg.Image) – The input image to render the model contours into

  • ros_model_poses (list of geometry_msgs.msg.Pose) – The poses of the models in the camera frame

  • model_meshes (list of open3d.geometry.TriangleMesh) – The meshes of the models to render, scaled to meters

  • model_name (list of str) – names of the models

service_callback(req)

Service callback for the pose estimation visualization service.

Renders the contours of the objects based on the given poses into the passed image. Additionally, the model names are rendered next to the contours.

Parameters:

req (object_detector_msgs.srv.VisualizePoseEstimationRequest) – The request containing: the rgb_image, a list of model_poses and a list of model_names

Returns:

Empty response

Return type:

object_detector_msgs.srv.VisualizePoseEstimationResponse