%% Inspect Sample TransformStamped Object
% This example looks at the TransformStamped object to show the underlying structure of a TransformStamped ROS message. After setting up a network and transformations, you can create a transformation tree and get transformations between specific coordinate systems. Using showdetails lets you inspect the information in the transformation. It contains the ChildFrameId, Header, and Transform.
% Start ROS network and setup transformations.

rosinit
exampleHelperROSStartTfPublisher

%
% Create transformation tree and wait for tree to update. Get the transform between the robot base and its camera center.

tftree = rostf;
waitForTransform(tftree,'camera_center','robot_base');
tform = getTransform(tftree,'camera_center','robot_base');

%
% Inspect the TransformStamped object.

showdetails(tform)

%
% Access the Translation vector inside the Transform property.

trans = tform.Transform.Translation

%
% Stop the example transformation publisher.

exampleHelperROSStopTfPublisher

% Shutdown ROS network.

rosshutdown

% Copyright 2019 The MathWorks, Inc.