i hope that you'll be ok!
I'm trying to control a Puma robot using the inverse kinematics in Matlab. I used unit quaternions to express the orientation of End Effector frame and orientation of desired frame from Rotation matrix, like in Sciavicco-Siciliano. This is the code:
Rd = [-sin(beta) 0 cos(beta); % desired orientation matrix of ee
cos(beta) 0 sin(beta);
0 -1 0 ];
Re = H0e(1:3,1:3); % orientation matrix of EE from direct kinematics
u0 = @(R) 0.5* sqrt(1+R(1,1)+R(2,2)+R(3,3));
u1 = @(R) 0.5* sign(R(3,2)-R(2,3)) * sqrt(1+R(1,1)-R(2,2)-R(3,3));
u2 = @(R) 0.5* sign(R(1,3)-R(3,1)) * sqrt(1-R(1,1)+R(2,2)-R(3,3));
u3 = @(R) 0.5* sign(R(2,1)-R(1,2)) * sqrt(1-R(1,1)-R(2,2)+R(3,3));
S = @(x,y,z) [0 -z y; z 0 -x; -y x 0];
Qd = [u0(Rd) u1(Rd) u2(Rd) u3(Rd)]'; % {eta_d, epsilon_d} desired unit quaternion
Qe = [u0(Re) u1(Re) u2(Re) u3(Re)]'; % {eta_e, epsilon_e} unit quaternion of ee
The problem is that two different rotation matrix produce the same unit quaternion and therefore the error is zero.
These are the two matrices:
Rd =
0.7250 0 0.6887
0.6887 0 -0.7250
0 -1.0000 0
Re =
0.7250 -0.6887 0.0000
-0.0000 -0.0000 1.0000
-0.6887 -0.7250 -0.0000
Where am i doing wrong? Could you help me?
Thank a lot!