clear;clc;close all;
%杆长参数设置
L1=160;L2=449.5;L3=580;L4=200;L5=640;L6=228;
% theta(z) d(z) a(x) alpha(x)
RL1=Link([ 0 L2 0 0 ],'modified');
RL2=Link([ 0 0 L1 -pi/2 ],'modified');RL2.offset=-pi/2;
RL3=Link([ 0 0 L3 0 ],'modified');
RL4=Link([ 0 L5 L4 -pi/2 ],'modified');
RL5=Link([ 0 0 0 pi/2 ],'modified');
RL6=Link([ 0 L6 0 -pi/2 ],'modified');
Robot_6=SerialLink([RL1,RL2,RL3,RL4,RL5,RL6],'name','Robot');
Robot_6.teach;
L1=160;L2=449.5;L3=580;L4=200;L5=640;L6=228;
RL1=Link('revolute','d',L2,'a',0,'alpha',0,'modified');
RL2=Link('revolute','d',0,'a',L1,'alpha',-pi/2,'modified');RL2.offset=-pi/2;
RL3=Link('revolute','d',0,'a',L3,'alpha',0,'modified');
RL4=Link('revolute','d',L5,'a',L4,'alpha',-pi/2,'modified');
RL5=Link('revolute','d',0,'a',0,'alpha',pi/2,'modified');
RL6=Link('revolute','d',L6,'a',0,'alpha',-pi/2,'modified');
Robot_6=SerialLink([RL1,RL2,RL3,RL4,RL5,RL6],'name','Robot');
Robot_6.teach;
L1=160;L2=449.5;L3=580;L4=200;L5=640;L6=228;
w1=0;w2=0;w3=0;w4=0;w5=0;w6=0;
%Tz(L2)*Rz
T01=[1 0 0 0;0 1 0 0;0 0 1 L2;0 0 0 1]*...
[cos(w1) -sin(w1) 0 0;sin(w1) cos(w1) 0 0;0 0 1 0;0 0 0 1];
%Rx(-pi/2)*Tx(L1)*Rz(-pi/2)*Rz
T12=[1 0 0 0;0 cos(-pi/2) -sin(-pi/2) 0;0 sin(-pi/2) cos(-pi/2) 0;0 0 0 1]*...
[1 0 0 L1;0 1 0 0;0 0 1 0;0 0 0 1]*...
[cos(-pi/2) -sin(-pi/2) 0 0;sin(-pi/2) cos(-pi/2) 0 0;0 0 1 0;0 0 0 1]*...
[cos(w2) -sin(w2) 0 0;sin(w2) cos(w2) 0 0;0 0 1 0;0 0 0 1];
%Tx(L3)*Rz
T23=[1 0 0 L3;0 1 0 0;0 0 1 0;0 0 0 1]*...
[cos(w3) -sin(w3) 0 0;sin(w3) cos(w3) 0 0;0 0 1 0;0 0 0 1];
%Rx(-pi/2)*Tx(L4)*Tz(L5)*Rz
T34=[1 0 0 0;0 cos(-pi/2) -sin(-pi/2) 0;0 sin(-pi/2) cos(-pi/2) 0;0 0 0 1]*...
[1 0 0 L4;0 1 0 0;0 0 1 L5;0 0 0 1]*...
[cos(w4) -sin(w4) 0 0;sin(w4) cos(w4) 0 0;0 0 1 0;0 0 0 1];
%Rx(pi/2)*Rz
T45=[1 0 0 0;0 cos(pi/2) -sin(pi/2) 0;0 sin(pi/2) cos(pi/2) 0;0 0 0 1]*...
[cos(w5) -sin(w5) 0 0;sin(w5) cos(w5) 0 0;0 0 1 0;0 0 0 1];
%Rx(-pi/2)*Tz(L6)*Rz
T56=[1 0 0 0;0 cos(-pi/2) -sin(-pi/2) 0;0 sin(-pi/2) cos(-pi/2) 0;0 0 0 1]*...
[1 0 0 0;0 1 0 0;0 0 1 L6;0 0 0 1]*...
[cos(w6) -sin(w6) 0 0;sin(w6) cos(w6) 0 0;0 0 1 0;0 0 0 1];
T06=T01*T12*T23*T34*T45*T56
运行结果:
T06 =
1.0e+03 *
0.0000 0.0000 0.0010 1.0280
-0.0000 -0.0010 0.0000 0.0000
0.0010 -0.0000 -0.0000 1.2295
0 0 0 0.0010