Main Content

transformTree

Define coordinate frames and relative transformations

Since R2022a

Description

The transformTree object contains an organized tree structure for coordinate frames and their relative transformations over time. The object stores the relative transformations between children frames and their parents. You can specify a timestamped transform for frames and query the relative transformations between different frames in the tree. The object interpolates intermediate timestamps using a constant velocity assumption for linear motion, and spherical linear interpolation (SLERP) for angular motion. Otherwise, the relative transformations are kept constant past the range of the timestamps specified. Times prior to the first timestamp return NaN.

Use the updateTransform function to add timestamps to the tree by defining the parent-to-child relationships. Query specific transformations at given timestamps using getTransform and display the frame relationships using show.

Creation

Description

frames = transformTree creates a transformation tree data structure with a single frame, "root", with the maximum number of frames and timestamped transforms per frame, set to 10.

frames = transformTree(rootName) specifies the name of the root frame.

frames = transformTree(rootName,maxNumFrames) additionally sets the MaxNumFrames property, which defines the max number of named frames in the object.

frames = transformTree(rootName,maxNumFrames,maxNumTransforms) additionally sets the MaxNumTransforms property, which defines the max number of timestamped transforms per frame name.

frames = transformTree(rootName,numFrames,numTransforms,rootTime) additionally specifies the timestamp of the root frame.

Input Arguments

expand all

Name of the root frame, specified as a string scalar or character vector.

Data Types: char | string

Maximum number of named frames that the transform tree can contain, specified as a positive integer.

This argument sets the MaxNumFrames property.

Maximum number of time stamped transforms per frame, specified as a positive integer.

This argument sets the MaxNumTransforms property.

Time stamp of the root frame, specified as a nonnegative numeric scalar in seconds.

Properties

expand all

This property is read-only after construction. To set this property, use the maxNumFrames argument during object creation.

Maximum number of frames in the tree, stored as a positive integer. Each frame has associated timestamped transforms that define the state of the frame at those specific times.

Data Types: double

This property is read-only after construction. To set this property, use the maxNumTransforms argument during object creation.

Maximum number of timestamped transforms per frame, stored as a positive integer. This property sets an upper limit on the number of timestamped transforms the object can store for each frame named in the structure. A transformTree object with MaxNumFrames and MaxNumTransforms set to 10 can store a maximum of 100 transformations with 10 for each frame.

Data Types: double

This property is read-only.

Current number of coordinate frames stored, stored as a positive integer. The object starts with a single root frame, and new frames and specific timestamps are added using updateTransform function.

Data Types: double

Object Functions

copyCopy transform tree
getGraphGraph object representing tree structure
getTransformGet relative transform between frames
infoList all frame names and stored timestamps
removeTransformRemove frame transform relative to its parent
showShow transform tree
updateTransformUpdate frame transform relative to its parent

Version History

Introduced in R2022a