robokudo.utils.knowledge

Object knowledge utilities for Robokudo.

This module provides utility functions for working with object knowledge bases and transforming object representations. It supports:

  • Transform matrix generation from object knowledge

  • Bounding box calculations

  • Object knowledge base loading

  • Oriented bounding box generation for objects and their parts

The module integrates with: * Open3D for geometric operations * NumPy for numerical computations * Object knowledge base system

Functions

get_quaternion_from_rotation_information(...)

Return a quaternion based on the rotation in ObjectKnowledge, and its type of rotation.

get_transform_matrix_from_object_knowledge(...)

Extract transform matrix from object knowledge.

get_bb_size_from_object_knowledge(→ numpy.typing.NDArray)

Extract bounding box dimensions from object knowledge.

load_object_knowledge_base(...)

Load object knowledge base from annotator parameters.

get_obb_for_object_and_transform(...)

Get an OBB only for THIS object and not any descendants.

get_obb_for_child_object_and_transform(...)

Create oriented bounding box for child object.

get_obbs_for_object_and_childs(...)

Create oriented bounding boxes for object and all children.

Module Contents

robokudo.utils.knowledge.get_quaternion_from_rotation_information(ok: robokudo.object_knowledge_base.ObjectKnowledge) typing_extensions.Tuple[float, float, float, float]

Return a quaternion based on the rotation in ObjectKnowledge, and its type of rotation. If the pose type is EULER, then it will be converted to Quaternion beforehand.

Parameters:

ok – Object knowledge containing pose information

Returns:

[x, y, z, w] rotation quaternion

robokudo.utils.knowledge.get_transform_matrix_from_object_knowledge(ok: robokudo.object_knowledge_base.ObjectKnowledge) numpy.typing.NDArray

Extract transform matrix from object knowledge.

Creates a 4x4 transformation matrix from the object’s position and orientation.

Parameters:

ok – Object knowledge containing pose information

Returns:

4x4 transformation matrix

robokudo.utils.knowledge.get_bb_size_from_object_knowledge(ok: robokudo.object_knowledge_base.ObjectKnowledge) numpy.typing.NDArray

Extract bounding box dimensions from object knowledge.

Parameters:

ok – Object knowledge containing size information

Returns:

Array of [x_size, y_size, z_size]

robokudo.utils.knowledge.load_object_knowledge_base(annotator: robokudo.annotators.core.BaseAnnotator) robokudo.object_knowledge_base.BaseObjectKnowledgeBase

Load object knowledge base from annotator parameters.

Parameters:

annotator – Annotator containing knowledge base parameters

Returns:

Loaded object knowledge base

robokudo.utils.knowledge.get_obb_for_object_and_transform(object_knowledge: robokudo.object_knowledge_base.ObjectKnowledge, transform_matrix: numpy.typing.NDArray) open3d.geometry.OrientedBoundingBox

Get an OBB only for THIS object and not any descendants.

Parameters:
  • object_knowledge

  • transform_matrix – Transformation matrix describing the position of the object. This is usually used for objects that have been perceived and do not have fixed Position/Orientation information.

Returns:

A OrientedBoundingbox

robokudo.utils.knowledge.get_obb_for_child_object_and_transform(object_knowledge: robokudo.object_knowledge_base.ObjectKnowledge, parent_transform: numpy.typing.NDArray) open3d.geometry.OrientedBoundingBox

Create oriented bounding box for child object.

Creates an oriented bounding box for a child object by combining its local transform with the parent’s transform.

Parameters:
  • object_knowledge – Knowledge about the child object

  • parent_transform – 4x4 transformation matrix of parent object

Returns:

Oriented bounding box for child object

robokudo.utils.knowledge.get_obbs_for_object_and_childs(object_knowledge: robokudo.object_knowledge_base.ObjectKnowledge, transform_matrix: numpy.typing.NDArray) typing_extensions.Dict[str, open3d.geometry.OrientedBoundingBox]

Create oriented bounding boxes for object and all children.

Creates oriented bounding boxes for: * Main object * Component parts * Feature parts

Parameters:
  • object_knowledge – Knowledge about main object and its parts

  • transform_matrix – 4x4 transformation matrix for main object

Returns:

Dictionary mapping object names to bounding boxes