I want my robot to first detect the direction and the wait to take decision that whether to go forward or stay stationary.

댓글 수: 4

KSSV
KSSV 2016년 11월 7일
How about using input(prompt) after detecting the direction. Then user has to tell robo what to do?
Jan
Jan 2016년 11월 7일
Fine. So explain, what "a robot" is? A hardware machine or is it a simulation? What does "detecting the direction" mean and on what does the decision about the movement depend on?
In other words: What is your question? How can we assist you?
I am using MATLAB to detect red object using image processing. So, basically what it has to do it detect the red object, so if it is slightly on the right it will first turn the robot right and then after give a pause to see how whether it is in line or not. Then move towards if the distnace b/w bot and object is more than the set reference.
for object = 1:length(stats)
if(object==1) %detect only one major red object
bb = stats(object).BoundingBox;
bc = stats(object).Centroid;
ar=stats(object).Area;
k=29000; %decide this experimentally, i have already explaine the procedure
dist=k/ar;
%if(dist>5) %Change 5 to an experimentally deduced value
% fprintf(s,'F');
% else if(bc(1)<80) %Change 80 to an experimentally deduced value (80 is 1/4 of 320 (screen size))
% fprintf(s,'L');
% else if(bc(1)>240) %Change 240 to an experimentally deduced value (240 is 3/4 of 320 (screen size))
% fprintf(s,'R');
% else
% fprintf(s,'S');
% end
Walter Roberson
Walter Roberson 2016년 11월 7일
So why is pause() not the solution you are looking for? It delays. Is there more that a delay has to do than to delay?

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2016년 11월 7일

1 개 추천

See pause()

카테고리

도움말 센터File Exchange에서 Network Connection and Exploration에 대해 자세히 알아보기

제품

질문:

2016년 11월 7일

댓글:

2016년 11월 7일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by