Professional Documents
Culture Documents
WS5 Lecture2
WS5 Lecture2
WS5 Lecture2
Workshop #5
Name:
Background:
clear
Quaternions
You can mathematically handle quaternions in different ways: row, column, structure, array
q_row=[sqrt(3)/2 1/2 0 0]
q_row = 1×4
0.8660 0.5000 0 0
q_row2=[sqrt(2)/2 0 sqrt(2)/2 0]
q_row2 = 1×4
0.7071 0 0.7071 0
q_column=[sqrt(3)/2; 1/2; 0; 0]
q_column = 4×1
0.8660
0.5000
0
0
1 0.866 [0.5000;...
2 0.7071 [0;0.707...
1 0.866 [0.5,0,0]
1
1 2
2 0.7071 [0,0.707...
q1=q_row; q2=q_row2;
conjq1=[q1(1) -q1(2:4)];
conjq2=[q2(1) -q2(2:4)];
[conjq2; conjQ(q2); q2]
ans = 3×4
0.7071 0 -0.7071 0
0.7071 0 -0.7071 0
0.7071 0 0.7071 0
Product
%(?)
q1tq2=[q1(1)*q2(1)-dot(q1,q2) q1(1)*q2(2:4)+q2(1)*q1(2:4)+cross(q1(2:4),q2(2:4))]
q1tq2 = 1×4
0 0.3536 0.6124 0.3536
magnq1=norm(q1)
magnq1 = 1
tau=0.5;
%for example
a0=pi/6; u=[0 0 -1];
q0=[cos(a0/2) u*sin(a0/2)];
q0pow=[cos(tau*a0/2) u*sin(tau*a0/2)]
2
q0pow = 1×4
0.9914 0 0 -0.1305
• Write functions for each one of the operations described, and validate them. Use the conjQ conjugate
function that has been provided.
• Use your functions and perform spherical linear interpolation from an intended starting to a final
orientation. Assume the case of the end-effector of a 3R robot and the data from the example solved in
class. Plot the results (\theta vs \tau)
• Perform inverse kinematics and obtain the plots for each joint vs \tau. You can assume x,y and link
lengths (An IK function has been provided)
• Would there be any difference if we directly used a third degree polynomial to interpolate between the
initial and final configurations?
• For a UR10 robot perform spherical linear interpolation in Matlab. Assume that the robot EE firmly holds
a cup filled with water and you need to provide the joint angles that pour the water into a container. Plot
all joint and Cartesian displacements