Empty sym: 0-by-1
4 views (last 30 days)
Show older comments
Tony Yu
on 6 Jul 2020
Answered: Walter Roberson
on 10 Aug 2020
What does it mean and why am I geting this? is there anyway to fix it?
%inverse kinematic given:[−320,30,−320] with respected to base frame
H=[0 0 1 -320;
0 -1 0 30;
1 0 0 -320;
0 0 0 1;]
t1 = 0; d1 = th1_; a1 = 0; alpha1 = 0;
t2 = th2_+pi; d2 = 0; a2 = L; alpha2 = 0;
t3 = th3_-pi/2;d3 = 0; a3 = L; alpha3= -pi/2;
t31 = 0; d31 =L; a31 = 0; alpha31 = 0;
t4 = 0;d4 = L+th4_;a4 =-L; alpha4 = pi;
t5 = th5_+pi;d5 = 0;a5 = L; alpha5 = pi/2;
t51 = pi/2; d51= L; a51 = 0; alpha51 = pi/2;
t52 = 0; d52 = L; a52 =0; alpha52 = 0;
t6 = th6_;d6 = L;a6 = 0; alpha6 = 0;
A_1_ = inTransMat(a_1,alpha_1,d_1,t_1);
A0_ = inTransMat(a0,alpha0,d0,t0);
%setting frame 0 as shown
A1 = inTransMat(a1,alpha1,d1,t1);
A2_ = inTransMat(a2,alpha2,d2,t2);
A3_ = inTransMat(a3,alpha3,d3,t3);
A31_= inTransMat (a31,alpha31,d31,t31);
A4_ = inTransMat(a4,alpha4,d4,t4);
A5_= inTransMat(a5,alpha5,d5,t5);
A51_= inTransMat (a51,alpha51,d51,t51);
A52_= inTransMat (a52,alpha52,d52,t52);
A6_= inTransMat(a6,alpha6,d6,t6);
T_ = A_1*A0*A1*A2_*A3_*A31*A4_*A5_*A51_*A52_*A6
T01_ = A_1*A0*A1;
T02_ = A_1*A0*A1*A2_;
T03_ = A_1*A0*A1*A2_*A3_*A31;
T04_ = A_1*A0*A1*A2_*A3_*A31*A4_;
T05_ = A_1*A0*A1*A2_*A3_*A4_*A5*A51_*A52_;
T_06= vpa(T_,2)
%alegrabi approach
eqn1= T_06(1,1)==H(1,1);
eqn2= T_06(1,2)==H(1,2);
eqn3= T_06(1,3)==H(1,3);
eqn4= T_06(1,4)==H(1,4);
eqn5= T_06(2,1)==H(2,1);
eqn6= T_06(2,2)==H(2,2);
eqn7= T_06(2,3)==H(2,3);
eqn8= T_06(2,4)==H(2,4);
eqn9= T_06(3,1)==H(3,2);
eqn10= T_06(3,2)==H(3,2);
eqn11= T_06(3,3)==H(3,3);
eqn12= T_06(3,4)==H(3,4);
sol = solve([eqn1, eqn2, eqn3,eqn4,eqn5,eqn6,eqn7,eqn8,eqn9,eqn10,eqn11,eqn12], [th1_, th2_, th3_, th4_,th5_,th6_]);
th1sol= sol.th1_
th2sol= sol.th2_
th3sol= sol.th3_
th4sol= sol.th4_
th5sol= sol.th5_
th6sol= sol.th6_
function IT = inTransMat(a,b,c,d)
IT = [cos(d) -sin(d)*cos(b) sin(d)*sin(b) a*cos(d); sin(d) cos(d)*cos(b) -cos(d)*sin(b) a*sin(d); 0 sin(b) cos(b) c; 0 0 0 1];
end
function T = TransMat(a,b,c,d)
T = [cos(d) -sin(d)*cos(b) sin(d)*sin(b) a*cos(d); sin(d) cos(d)*cos(b) -cos(d)*sin(b) a*sin(d); 0 sin(b) cos(b) c; 0 0 0 1];
end
1 Comment
Surya Talluri
on 10 Aug 2020
I understand that th1_, th2_, th3_, th4_, th5_, th6_, L are symbols. Can you give more information about any other symbols that you have defined and what is the value of a_1 in equation defined for A_1_?
Accepted Answer
Walter Roberson
on 10 Aug 2020
t6 = th6_;d6 = L;a6 = 0; alpha6 = 0;
so t6 uses th6_
A6_= inTransMat(a6,alpha6,d6,t6);
and A6_ uses t6, so A6_ uses th6_
T_ = A_1*A0*A1*A2_*A3_*A31*A4_*A5_*A51_*A52_*A6
but that uses A6 not A6_ so T_ does not uses th6_ . None of the other equations do either. So when you construct the vector of formulas to be solved for [th1_, th2_, th3_, th4_,th5_,th6_] then none of them involve th6_
You are also trying to solve 12 equations for 6 variables. That is not going to work unless each missing variable th*_ happens to be a vector of length 2.
In order to get your code to run I had to define
syms th1_ th2_ th3_ th4_ th5_ th6_ L
syms a0 a_1 a31
syms A0 A_1 A1 A2_ A3_ A31 A4_ A5_ A51_ A52_ A5 A6
syms alpha0 alpha_1
syms d0 d_1
syms t0 t_1
Variables with lower-case names, variables with or without trailing underscore... it sure is a mess to read and be sure that the formula is correct, not accidentally referring to the wrong version of a variable.
0 Comments
More Answers (0)
See Also
Categories
Find more on Assumptions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!