How to calculate time elapsed during some continous code?
古いコメントを表示
I am applying some odometry discrete equations and i want to calculate time difference between the two steps. I am trying to use etime but it does not work. Here is part of my code
rob=setParam(); % Robot Parameters previousTime=clock;
%% Running Loop while(true)
if count==1
% for Inital conditions
posX(count)=0;
posY(count)=0;
heading(count)=0;
end
rpmLeftWheel=readSpeed(encoderLeft);
rpmRightWheel=readSpeed(encoderRight);
currentTime=clock;
dt=etime(currentTime,previousTime);
[posX,posY,heading]= computeOdometry(rpmLeftWheel,rpmRightWheel,dt,count,rob);
previousTime=currentTime;
count=count+1
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Robotics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!