Update
SUMMARY
update sets a new transform between an existing frame and its parent, given as a 4x4 matrix or a 6/7-element pose.
UNITS
transform's position component is in meters, whether passed as a (4, 4) matrix (rot_type="mat") or a pose list. Rotation is in degrees ("deg"), radians ("rad"), or unitless ("quat").
The Skill
python
tree.update("camera", [0, 0, 1.2, 0, 0, 0], rot_type="deg")Example
Before

The camera frame at its original pose in the tree.
After

The same frame after update sets its new transform to its parent.
The Code
python
"""
Example of TransformTree.update.
"""
from loguru import logger
import time
from telekinesis.tf import tftree
def main():
"""
Update the transform of an existing frame in the tree.
"""
tree = tftree.TransformTree("world")
tree.add("world", "camera", [0, 0, 1, 0, 0, 0], rot_type="deg")
tree.visualize_rerun()
logger.info(f"camera pose before update: {tree.lookup_transform('world', 'camera', rot_type='deg')}")
time.sleep(3)
tree.update("camera", [-0.5, -0.5, 1.5, 0, 0, 0], rot_type="deg")
tree.visualize_rerun()
logger.info(f"camera pose after update: {tree.lookup_transform('world', 'camera', rot_type='deg')}")
if __name__ == "__main__":
main()Parameter Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
source_name | str | required | The name of the frame whose transform to its parent is updated. |
transform | np.ndarray | list | required | The new transform to the frame's parent: a (4, 4) matrix, or a 6-element (deg/rad) or 7-element (quat) pose. |
rot_type | str | "deg" | One of "deg", "rad", "quat", "mat". Note this default differs from add's, which defaults to "mat". |
Raises
| Exception | Condition |
|---|---|
TypeError | source_name is not a string. |
ValueError | transform is not a (4, 4) np.ndarray or a 6/7-element list. |
ValueError | rot_type is not one of "deg", "rad", "quat", "mat". |
ValueError | No frame named source_name exists in the tree. |