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(→ list)

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(→ Dict[str, ...)

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) list

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

Returns:

4-dim list with 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 (robokudo.object_knowledge_base.ObjectKnowledge) – Object knowledge containing pose information

Returns:

4x4 transformation matrix

Return type:

npt.NDArray

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 (robokudo.object_knowledge_base.ObjectKnowledge) – Object knowledge containing size information

Returns:

Array of [x_size, y_size, z_size]

Return type:

npt.NDArray

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 (robokudo.annotators.core.BaseAnnotator) – Annotator containing knowledge base parameters

Returns:

Loaded object knowledge base

Return type:

robokudo.object_knowledge_base.BaseObjectKnowledgeBase

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

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

Parameters:
  • object_knowledge (robokudo.object_knowledge_base.ObjectKnowledge) –

  • transform (npt.NDArray) – 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

Return type:

o3d.geometry.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:
Returns:

Oriented bounding box for child object

Return type:

o3d.geometry.OrientedBoundingBox

robokudo.utils.knowledge.get_obbs_for_object_and_childs(object_knowledge: robokudo.object_knowledge_base.ObjectKnowledge, transform: numpy.typing.NDArray) 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:
Returns:

Dictionary mapping object names to bounding boxes

Return type:

Dict[str, o3d.geometry.OrientedBoundingBox]