%% Apply A Transformation To A Point
% Connect to a ROS network to get a TransformStamped ROS message. Specify the IP address to connect. Create a transformation tree and get the transformation between desired frames.

rosinit('192.168.17.129')
tftree = rostf;
pause(1);
tform = getTransform(tftree,'base_link','camera_link',...
                     rostime('now'),'Timeout',5);

%
% Create a ROS Point message and apply the transformation. You could also get point messages off the ROS network.

pt = rosmessage('geometry_msgs/PointStamped');
pt.Header.FrameId = 'camera_link';
pt.Point.X = 3;
pt.Point.Y = 1.5;
pt.Point.Z = 0.2;

tfpt = apply(tform,pt);

%
% Shut down ROS network.

rosshutdown

% Copyright 2019 The MathWorks, Inc.