Skip to content

Get All Frames

SUMMARY

get_all_frames returns every frame in the tree as a pose relative to a reference_node_name, in the requested rot_type.

UNITS

Each returned pose's position component is in meters. Rotation is in degrees ("deg"), radians ("rad"), or unitless ("quat").

The Skill

python
frames = tree.get_all_frames(reference_node_name="world", rot_type="rad")

Example

Every frame of a TransformTree, visualized in Rerun

A robot and camera frame, each returned as a pose relative to the world frame.

The Code

python
"""
Example of TransformTree.get_all_frames.
"""

from loguru import logger

from telekinesis.tf import tftree


def main():
    """
    Get every frame's pose relative to a reference frame.
    """
    tree = tftree.TransformTree("world")
    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")

    frames = tree.get_all_frames(reference_node_name="world", rot_type="rad")
    logger.info(f"Frames relative to world: {frames}")

    tree.visualize_rerun(axis_len=0.5)

if __name__ == "__main__":
    main()

Parameter Configuration

ParameterTypeDefaultDescription
reference_node_namestrNoneThe frame every returned pose is relative to. Required in practice: the type check runs before the None case, so omitting it raises TypeError rather than defaulting to the tree root.
rot_typestr"rad"One of "deg", "rad", "quat", "mat".

Returns

TypeDescription
dictEvery frame's pose relative to reference_node_name, keyed by frame name.

Raises

ExceptionCondition
TypeErrorreference_node_name is not a string, including when it is left as None.
TypeErrorrot_type is not one of "deg", "rad", "quat", "mat".
ValueErrorNo frame named reference_node_name exists in the tree.