Get Parent
SUMMARY
get_parent returns the TransformNode that is the parent of the named frame.
The Skill
python
parent = tree.get_parent("camera")The Code
python
"""
Example of TransformTree.get_parent.
"""
from loguru import logger
from telekinesis.tf import tftree
def main():
"""
Get the parent of a frame in the tree.
"""
tree = tftree.TransformTree("world")
tree.add("world", "camera", [0, 0, 1, 0, 0, 0], rot_type="deg")
parent = tree.get_parent("camera")
logger.info(f"Parent of camera: {parent.get_name()}")
if __name__ == "__main__":
main()Parameter Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
node_name | str | required | The name of the frame to look up the parent of. |
Returns
| Type | Description |
|---|---|
TransformNode | None | The parent node, or None if node_name is the tree's root. |
Raises
| Exception | Condition |
|---|---|
TypeError | node_name is not a string. |
ValueError | No frame named node_name exists in the tree. |