Differential Kinematics¶
Based on chapter 8 of Robotics, Vision and Control by Peter Corke, and on chapter 3 of Robotics: Modelling, Planning and Control by Siciliano, Sciavicco, Villani and Oriolo.
It uses the The robotics toolbox for MATLAB.
It also uses the MATLAB Symbolic Math Toolbox (functions syms, assume, simplify, diff, subs).
Link to the theoretical session on Kinematics
Geometric Jacobian¶
The anthropomorphic arm¶
The Jacobian for three revolute joints is:
The homogeneous transformations between links are:
The origin of the reference frame of link is represented in the base frame as:
The z-axes of the link reference frames are:
Then, the Jacobian results:
Coding with the Matlab symbolic toolbox¶
The previous developments can be coded efficiently using the Matlab Symbolic Toolbox as follows:
clear
%
%joint variables
syms q1
syms q2
syms q3
assume(q1,'real')
assume(q2,'real')
assume(q3,'real')
%link lengths
syms a2
syms a3
assume(a2,'real')
assume(a3,'real')
%A matrices
A01 = [cos(q1) 0 sin(q1) 0;...
sin(q1) 0 -cos(q1) 0;...
0 1 0 0;...
0 0 0 1]
A12 = [cos(q2) -sin(q2) 0 a2*cos(q2);...
sin(q2) cos(q2) 0 a2*sin(q2);...
0 0 1 0;...
0 0 0 1]
A23 = [cos(q3) -sin(q3) 0 a3*cos(q3);...
sin(q3) cos(q3) 0 a3*sin(q3);...
0 0 1 0;...
0 0 0 1]
p0 = [0 0 0 1]'
p1 = A01*p0
p2 = A01*A12*p0
p3= A01*A12*A23*p0
z0 = [0 0 1]';
z1 = A01(1:3,1:3)*z0
z2 = A01(1:3,1:3)*A12(1:3,1:3)*z0
J = [ cross(z0,p3(1:3)-p0(1:3)), cross(z1,p3(1:3)-p1(1:3)), cross(z2,p3(1:3)-p2(1:3));...
z0 z1 z2]
J = simplify(J)
Using the robotics toolbox¶
The Robotics Toolbox provides a method in the SerialLink class that allows to compute the Geometric Jacobian at a given configuration:
>> mdl_puma560
>> J = p560.jacob0(qn)
The Geometric Jacobian relates the joint velocities with the end-effector linear and angular velocities . The function jacbo0 gives the Cartesian velocities of the end-effector measured from the base frame (hence the 0 in the name of the function)
The rows of J are the Cartesian degrees of freedom and the columns the joints, therefore for the 6 degree of freedom Puma 560 manipulator the Jacobian is a (6x6) square matrix.
The (3x3) zero block indicates that the joint velocities of the wrist joints do not have any effect on the linear motion of the end-effector.
The joint velocities required to move along a small velocity in the z-direction are:
>> qd = inv(J)*[0 0 0.1 0 0 0]'
>>> EXERCISE
Write a Matlab function called qdot that has as input a serial link, a configuration and a desired operational space velocity and returns the joint velocities.
Analytic Jacobian¶
The anthropomorphic arm¶
The Analytical Jacobian is:
The position of the end effector is:
Then, the linear part of the analytical Jacobian becomes:
The orientation of the end effector is:
The corresponding ZYZ Euler angles are:
Then, the angular part of the analytical Jacobian becomes:
It can be verified that it corresponds to the angular part of the Geometric Jacobian computed above, which are related through matrix .
Since and , then , , , and . Therefore, as expected:
Coding with the Matlab symbolic toolbox¶
The previous developments can be coded efficiently using the Matlab Symbolic Toolbox as follows:
clear
%
%joint variables
syms q1
syms q2
syms q3
assume(q1,'real')
assume(q2,'real')
assume(q3,'real')
%link lengths
syms a2
syms a3
assume(a2,'real')
assume(a3,'real')
%A matrices
A01 = [cos(q1) 0 sin(q1) 0;...
sin(q1) 0 -cos(q1) 0;...
0 1 0 0;...
0 0 0 1]
A12 = [cos(q2) -sin(q2) 0 a2*cos(q2);...
sin(q2) cos(q2) 0 a2*sin(q2);...
0 0 1 0;...
0 0 0 1]
A23 = [cos(q3) -sin(q3) 0 a3*cos(q3);...
sin(q3) cos(q3) 0 a3*sin(q3);...
0 0 1 0;...
0 0 0 1]
A03 = A01*A12*A23;
Pe = A03(:,4)
Phie = A03(1:3,1:3)
phi = atan2(Phie(2,3),Phie(1,3))
theta = atan2(sqrt(Phie(1,3)^2+Phie(2,3)^2),Phie(3,3))
psi = atan2(Phie(3,2),-Phie(3,1))
dPexdq1 = diff(Pe(1),q1);
dPexdq2 = diff(Pe(1),q2);
dPexdq3 = diff(Pe(1),q3);
dPeydq1 = diff(Pe(2),q1);
dPeydq2 = diff(Pe(2),q2);
dPeydq3 = diff(Pe(2),q3);
dPezdq1 = diff(Pe(3),q1);
dPezdq2 = diff(Pe(3),q2);
dPezdq3 = diff(Pe(3),q3);
Jp = [dPexdq1 dPexdq2 dPexdq3;...
dPeydq1 dPeydq2 dPeydq3;...
dPezdq1 dPezdq2 dPezdq3]
Jp = simplify(Jp)
dphidq1 = diff(phi,q1);
dphidq2 = diff(phi,q2);
dphidq3 = diff(phi,q3);
dthetadq1 = diff(theta,q1);
dthetadq2 = diff(theta,q2);
dthetadq3 = diff(theta,q3);
dpsidq1 = diff(psi,q1);
dpsidq2 = diff(psi,q2);
dpsidq3 = diff(psi,q3);
JPhi = [dphidq1 dphidq2 dphidq3;...
dthetadq1 dthetadq2 dthetadq3;...
dpsidq1 dpsidq2 dpsidq3]
JPhi = simplify(JPhi)
JA = [Jp;JPhi]
Using the robotics toolbox¶
The jacob0 method introduced before, gives us the Analytical Jacobian if the parameter `eul` is added:
>> JA = p560.jacob0(qn,'eul')
The relation between the Geometric Jacobian and the Analytic Jacobian is:
The Toolbox provides the function eul2jac(phi,theta,psi) that implements the matrix , with being the ZYZ Euler angles .
>> Tn = p560.fkine(qn)
>> Phi_e = Tn.toeul
>> TA = J*inv(JA)
>> T = TA(4:6,4:6)
>> T = eul2jac(Phi_e)
Alternatively to the use of ZYZ Euler angles, RPY angles can be used, and then the expression of the analytical Jacobian and that of matrix vary. Matrix is implemented in the robotics toolbox by the function rpy2jac.
Singularities / Manipulability¶
If we compute the Jacobian at configuration qr we see that the columns 4 and 6 are identical, meaning that motions of these joints will produce the same Cartesian motion:
>> J = p560.jacob0(qr)
>> rank(J)
>> det(J)
The singularity check can be done by the following function:
>> jsingu(J)
Let’s analyze what happens near the singularities, by slightly changing to a configuration near qn:
>> q = qn
>> q(5) = 5*pi/180
>> J = p560.jacob0(q)
>> rank(J)
>> det(J)
>> jsingu(J)
In this configuration the velocities required to move along a small velocity in the z-direction are very large (compare them with qd, the joint velocities obtained in configuration qn computed in the first section):
>> qd2 = inv(J)*[0 0 0.1 0 0 0]'
Near singularities the manipulability is small. This can be visualized using the translational and angular velocity ellipsoids:
>> Jt = J(1:3,:)
>> plot_ellipse(Jt*Jt')
>> Ja = J(4:6,:)
>> figure
>> plot_ellipse(Ja*Ja')
The manipulability index is computed as follows:
>> mt_q = p560.maniplty(q,'yoshikawa','trans')
>> mr_q = p560.maniplty(q,'yoshikawa','rot')
The following source code illustrates how the manipulability changes for different configurations of a two-link planar arm performing a two-degrees of freedom planar task. Note that only the degrees of freedom of the task (r=2) are taken into account, i.e. the Jacobian used to compute the manipulability is of dimension .
>>> EXERCISE
Change the configuration in the script to visualize the manipulability ellipsoid in different regions of the workspace.
Redundancy¶
Consider the redundant mobile manipulator p8 consituted by a xy platform and the Puma 560 robot.
>> qn8 = [0, 0, qn]
>> platform = SerialLink( [0 0 0 -pi/2 1; -pi/2 0 0 pi/2 1], 'base', troty(pi/2), 'name', 'platform' )
>> p8 = SerialLink([platform, p560])
>> J = p8.jacob0(qn8)
>> about(J)
We have to use the pseudoinverse to compute the required for a given desired end-effector velocity . The pseudoinvese is computed by function pinv:
>> xd = [0.2 0.2 0.2 0 0 0]'
>> qd = pinv(J)*xd
Redundancy can be used to achieve motions that satisfy a secondary objective like maximizing manipulability.
Consider now a planar manipulator with three joints performing a two-degrees-of-freedom planar task (only the position of the end effector is relevant, not its orientation). The following source code illustrates the use of redundancy to move the tree-link planar arm along an operational space velocity while maximizing manipulability:
EXERCISE (Deliverable)¶
>>> Exercise A
Compute the Geometric Jacobian of the spherical wrist
>>> Exercise B
Compute the Analytical Jacobian of the spherical wrist. Verify that it is related with the Geometric Jacobian by matrix T_A.
>>> Exercise C
Modify the file *threeLink.m* to compute the manipulability all along the motion, and compare it for a trajectory generated when no maximization of the manipulability is considered.
>>> Exercise D (optional)
Compute the Jacobian of the UR3 robot using the DH parameters provided by Universal Robots.