Solving Jacobian matrix for singularities

140 views (last 30 days)
Hello everyone!
In our assignment we have been tasked with deriving a Jacobian with the help of a provided DH table for a 6DOF robot (UR5). I'm pretty sure I managed to create my jacobian. The next task is specified as follows:
"Analyze the robot for any singularities and if any identify at what joint positions (angles) the singularities occur."
So after a few youtube videos I have concluded that you get the singularities when the matrix for the Jacobian = 0, in other words J[6x6]=0. So my first question to you is if I have understood it correctly.
[Edit] My assumption was incorrect, it's the determinant of the Jacobian that has to equal 0, in other words: det(J[6x6])=0.
If I have understood it correctly, I believe that I can use a solver where I input my my equation as J[6x6]=0 where my variables are TH1, TH2, TH3, TH4, TH5 and TH6. My second question to you would be how I would go about creating a solver for this.
I'm quite new to this so please forgive me if I'm making no sense. For clarification, my Jacobian matrix is entirely symbolic, that means every element is described with some combination of cos(THn), sin(THn) and constants which I have defined as symbolic to keep the matrix somewhat readable.
syms TH1 TH2 TH3 TH4 TH5 TH6
syms d1 d4 d5 d6
syms a2 a3
[d4*cos(TH1) + d6*(cos(TH1)*cos(TH5) + cos(TH2 + TH3 + TH4)*sin(TH1)*sin(TH5)) - a2*cos(TH2)*sin(TH1) - d5*sin(TH1)*sin(TH2 + TH3 + TH4) + a3*sin(TH1)*sin(TH2)*sin(TH3) - a3*cos(TH2)*cos(TH3)*sin(TH1), -cos(TH1)*(a3*sin(TH2 + TH3) - d5*(cos(TH2 + TH3)*cos(TH4) - sin(TH2 + TH3)*sin(TH4)) + a2*sin(TH2) - d6*sin(TH5)*(cos(TH2 + TH3)*sin(TH4) + sin(TH2 + TH3)*cos(TH4))), cos(TH1)*(d5*cos(TH2 + TH3 + TH4) - a3*sin(TH2 + TH3) + d6*sin(TH5)*sin(TH2 + TH3 + TH4)), cos(TH1)*(d5*cos(TH2 + TH3 + TH4) + d6*sin(TH5)*sin(TH2 + TH3 + TH4)), d6*cos(TH1)*cos(TH2)*cos(TH5)*sin(TH3)*sin(TH4) - d6*cos(TH1)*cos(TH2)*cos(TH3)*cos(TH4)*cos(TH5) - d6*sin(TH1)*sin(TH5) + d6*cos(TH1)*cos(TH3)*cos(TH5)*sin(TH2)*sin(TH4) + d6*cos(TH1)*cos(TH4)*cos(TH5)*sin(TH2)*sin(TH3), 0]
[d4*sin(TH1) + d6*(cos(TH5)*sin(TH1) - cos(TH1)*cos(TH2 + TH3 + TH4)*sin(TH5)) + a2*cos(TH1)*cos(TH2) + d5*cos(TH1)*sin(TH2 + TH3 + TH4) - a3*cos(TH1)*sin(TH2)*sin(TH3) + a3*cos(TH1)*cos(TH2)*cos(TH3), -sin(TH1)*(a3*sin(TH2 + TH3) - d5*(cos(TH2 + TH3)*cos(TH4) - sin(TH2 + TH3)*sin(TH4)) + a2*sin(TH2) - d6*sin(TH5)*(cos(TH2 + TH3)*sin(TH4) + sin(TH2 + TH3)*cos(TH4))), sin(TH1)*(d5*cos(TH2 + TH3 + TH4) - a3*sin(TH2 + TH3) + d6*sin(TH5)*sin(TH2 + TH3 + TH4)), sin(TH1)*(d5*cos(TH2 + TH3 + TH4) + d6*sin(TH5)*sin(TH2 + TH3 + TH4)), d6*cos(TH1)*sin(TH5) - d6*cos(TH2)*cos(TH3)*cos(TH4)*cos(TH5)*sin(TH1) + d6*cos(TH2)*cos(TH5)*sin(TH1)*sin(TH3)*sin(TH4) + d6*cos(TH3)*cos(TH5)*sin(TH1)*sin(TH2)*sin(TH4) + d6*cos(TH4)*cos(TH5)*sin(TH1)*sin(TH2)*sin(TH3), 0]
[ 0, a3*cos(TH2 + TH3) + (d6*sin(TH2 + TH3 + TH4 - TH5))/2 + a2*cos(TH2) + d5*sin(TH2 + TH3 + TH4) - (d6*sin(TH2 + TH3 + TH4 + TH5))/2, a3*cos(TH2 + TH3) + (d6*sin(TH2 + TH3 + TH4 - TH5))/2 + d5*sin(TH2 + TH3 + TH4) - (d6*sin(TH2 + TH3 + TH4 + TH5))/2, (d6*sin(TH2 + TH3 + TH4 - TH5))/2 + d5*sin(TH2 + TH3 + TH4) - (d6*sin(TH2 + TH3 + TH4 + TH5))/2, -d6*(sin(TH2 + TH3 + TH4 + TH5)/2 + sin(TH2 + TH3 + TH4 - TH5)/2), 0]
[ 0, sin(TH1), sin(TH1), sin(TH1), cos(TH1)*sin(TH2 + TH3 + TH4), cos(TH5)*sin(TH1) - cos(TH1)*cos(TH2 + TH3 + TH4)*sin(TH5)]
[ 0, -cos(TH1), -cos(TH1), -cos(TH1), sin(TH1)*sin(TH2 + TH3 + TH4), - cos(TH1)*cos(TH5) - cos(TH2 + TH3 + TH4)*sin(TH1)*sin(TH5)]
[ 1, 0, 0, 0, -cos(TH2 + TH3 + TH4), -sin(TH5)*sin(TH2 + TH3 + TH4)]
If additional information is needed I will provide what I can, thank you for your time!
  2 Comments
