robokudo.utils.type_conversion

Type conversion utilities for Robokudo.

This module provides functions for converting between different type representations:

  • ROS message types to Python dictionaries

  • Robokudo annotations to ROS geometry messages

  • Pose and position annotations to transform matrices

The module supports bidirectional conversion between: * ROS CameraInfo messages * Geometry messages (Pose, PoseStamped) * Robokudo annotation types * Transform matrices

Functions

ros_cam_info_to_dict(→ dict)

Convert ROS CameraInfo message to dictionary.

ros_cam_info_from_dict(→ sensor_msgs.msg.CameraInfo)

Convert dictionary to ROS CameraInfo message.

get_geometry_msgs_pose_from_position_annotation(...)

Convert position annotation to ROS Pose message.

get_geometry_msgs_pose_from_pose_annotation(...)

Convert pose annotation to ROS Pose message.

get_geometry_msgs_pose_stamped_from_pose_annotation(...)

Convert pose annotation to ROS PoseStamped message.

get_geometry_msgs_pose_stamped_from_position_annotation(...)

Convert position annotation to ROS PoseStamped message.

get_transform_matrix_from_pose_annotation(→ numpy.ndarray)

Convert pose annotation to 4x4 transform matrix.

get_o3d_obb_from_bounding_box_annotation(...)

Module Contents

robokudo.utils.type_conversion.ros_cam_info_to_dict(cam_info: sensor_msgs.msg.CameraInfo) dict

Convert ROS CameraInfo message to dictionary.

Parameters:

cam_info (sensor_msgs.CameraInfo) – ROS CameraInfo message

Returns:

Dictionary representation of camera info

Return type:

dict

robokudo.utils.type_conversion.ros_cam_info_from_dict(dict_cam_info: dict) sensor_msgs.msg.CameraInfo

Convert dictionary to ROS CameraInfo message.

Parameters:

dict_cam_info (dict) – Dictionary containing camera info

Returns:

ROS CameraInfo message

Return type:

sensor_msgs.CameraInfo

robokudo.utils.type_conversion.get_geometry_msgs_pose_from_position_annotation(position_annotation: robokudo.types.annotation.PositionAnnotation) geometry_msgs.msg.Pose

Convert position annotation to ROS Pose message.

Creates a Pose with position from annotation and identity quaternion.

Parameters:

position_annotation (robokudo.types.annotation.PositionAnnotation) – Position annotation to convert

Returns:

ROS Pose message

Return type:

geometry_msgs.msg.Pose

robokudo.utils.type_conversion.get_geometry_msgs_pose_from_pose_annotation(pose_annotation: robokudo.types.annotation.PoseAnnotation) geometry_msgs.msg.Pose

Convert pose annotation to ROS Pose message.

Parameters:

pose_annotation (robokudo.types.annotation.PoseAnnotation) – Pose annotation to convert

Returns:

ROS Pose message

Return type:

geometry_msgs.msg.Pose

robokudo.utils.type_conversion.get_geometry_msgs_pose_stamped_from_pose_annotation(pose_annotation: robokudo.types.annotation.PoseAnnotation, header) geometry_msgs.msg.PoseStamped

Convert pose annotation to ROS PoseStamped message.

Parameters:
Returns:

ROS PoseStamped message

Return type:

geometry_msgs.msg.PoseStamped

robokudo.utils.type_conversion.get_geometry_msgs_pose_stamped_from_position_annotation(position_annotation: robokudo.types.annotation.PositionAnnotation, header) geometry_msgs.msg.PoseStamped

Convert position annotation to ROS PoseStamped message.

Creates a PoseStamped with position from annotation and identity quaternion.

Parameters:
Returns:

ROS PoseStamped message

Return type:

geometry_msgs.msg.PoseStamped

robokudo.utils.type_conversion.get_transform_matrix_from_pose_annotation(pose_annotation: robokudo.types.annotation.PoseAnnotation) numpy.ndarray

Convert pose annotation to 4x4 transform matrix.

Parameters:

pose_annotation (robokudo.types.annotation.PoseAnnotation) – Pose annotation to convert

Returns:

4x4 homogeneous transform matrix

Return type:

numpy.ndarray

robokudo.utils.type_conversion.get_o3d_obb_from_bounding_box_annotation(bounding_box_annotation: robokudo.types.annotation.BoundingBox3DAnnotation) open3d.geometry.OrientedBoundingBox