# How to calculate displacement of the end effector by the yaw, pitch, and roll in the spherical joint?

For planar robots, we can calculate how small changes in the angle of each joint corresponds to the displacement of the end effector, by constructing a jacobian consisting of cross products between the axis of rotation of each joint and difference between the position of each joint and the end joint. I tried to use the same logic for a spherical joint with 3dof by calculating three angles for each global axis of rotation, from the displacement of the end effector at each global axis. I then tried to construct a rotational matrix to correctly orient the joint from these three Euler angles. However, since rotations of each angle stack on top of each other in rotation matrices, this didn't work. Is there a practical way to construct a rotation matrix from these angles or is there a different solution to this problem?

Write the rotation matrix from the first coordinate system to the coordinate system moved by the first motor. Four of the elements should include a cosine or sine of the first motor angle. Then write the rotation matrix from that coordinate system to the coordinate system moved by the second motor. Do this again for the third motor.

Multiply these three rotation matrixes together and you will get the rotation matrix for the 3 dof spherical joint.

Incidentally, you can easily write the individual 3x3 rotation matrices as follows:

The first column is composed of the direction cosines of the moving x axis relative to the fixed coordinate system; the second column is composed of the direction cosines of the moving y axis with respect to the fixed coordinate system; the third column is composed of the direction cosines of the moving z axis with respect to the fixed coordinate system.

• Thanks for the reply! Sorry I'm new to this and also not very familiar with the terminology. I see the spherical joint as a gimbal. If I multiply by X, Y and Z rotation matrices in sequence, the next one in sequence is going to be influenced by the prior one. So I'm unable to see why this would work. I was contemplating about using angular velocity instead, and calculate the rotation matrix needed to orient the spherical joint, by stacking up quaternions constructed from small changes in angular velocities as related to the offset, that is the difference between the end effector and the target – Lenny White Jul 19 '20 at 20:30
• My method assumes you have three actuators connected in serial (so the first motor rotates the other two motors and the second motor rotates the third. To be spherical, the axes of all three must intersect. – SteveO Jul 19 '20 at 20:41
• Sorry, hit send too soon. You can compute rotation matrices using quarternians as well but to me the simple, serial, individual rotation matrix method is the most intuitive. Then you multiply those three 3x3’s to get the thing you’re going after with your quaternian approach. The end result must be the same because both methods model the kinematics of motion of the same device. Your choice. – SteveO Jul 19 '20 at 20:43
• This might help with terminology and notation: robotics.stackexchange.com/q/8621/11125 – SteveO Jul 19 '20 at 20:55
• I understand. Thank you! – Lenny White Jul 19 '20 at 21:02