Out of memory. The likely cause is an infinite recursion within the program.
1 次查看(过去 30 天)
显示 更早的评论
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));
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!