Effacer les filtres
Effacer les filtres

Jacobian matrices of 6DOF robot not calculable

14 vues (au cours des 30 derniers jours)
Michael Zimmerli
Michael Zimmerli le 14 Oct 2023
Commenté : Sam Chak le 15 Oct 2023
Hello together,
I am working on an exercise for school where you have to calculate the Jacobian matrix of a DOF6 Kinova Gen3 robot.I have already calculated the Forward Kinematics (see code below) .
My problem now is that matlab cannot calculate the determinant symbolically.
I am not sure if the problem lies with the arctan2 or the huge matrice, since this term cannot be simplified.
Thank you very much for the help!
clear all; close all; clc;
%% robot size and joint angles
l1 = 156.4; l2 = 128.4; l3 = 5.4; l4 = 410.0; l5 = 6.4;
l6 = 208.4; l7 = 105.9; l8 = 105.9; l9 = 61.5;
syms phi_1 phi_2 phi_3 phi_4 phi_5 phi_6;
%% fundamental Rotation and Translation
syms alpha; syms gamma; syms beta
syms l;
R_x = [1 0 0 0;
0 cos(gamma) -sin(gamma) 0;
0 sin(gamma) cos(gamma) 0;
0 0 0 1];
R_x(gamma) = R_x;
R_y = [ cos(beta) 0 sin(beta) 0;
0 1 0 0;
-sin(beta) 0 cos(beta) 0;
0 0 0 1];
R_y(beta) = R_y;
R_z = [cos(alpha) -sin(alpha) 0 0;
sin(alpha) cos(alpha) 0 0;
0 0 1 0;
0 0 0 1];
R_z(alpha) = R_z;
D_x = [1 0 0 l;
0 1 0 0;
0 0 1 0;
0 0 0 1];
D_x(l) = D_x;
D_y = [1 0 0 0;
0 1 0 l;
0 0 1 0;
0 0 0 1];
D_y(l) = D_y;
D_z = [1 0 0 0;
0 1 0 0;
0 0 1 l;
0 0 0 1];
D_z(l) = D_z;
%% Forward Kinematics for Toolframe
T_B_0 = simplify(D_z(l1)) % Base to Zero
T_0_1 = simplify(R_z(phi_1)) % Zero to one....
T_1_2 = simplify(D_z(l2)*D_x(l3)*R_x(phi_2))
T_2_3 = simplify(D_z(l4)*R_x(phi_3))
T_3_4 = simplify(D_x(-l5)*D_z(l6)*R_z(phi_4))
T_4_5 = simplify(D_z(l7)*R_x(phi_5))
T_5_6 = simplify(D_z(l8)*R_z(phi_6))
T_6_T = simplify(D_z(l9)) % six to tool
T_T_B = simplify(T_B_0 * T_0_1 * T_1_2 * T_2_3 * T_3_4 * T_4_5 * T_5_6 * T_6_T)
T_T_B = simplify(T_T_B)
%% Representation as XYZ Fixed-Angle
b_x_1 = T_T_B(1,4);
b_x_2 = T_T_B(2,4);
b_x_3 = T_T_B(3,4);
b_x_5 = asin(-T_T_B(3,1));
b_x_6 = atan2((T_T_B(3,2)/cos(b_x_5)),(T_T_B(3,3)/cos(b_x_5)));
b_x_4 = atan2((T_T_B(2,1)/cos(b_x_5)),(T_T_B(1,1)/cos(b_x_5)));
L_X = [b_x_1 ;b_x_2 ;b_x_3; b_x_4 ;b_x_5; b_x_6];
L_X = simplify(L_X,100)
%%
J_1 = [diff(b_x_1,phi_1),diff(b_x_1,phi_2),diff(b_x_1,phi_3),diff(b_x_1,phi_4),diff(b_x_1,phi_5),diff(b_x_1,phi_6)];
J_2 = [diff(b_x_2,phi_1),diff(b_x_2,phi_2),diff(b_x_2,phi_3),diff(b_x_2,phi_4),diff(b_x_2,phi_5),diff(b_x_2,phi_6)];
J_3 = [diff(b_x_3,phi_1),diff(b_x_3,phi_2),diff(b_x_3,phi_3),diff(b_x_3,phi_4),diff(b_x_3,phi_5),diff(b_x_3,phi_6)];
J_4 = [diff(b_x_4,phi_1),diff(b_x_4,phi_2),diff(b_x_4,phi_3),diff(b_x_4,phi_4),diff(b_x_4,phi_5),diff(b_x_4,phi_6)];
J_5 = [diff(b_x_5,phi_1),diff(b_x_5,phi_2),diff(b_x_5,phi_3),diff(b_x_5,phi_4),diff(b_x_5,phi_5),diff(b_x_5,phi_6)];
J_6 = [diff(b_x_6,phi_1),diff(b_x_6,phi_2),diff(b_x_6,phi_3),diff(b_x_6,phi_4),diff(b_x_6,phi_5),diff(b_x_6,phi_6)];
%% Jacobian
J = [J_1;J_2;J_3;J_4;J_5;J_6]
%% det(J) for analyse of singularities
  4 commentaires
