Main Content

getTransform

Get relative transform between frames

Description

tform= getTransform(frames,targetframe,sourceframe)returns the relative transforms that convert points in thesourceFramecoordinate frame to thetargetFrame. By default, this function uses the last timestamp for both frames specified inframes.

tform= getTransform(frames,targetframe,sourceframe,timestamp)returns the relative transforms at the given timestamp. If the given time is not specified in the transform tree,frames, the function performs interpolation using a constant velocity assumption for linear motion, and spherical linear interpolation (SLERP) for angular motion.

Input Arguments

collapse all

Transform tree defining the child-parent frame relationship at given timestamps, specified as atransformTreeobject.

Source frame names specified as a string scalar, character vector, string array, or cell array of character vectors. The source frame is the frame you have coordinates in, and the target frame is the frame you want to convert those coordinates to. Each element of the array corresponds to the same element intargetframeand the length matches then-dimension oftform.

Data Types:char|string|cell

Target frame names specified as a string scalar, character vector, string array, or cell array of character vectors. The source frame is the frame you have coordinates in, and the target frame is the frame you want to convert those coordinates to. Each element of the array corresponds to the same element insourceframeand the length matches then-dimension oftform.

Data Types:char|string|cell

时间查询框架,specified as a scalar or vector of scalars in seconds. For timestamps specified before the first timestamp inframes, the function returnsNaNvalues. For timestamps specified after the last timestamp, the most recent (largest timestamp) transformation is returned.

Output Arguments

collapse all

Transformations that converts points from the source frames to the target frames specified as a 4-by-4 transformation matrix or a 4-by-4-by-nmatrix array. Each matrix in the array corresponds to the same element oftargetframe,sourceframe, andtimestamp.

Version History

Introduced in R2020b