%% Run Loop At Fixed Rate Using ROS Time
% Initialize the ROS master and node.

rosinit
node = robotics.ros.Node('/testTime');

%
% Create a ros.Rate object running at 20 Hz.

r = robotics.ros.Rate(node,20);

%
% Reset the object to restart the timer and run the loop for 30 iterations. Insert code you want to run in the loop before calling waitfor.

reset(r)
for i = 1:30
	% User code goes here.
	waitfor(r);
end

%
% Shut down ROS node.

rosshutdown

% Copyright 2019 The MathWorks, Inc.
%