Walter Roberson
Walter Roberson le 14 Oct 2023
Is it possible to restrict any of the symbols to real? Doing so can simplify places that would otherwise come out with conj() and real() and imag() components.
Paul
Paul le 14 Oct 2023
Even when retricting the phi* variables to be real, J still contains various real(), imag(), and terms with 1i because of how atan2(y,x) can get simplified to angle(x + 1i*y). I couldn't get anything simplified too far when I was looking at this.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 14 Oct 2023
Here is a performance improvement trick:
syms J_ [6 6]
detJ_ = det(J_); %will be fast
detJ = subs(detJ_, J_, J);
This will give you a representation for the determinent of J faster than det(J) would. The result will not be as expanded as if you had used det(J) -- but if you need the expanded version then expand(detJ) formed this way will, in practice, still be faster than if you had done expand(det(J))
With all of the trig elements, there might be some identies that should ideally be processed... but that will not happen for det(J) either. It might be best to simplify(detJ) but unfortunately simplify() of a long expression takes a long time.
  8 commentaires
Paul
Paul le 15 Oct 2023
Not a solution to the problem, but the code can be made a bit simpler.
Myabe all the lvalues shoudl be stored in a single vector and accessed via indexing. I didn't do that here because I didn't want to edit all of the l* entries below.
%% robot size and joint angles
%lvec = [156.4; 128.4; 5.4; 410.0; 6.4; 208.4; 105.9; 105.9; 61.5];
l1 = 156.4; l2 = 128.4; l3 = 5.4; l4 = 410.0; l5 = 6.4;
l6 = 208.4; l7 = 105.9; l8 = 105.9; l9 = 61.5;
Similarly, consider making phi a sym vector, and assume the angles are real, which can help simplify things sometimes. Might also want to consider using assumeAlso to represent other phyiscal constraints on the angles.
phi = sym('phi',[1 6],'real')
phi = 
%syms phi_1 phi_2 phi_3 phi_4 phi_5 phi_6 real
The rotation and translation matrices can be defined as symfun objects from the jump
%% fundamental Rotation and Translation
syms alpha gamma beta
syms l;
R_x(gamma) = [1 0 0 0;
0 cos(gamma) -sin(gamma) 0;
0 sin(gamma) cos(gamma) 0;
0 0 0 1];
%R_x(gamma) = R_x;
R_y(beta) = [ cos(beta) 0 sin(beta) 0;
0 1 0 0;
-sin(beta) 0 cos(beta) 0;
0 0 0 1];
%R_y(beta) = R_y;
R_z(alpha) = [cos(alpha) -sin(alpha) 0 0;
sin(alpha) cos(alpha) 0 0;
0 0 1 0;
0 0 0 1];
%R_z(alpha) = R_z;
D_x(l) = [1 0 0 l;
0 1 0 0;
0 0 1 0;
0 0 0 1];
%D_x(l) = D_x;
D_y(l) = [1 0 0 0;
0 1 0 l;
0 0 1 0;
0 0 0 1];
%D_y(l) = D_y;
D_z(l) = [1 0 0 0;
0 1 0 0;
0 0 1 l;
0 0 0 1];
%D_z(l) = D_z;
%% Forward Kinematics for Toolframe
T_B_0 = simplify(D_z(l1)); % Base to Zero
T_0_1 = simplify(R_z(phi(1))); % Zero to one....
T_1_2 = simplify(D_z(l2)*D_x(l3)*R_x(phi(2)));
T_2_3 = simplify(D_z(l4)*R_x(phi(3)));
T_3_4 = simplify(D_x(-l5)*D_z(l6)*R_z(phi(4)));
T_4_5 = simplify(D_z(l7)*R_x(phi(5)));
T_5_6 = simplify(D_z(l8)*R_z(phi(6)));
T_6_T = simplify(D_z(l9)); % six to tool
T_T_B = simplify(T_B_0 * T_0_1 * T_1_2 * T_2_3 * T_3_4 * T_4_5 * T_5_6 * T_6_T);
%T_T_B = simplify(T_T_B)
I'll just not here that b_x_6 is computed before b_x_4
%% Representation as XYZ Fixed-Angle
b_x_1 = T_T_B(1,4);
b_x_2 = T_T_B(2,4);
b_x_3 = T_T_B(3,4);
b_x_5 = asin(-T_T_B(3,1));
b_x_6 = atan2((T_T_B(3,2)/cos(b_x_5)),(T_T_B(3,3)/cos(b_x_5)));
b_x_4 = atan2((T_T_B(2,1)/cos(b_x_5)),(T_T_B(1,1)/cos(b_x_5)));
L_X = [b_x_1 ;b_x_2 ;b_x_3; b_x_4 ;b_x_5; b_x_6];
L_X = simplify(L_X);
Use jacobian to compute J, instead all those calls to diff
J = jacobian(L_X,phi);
J
J = 
Maybe this can be simplified down some more, I wasn't able to get very far. Unless the atan2 are known to be abolutely necessary, I'd start with trying ordinary atan.
Instead of checking the determinant of J, maybe a miracle will occur with rref, or eig as @Walter Roberson suggested, from which one could determine when J loses rank. But I wouldn't hold my breath.
Sam Chak
Sam Chak le 15 Oct 2023
I found an Accepted Answer by @Paul that is related to solving the determinant of the Jacobian matrix to identify the joint configurations that lead to singularities. You can check it out here:

Connectez-vous pour commenter.

Plus de réponses (0)

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by