Paul
Paul on 29 Oct 2021
As to question 1, are you sure the singularities are defined when J = 0? Is it possible you meant that the singularities occur when the determinant of J is zero?
Daniel Arezoomande
Daniel Arezoomande on 29 Oct 2021
Hey Paul, thank you for checking in!
Yes so I kept reading up on the subject and you are completely correct, I'll have to correct my post.
So when the det(J[6x6])=0 I get the singularities. Now here is the issue I ran in to. The determinant of the Jacobian gives me a single equation with 6 variables. It is, as far as I know, impossible to calculate my variables unless I have atleast 6 different equations.
Continuing to read up on the subject I found out that I can take determinants of different partial Jacobian so that I get more equations, but so far I have not discovered in what way I can select the partial Jacobian. Would I be able to select which ever elements I want, like 1,1 1,2 1,3 2,1 2,2 2,3 3,1 3,2 3,3?

Sign in to comment.

Accepted Answer

Paul
Paul on 29 Oct 2021
Edited: Paul on 29 Oct 2021
Becase this is an assignment, here's some code and hints to get started
syms TH1 TH2 TH3 TH4 TH5 TH6
TH = sym('TH',[1 6]); % gather up the unknowns into a single array, makes some things easier
syms d1 d4 d5 d6
syms a2 a3
% define the Jacobian as a single 6 x 6 matrix
J = [
d4*cos(TH1) + d6*(cos(TH1)*cos(TH5) + cos(TH2 + TH3 + TH4)*sin(TH1)*sin(TH5)) - a2*cos(TH2)*sin(TH1) - d5*sin(TH1)*sin(TH2 + TH3 + TH4) + a3*sin(TH1)*sin(TH2)*sin(TH3) - a3*cos(TH2)*cos(TH3)*sin(TH1), -cos(TH1)*(a3*sin(TH2 + TH3) - d5*(cos(TH2 + TH3)*cos(TH4) - sin(TH2 + TH3)*sin(TH4)) + a2*sin(TH2) - d6*sin(TH5)*(cos(TH2 + TH3)*sin(TH4) + sin(TH2 + TH3)*cos(TH4))), cos(TH1)*(d5*cos(TH2 + TH3 + TH4) - a3*sin(TH2 + TH3) + d6*sin(TH5)*sin(TH2 + TH3 + TH4)), cos(TH1)*(d5*cos(TH2 + TH3 + TH4) + d6*sin(TH5)*sin(TH2 + TH3 + TH4)), d6*cos(TH1)*cos(TH2)*cos(TH5)*sin(TH3)*sin(TH4) - d6*cos(TH1)*cos(TH2)*cos(TH3)*cos(TH4)*cos(TH5) - d6*sin(TH1)*sin(TH5) + d6*cos(TH1)*cos(TH3)*cos(TH5)*sin(TH2)*sin(TH4) + d6*cos(TH1)*cos(TH4)*cos(TH5)*sin(TH2)*sin(TH3), 0;
d4*sin(TH1) + d6*(cos(TH5)*sin(TH1) - cos(TH1)*cos(TH2 + TH3 + TH4)*sin(TH5)) + a2*cos(TH1)*cos(TH2) + d5*cos(TH1)*sin(TH2 + TH3 + TH4) - a3*cos(TH1)*sin(TH2)*sin(TH3) + a3*cos(TH1)*cos(TH2)*cos(TH3), -sin(TH1)*(a3*sin(TH2 + TH3) - d5*(cos(TH2 + TH3)*cos(TH4) - sin(TH2 + TH3)*sin(TH4)) + a2*sin(TH2) - d6*sin(TH5)*(cos(TH2 + TH3)*sin(TH4) + sin(TH2 + TH3)*cos(TH4))), sin(TH1)*(d5*cos(TH2 + TH3 + TH4) - a3*sin(TH2 + TH3) + d6*sin(TH5)*sin(TH2 + TH3 + TH4)), sin(TH1)*(d5*cos(TH2 + TH3 + TH4) + d6*sin(TH5)*sin(TH2 + TH3 + TH4)), d6*cos(TH1)*sin(TH5) - d6*cos(TH2)*cos(TH3)*cos(TH4)*cos(TH5)*sin(TH1) + d6*cos(TH2)*cos(TH5)*sin(TH1)*sin(TH3)*sin(TH4) + d6*cos(TH3)*cos(TH5)*sin(TH1)*sin(TH2)*sin(TH4) + d6*cos(TH4)*cos(TH5)*sin(TH1)*sin(TH2)*sin(TH3), 0;
0, a3*cos(TH2 + TH3) + (d6*sin(TH2 + TH3 + TH4 - TH5))/2 + a2*cos(TH2) + d5*sin(TH2 + TH3 + TH4) - (d6*sin(TH2 + TH3 + TH4 + TH5))/2, a3*cos(TH2 + TH3) + (d6*sin(TH2 + TH3 + TH4 - TH5))/2 + d5*sin(TH2 + TH3 + TH4) - (d6*sin(TH2 + TH3 + TH4 + TH5))/2, (d6*sin(TH2 + TH3 + TH4 - TH5))/2 + d5*sin(TH2 + TH3 + TH4) - (d6*sin(TH2 + TH3 + TH4 + TH5))/2, -d6*(sin(TH2 + TH3 + TH4 + TH5)/2 + sin(TH2 + TH3 + TH4 - TH5)/2), 0;
0, sin(TH1), sin(TH1), sin(TH1), cos(TH1)*sin(TH2 + TH3 + TH4), cos(TH5)*sin(TH1) - cos(TH1)*cos(TH2 + TH3 + TH4)*sin(TH5);
0, -cos(TH1), -cos(TH1), -cos(TH1), sin(TH1)*sin(TH2 + TH3 + TH4), - cos(TH1)*cos(TH5) - cos(TH2 + TH3 + TH4)*sin(TH1)*sin(TH5);
1, 0, 0, 0, -cos(TH2 + TH3 + TH4), -sin(TH5)*sin(TH2 + TH3 + TH4)];
theta = sym('theta',[1 6]);
J = subs(J,TH,theta); % use theta to make the output use greek letter symbols
assume(theta,'real'); % the angles are real, so let's assume that to be the case
D(theta) = simplify(det(J),100) % compute the determinant
D(theta1, theta2, theta3, theta4, theta5, theta6) = 
% a trivial solution for D == 0, is a2 = 0 or a3 = 0, so let's assume those are not true
assume(a2 ~= 0);
assume(a3 ~= 0);
% now need to solve D(theta) == 0, note: there is one obvious solution
% check out the solve() function, and its option ReturnConditions
% doc solve
  13 Comments
Daniel Arezoomande
Daniel Arezoomande on 30 Oct 2021
Edited: Daniel Arezoomande on 30 Oct 2021
As I was explaining my answer I thought back to the sin(theta5) outside of the expression which has an obvious answer. Why does the code not give us a second column of answers where theta5 = k*0?
Because my answer will have to include that singularities occur for when theta3=pi*k, theta5=pi*k,theta5=0 right?
Daniel Arezoomande
Daniel Arezoomande on 30 Oct 2021
Nevermind, I guess it's not needed because the case pi*k for when k = 0 gives us 0. Which means theta5=pi*k includes our case when theta5=0.

Sign in to comment.

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!