フィルターのクリア

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 Center および File ExchangeElementary Math についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by