Main Content

getTransform

Get relative transform between frames

Since R2020b

Description

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

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 a transformTree object.

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 in targetframe and the length matches the n-dimension of tform.

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 in sourceframe and the length matches the n-dimension of tform.

Data Types: char | string | cell

Time for querying the frames, specified as a scalar or vector of scalars in seconds. For timestamps specified before the first timestamp in frames, the function returns NaN values. 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-n matrix array. Each matrix in the array corresponds to the same element of targetframe, sourceframe, and timestamp.

Version History

Introduced in R2020b