Skip to content

Print Hierarchy

SUMMARY

print_hierarchy logs the tree's frames indented by depth, with each frame's parent name, to help debug how a tree is structured.

The Skill

python
tree.print_hierarchy()

Example

A TransformTree's parent/child structure, visualized in Rerun

A robot and camera frame nested under the world root, matching the logged hierarchy.

The Code

python
"""
Example of TransformTree.print_hierarchy.
"""

from loguru import logger

from telekinesis.tf import tftree


def main():
    """
    Log the tree's parent/child structure.
    """
    tree = tftree.TransformTree("world", verbose="DEBUG")
    tree.add("world", "robot", [1, 0, 0, 0, 0, 0], rot_type="deg")
    tree.add("robot", "camera", [0, 0, 0.5, 0, 0, 0], rot_type="deg")

    tree.print_hierarchy()
    tree.visualize_rerun(axis_len=0.5)

if __name__ == "__main__":
    main()

Parameter Configuration

ParameterTypeDefaultDescription
nodeTransformNode | NoneNoneThe node to start from. If None, starts from the tree's root.
levelint0Current indentation depth, used internally by the recursive calls.

Raises

ExceptionCondition
TypeErrornode is provided and is not a TransformNode.