Main Content

canTransform

Verify if transformation is available

Since R2023a

Description

isAvailable = canTransform(tftree,targetframe,sourceframe) verifies if a transformation that takes coordinates in the sourceframe into the corresponding coordinates in the targetframe is available. isAvailable is true if that transformation is available and false if that transformation is not available. Use getTransform to retrieve the transformation.

isAvailable = canTransform(tftree,targetframe,sourceframe,sourcetime) verifies that the transformation is available for the time sourcetime. If sourcetime is outside of the buffer window for the transformation tree, the function returns false. Use getTransform with the sourcetime argument to retrieve the transformation.

Input Arguments

collapse all

ROS 2 transformation tree, specified as ros2tf object handle. You can create a ROS 2 transformation tree by using the ros2tf object.

Target coordinate frame, specified as a string scalar or character vector. You can view the available frames for transformation by calling tftree.AvailableFrames.

Initial coordinate frame, specified as a string scalar or character vector. You can view the available frames for transformation using tftree.AvailableFrames.

ROS 2 or system time, specified as a scalar or structure that resembles ros2time. The scalar input is converted into structure using ros2time. By default, the sourcetime returns the system time. If you set the use_sim_time ROS 2 parameter to true, the sourcetime returns the ROS 2 simulation time published on the /clock topic.

Data Types: struct | scalar

Output Arguments

collapse all

Transformation verification entity, returned as boolean. It verifies if a transformation is available between the sourceframe and targetframe.

The function returns "false" if:

  • sourcetime is outside the buffer window for a tftree object.

  • sourcetime is in the future.

  • The transformation is not published yet.

Extended Capabilities

Version History

Introduced in R2023a