-
Notifications
You must be signed in to change notification settings - Fork 13
Description
The method jacobian_dot(q, q_dot) returns inaccurate results. I performed a comparison test using a derivative Jacobian matrix analytically computed (using a two planar links robot) vs jacobian_dot. The results are not the same.
I realized that the method computes the time derivative Jacobian until joint ith. This is great, but, x_effector and J are computed until joint obj.links. Furthermore, I believe that J(:,1:i) must be computed using jacobian(theta, ith) instead of taking a column from matrix J.
I modified the method in this way:
function J_dot = jacobian_dot(obj,theta,theta_dot, ith)
% J_dot = jacobian_dot(theta,theta_dot) returns the Jacobian
% time derivative.
% J_dot = jacobian_dot(theta,theta_dot,ith) returns the first
% ith columns of the Jacobian time derivative.
% This function does not take into account any base or
% end-effector displacements.
if nargin == 4
n = ith;
else
n = obj.links;
end
%x_effector = obj.raw_fkm(theta);
%J = obj.raw_jacobian(theta);
x_effector = obj.raw_fkm(theta, n);
Jj = obj.jacobian(theta,n);
Jaux = zeros(8,obj.links);
Jaux(:,1:n) = Jj;
J = Jaux;
vec_x_effector_dot = J*theta_dot;
x = DQ(1);
J_dot = zeros(8,n-obj.n_dummy);
jth=0;
for i = 0:n-1
% Use the standard DH convention
if strcmp(obj.convention,'standard')
w = DQ.k;
z = DQ(obj.get_z(x.q));
else % Use the modified DH convention
w = DQ([0,0,-sin(obj.alpha(i+1)),cos(obj.alpha(i+1)),0,0,-obj.a(i+1)*cos(obj.alpha(i+1)),-obj.a(i+1)*sin(obj.alpha(i+1)) ] );
z = 0.5*x*w*x';
end
if ~obj.dummy(i+1)
if jth == 0
Ji = zeros(8, obj.links);
else
%ji = obj.jacobian_(theta,ith, obj.links);
Jj = obj.jacobian(theta,jth);
Jaux = zeros(8,obj.links);
Jaux(:,1:jth) = Jj;
Ji = Jaux;
end
%vec_zdot = 0.5*(haminus8(w*x') + hamiplus8(x*w)*DQ.C8)*J(:,1:i)*theta_dot(1:i);
vec_zdot = 0.5*(haminus8(w*x') + hamiplus8(x*w)*DQ.C8)*Ji*theta_dot;
J_dot(:,jth+1) = haminus8(x_effector)*vec_zdot + hamiplus8(z)*vec_x_effector_dot;
x = x*obj.dh2dq(theta(jth+1),i+1);
jth = jth+1;
else
% Dummy joints don't contribute to the Jacobian
x = x*obj.dh2dq(0,i+1);
end
end
end
Using the modified method, the analytical derivative Jacobian matrix matched with the jacobian_dot. Furthermore, I performed the jacobian_time_derivative.m example. Using the modified method the error is lower.
