%% Run Loop At Fixed Rate and Reset Rate Object
% Create a Rate object for running at 20 Hz.

r = robotics.Rate(2);

%
% Start a loop and control operation using the Rate object.

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

%
% Display the Rate object properties after loop operation.

disp(r)

%
% Reset the object to restart the time statistics.

reset(r);
disp(r)

% Copyright 2012 The MathWorks, Inc.