필터 지우기
필터 지우기

Out of memory. The likely cause is an infinite recursion within the program.

조회 수: 1 (최근 30일)
sudheer yadav
sudheer yadav 2021년 3월 23일
편집: Rik 2021년 3월 23일
trans(1,0.5,45,-74)
function T = trans( a, d,alpha, theta)
T =[cosd(theta) -(sind(theta)) 0 a;
sind(theta)*cosd(alpha) cosd(theta)*cosd(alpha) -sind(alpha) -d*sind(alpha);
sind(theta)*sind(alpha) sind(alpha)*cosd(theta) cosd(alpha) d*cosd(alpha);
0 0 0 1 ];
theta = [-45 -45 0 90 0 -45 0; %first set of joint angles
10 20 30 40 50 60 70]; %second set of joint angles
%Transformation matrices from one joint to other using DH parameters
T0_1= trans(0 ,0 ,0.28135 ,theta(1,1));
T1_2= trans(0.125 ,-90 ,0 ,theta(1,2)+90);
T2_3= trans(0 ,90 ,0.36435 ,theta(1,3));
T3_4= trans(0.069 ,-90 ,0 ,theta(1,4));
T4_5= trans(0 ,90 ,0.37429 ,theta(1,5));
T5_6= trans(0.010 ,-90 ,0 ,theta(1,6));
T6_7= trans(0 ,90 ,0.229525 ,theta(1,7));
end
Im getting below error:
Out of memory. The likely cause is an infinite recursion within the program.
Error in Romat>trans (line 12)
T0_1= trans(0 ,0 ,0.28135 ,theta(1,1));

답변 (1개)

Rik
Rik 2021년 3월 23일
편집: Rik 2021년 3월 23일
Inside the function trans you are calling the function trans. Without any logic to stop this, this will result in an infinite loop.
If you explain what you are trying to achieve, we might be able to suggest a solution.
My guess is that you mean this:
theta = [-45 -45 0 90 0 -45 0; %first set of joint angles
10 20 30 40 50 60 70]; %second set of joint angles
%Transformation matrices from one joint to other using DH parameters
T0_1= trans(0 ,0 ,0.28135 ,theta(1,1));
T1_2= trans(0.125 ,-90 ,0 ,theta(1,2)+90);
T2_3= trans(0 ,90 ,0.36435 ,theta(1,3));
T3_4= trans(0.069 ,-90 ,0 ,theta(1,4));
T4_5= trans(0 ,90 ,0.37429 ,theta(1,5));
T5_6= trans(0.010 ,-90 ,0 ,theta(1,6));
T6_7= trans(0 ,90 ,0.229525 ,theta(1,7));
function T = trans( a, d,alpha, theta)
T =[cosd(theta) -(sind(theta)) 0 a;
sind(theta)*cosd(alpha) cosd(theta)*cosd(alpha) -sind(alpha) -d*sind(alpha);
sind(theta)*sind(alpha) sind(alpha)*cosd(theta) cosd(alpha) d*cosd(alpha);
0 0 0 1 ];
end
You should not rely on numbered variables. Use arrays instead.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by