close all; clear;
%leftarm
L(1) = Link([0,0,0.935852,3.1415926536,0]);
L(2) = Link([0,0.660,0,0,1]);
L(3) = Link([0,0.400,0.025,-1.5707963268,0]);
L(4) = Link([0,0.455,0,0,0]);
L(5) = Link([0,0,0,-1.5707963268,0]);
L(6) = Link([0,0.420,0,1.5707963268,0]);
L(7) = Link([0,0,0,-1.5707963268,0]);
L(8) = Link([0,0.080,0,0,0]);
L(1).qlim = [0 pi];
L(2).qlim = [0 2];
L(3).qlim = [-2.96706 2.96706];
L(4).qlim = [-3.31613 0.785398];
L(5).qlim = [-2.094395 2.722714];
L(6).qlim = [-3.22886 3.22886];
L(7).qlim = [-2.094395 2.094395];
L(8).qlim = [-6.108652 6.108652];
Tbasel = transl([0 0 2])
Ttooll=[1 0 0 0;0 -1 0 0;0 0 -1 0.5;0 0 0 1]; %works fine
roboL1 = SerialLink(L,'name', 'Left','base',Tbasel,'tool',Ttooll)
q0l=[pi;0.660;pi/4;pi/4;pi/4;pi/4;0;pi/4];
T0l=roboL1.fkine(q0l);
T0l =
-0.7071 -0.0000 -0.7071 0.0753
-0.7071 0.0000 0.7071 -0.3677
0.0000 1.0000 -0.0000 0.9400
0 0 0 1.0000
syms theta1 theta2 theta3 theta4 theta5 theta6 theta7 theta8 a1 a3 d2 d3 d4 d6 d8
%Define transformations:
D1_0 = [cos(theta1), sin(theta1), 0, a1*cos(theta1);
sin(theta1), -cos(theta1), 0, a1*sin(theta1);
0, 0, -1, 0;
0, 0, 0, 1];
D2_1 = [cos(theta2), -sin(theta2), 0, 0;
sin(theta2), cos(theta2), 0, 0;
0, 0, 1, d2;
0, 0, 0, 1];
D3_2 = [cos(theta3), 0, -sin(theta3), a3*cos(theta3);
sin(theta3), 0, cos(theta3), a3*sin(theta3);
0, -1, 0, d3;
0, 0, 0, 1];
D4_3 = [cos(theta4), -sin(theta4), 0, 0;
sin(theta4), cos(theta4), 0, 0;
0, 0, 1, d4;
0, 0, 0, 1];
D5_4 = [cos(theta5), 0, -sin(theta5), 0;
sin(theta5), 0, cos(theta5), 0;
0, -1, 0, 0;
0, 0, 0, 1];
D6_5 = [cos(theta6), 0, sin(theta6), 0;
sin(theta6), 0, -cos(theta6), 0;
0, 1, 0, d6;
0, 0, 0, 1];
D7_6 = [cos(theta7), 0, -sin(theta7), 0;
sin(theta7), 0, cos(theta7), 0;
0, -1, 0, 0;
0, 0, 0, 1];
D8_7 = [cos(theta8), -sin(theta8), 0, 0;
sin(theta8), cos(theta8), 0, 0;
0, 0, 1, d8;
0, 0, 0, 1];
%Determine transformation
D1_0 = simplify(D1_0);
D2_0 = D1_0 * D2_1;
D2_0 = simplify(D2_0)
D3_0 = D2_0*D3_2;
D3_0 = simplify(D3_0)
D4_0 = D3_0*D4_3;
D4_0 = simplify(D4_0)
D5_0 = D4_0*D5_4;
D5_0 = simplify(D5_0)
D6_0 = D5_0*D6_5;
D6_0 = simplify(D6_0)
D7_0 = D6_0*D7_6;
D7_0 = simplify(D7_0)
D8_0 = D7_0*D8_7;
D8_0 = simplify(D8_0)
a1=0.935852; d2=0.660; d3=0.400; a3=0.025; d4=0.455; d6=0.420; d8=0.080;
theta1=pi; theta2=0.660; theta3=pi/4; theta4=pi/4; theta5=pi/4; theta6=pi/4; theta7=0; theta8=pi/4;
subs(D8_0)
solution using the above is
-0.9921 0 0.1251 -0.4250
-0.1251 0 -0.9921 -0.4144
0 -1.0000 0 -1.0600
0 0 0 1.0000
Erik
Erik