필터 지우기
필터 지우기

How to solve Maximum recursion limit of 500 reached problem

조회 수: 123 (최근 30일)
Jia Zhen
Jia Zhen 2014년 11월 13일
댓글: Walter Roberson 2016년 3월 30일
Dear all, my matlab function is this
function eyescript(func, begin_in, end_in, args, ext)
if func==0
for i=begin_in;
fn=strcat(num2str(i),ext);
fprintf('\nRunning %s\n',fn);
symeye(fn,args(1),args(2),args(3),args(4));
end
else
for i=begin_in;
fn=strcat(num2str(i),ext);
fprintf('\nRunning %s\n',fn);
avgeye(fn,args(1), args(2));
end
end
when i want to call out this function eyescript i keep getting this error
eyescript(0,1,30,[0,0,0,0],'.jpg');
Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N) to
change the limit. Be aware that exceeding your available stack space can crash
MATLAB and/or your computer.
Error in eyescript
What should i do to prevent this error from happening? Thanks in advance.
  댓글 수: 3
bnut-qwerty@mail.ru bnut-qwerty@mail.ru
편집: Walter Roberson 2016년 3월 30일
Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N) to change the limit. Be
aware that exceeding your available stack space can crash MATLAB and/or your computer.
Programme:
puma560;
robot=p560
N=5; % Numero de Iteraciones
z=linspace(0.432,0.482,N); % se mueve 0.05 unidades
x=zeros(1,N);
y=x;
for j=1:N
y(1,j)=-0.15;
x(1,j)=0.452;
end
phi=zeros(1,N);
for k=1:length(z)
phik=phi(k);
T(:,:,k)=[cos(phik) -sin(phik) 0 x(k);
sin(phik) cos(phik) 0 y(k);
0 0 1 z(k);
0 0 0 1];
end
qzz=ikine(robot,T)
plot(robot,qzz)
y=linspace(-0.15,0.05,N); % se mueve 0.20 unidades
x=zeros(1,N);
z=x;
for j=1:N
x(1,j)=0.452;
z(1,j)=0.482;
end
phi=zeros(1,N);
for k=1:length(y)
phik=phi(k);
T(:,:,k)=[cos(phik) -sin(phik) 0 x(k);
sin(phik) cos(phik) 0 y(k);
0 0 1 z(k);
0 0 0 1];
end
qyy=ikine(robot,T)
plot(robot,qyy)
x=linspace(0.452,0.702,N); % se mueve 0.25 unidades
y=zeros(1,N);
z=y;
for j=1:N
y(1,j)=0.05;
z(1,j)=0.482;
end
phi=zeros(1,N);
for k=1:length(x)
phik=phi(k);
T(:,:,k)=[cos(phik) -sin(phik) 0 x(k);
sin(phik) cos(phik) 0 y(k);
0 0 1 z(k);
0 0 0 1];
end
qxx=ikine(robot,T)
plot(robot,qxx)
y=linspace(0.05,-0.05,N); % se mueve 0.10 unidades
x=zeros(1,N);
z=x;
for j=1:N
x(1,j)=0.702;
z(1,j)=0.482;
end
phi=zeros(1,N);
for k=1:length(y)
phik=phi(k);
T(:,:,k)=[cos(phik) -sin(phik) 0 x(k);
sin(phik) cos(phik) 0 y(k);
0 0 1 z(k);
0 0 0 1];
end
qyy=ikine(robot,T)
plot(robot,qyy)
Walter Roberson
Walter Roberson 2016년 3월 30일
You opened a Question about this, so it will be discussed in that Question.

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

채택된 답변

Ken Atwell
Ken Atwell 2014년 11월 14일
A recursion depth of 500 is "absurd", almost surely indicating a problem in the code and not some limitation in MATLAB. The recursion could be in symeye -- does it call itself, or call eyescript? Recursion problems can be tricky to debug. I recommend:
  1. Set breakpoint at the beginning of eyescript and run to it.
  2. Step OVER the calls to MATLAB functions like strcat and fprintf.
  3. Step IN to the call to symeye
  4. Continue this pattern until the program takes an unexpected turn.
PS: I second Adam's comment about your 'for' loop, it is likely not what you intend.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by