Hi All,

Been mostly focused on school these days so havent had much time to post recently! However this time I will be going through a pretty important topic in robotics called forward kinematics. I learnt about this to apply on my robot arm that I built and I will be modelling that here.

Forward kinematics is basically building a mathematical description of a robot that you can use to find the coordinates of the end-effector (The “claw”) depending on what angles the servo motors are at. This might seem to be easily done by geometry but following forward kinematics this can be explained through a few equations.

So lets start off with rotation matrixes. These basically describe the rotation between 2 frames in euclidean space.

As it can be seen there are 2 frames above, lets call the one with the black axis frame 0 and the one with the red axis frame 1. Let us now imagine there is a point P in frame 0. Now if you wanted to define this point P in frame 1, you will need apply a rotation to it. That rotation is basically defined as a transformation matrix. It works a bit like this:

The confusing looking second equation is just the first one expanded. As you can see the rotation matrix is represented by a 3 x 3 matrix. To apply it you just have to mutltiply the coordinates of P in frame 1 with the rotation matrix R, which maps from frame 1 to 2 as the numbers before show, and Ta – Da! you did the rotation!

Now you are probably sitting there wondering what the hell the r numbers inside the matrix are. Those basically help to define a matrix and can be computed for a set of rotations. Basically rotations in the X, Y and Z axis are all considered differently and can be multiplied together to give you your overall rotation. The individual matrices for every axis are:

and now you can enter the specific rotation values around each axis you want and just multiply them all together like this:

and there you have your own rotation matrix.

Now this can also be done between mutliple frames. Lets say you have point P in frame 1 and you want it defined in point 3, but you only have the rotation matrix from point 1 to point 2 and a rotation matrix from point 2 to point 3. This can be easily solved because of this property of rotation matrices.

Super simple and neat! Just multiply through the frames to reach yo bur final frame! Thats the advantages of using matrices, you can solve most things just by multiplying.

Now onto the next bit, to add the transformation between the frames.

Look at a situation like this

Lets make the red axis frame 1 and the purple one frame 2. Also ignore the letters next to the axis on the purple 1, I just couldn’t find a better image to explain. Now the 2 frames are translated from each others origins by vector M. This translation can be added to the rotation matrix like this:

Basically the translation between the frames is just slapped onto the rotation matrix and its made a 4 x 4 for easier multiplication and then Ta-Da, you have your transformation matrix. With this if we had imaginary point P in frame 1 and I wanted to describe it frame 2, I just do this:

And just like with rotation matrices, I can do this between how many ever frames I want to go to.

Now you would be wondering why I went through all this math without even mentioning forward kinematics or even a robot for gods sake! But it all comes down to how you can describe every effector (Servo)in a robot with a frame and go through each frame and that is your forward kinematics.

This is a model of my robot arm:

This is just the robot arm represented in very simplistic terms. The end effector is in frame 3 and is the frame without a motor on it in the end. Now to find its position, I could just go through each frame using transformation matrices shown before and find the end effector position right?

Now this is the part where you will hate me! The answer is yes you can, but there is a much easier method!

If you used transformation matrices, you would need to define the rotation amongst all 3 axis’s between frames and the translation between 2 frames, which brings another 3 variables, so 6 in total. However since the rotation will only happen along 1 axis as each motor can only rotate along one, using a strict set of rules, only 4 variables can be applied!

This is known as the Denvait-Hartenberg Conventions and it has a special transformation matrix to describe the relationship between 2 frames. It follows like this:

That equation describes the relationship between 2 joints using an effector. Dont be intimated by its look! It is really simple to work around. In it θ is the angle of the effector (servo), α is the twist between the joints and lastly, a is the distance between the 2 joints.

The rules of the convention, when simplified, are as follows:

The axis of rotation is around the Z axis The x-axis faces towards the direction of the next effector

Whenever you assign frames in a robot to give it DH parameters, these 2 must be satisifed. You might say that at frame 0, the x-axis doesn’t face towards the next effector, this however makes sense since the axis of rotation, the z-axis is already facing it. However for other joints, the x-axis must face the next effector, like in frame 1 and 2. Over here a is basically the displacement in the x-axis of the 2 effectors, α describes the angle between the 2 z-axis of 2 effectors measured along the x-axis of the frame that the transformation is moving towards. IE, in between frame 0 and 1 this is 90 degrees, however between 1 and 2 there is no rotation. Lastly, θ again is just the angle that servo is at.

A table describing these 3 variables for each joint can be made:

Now using this I can come up with the DH matrices for these 3 joints, I am just going to call them A1 for F0 to F1, A2 for F1 to F2 and A3 for F2 to F3 for simplicity’s sake.

To form these matrices I just popped in the appropiate variables from the table and BOOM the transformation is described. This is why I really love DH parameters, make this work so easy rather than deriving these matrices ourselves from transformation matrices.

So next I just multiply these together for the final transformation.

There we go! thats the final matrix describing the transformation from the base frame to the end effector! Looks very complicated but you can extract the coordinates from the last column as this.

and the rotation matrix part of the final transformation matrix is the rotation matrix to define the rotation between the base frame and final frame.

There we go thats it for this one! a lot of math but it makes sense eventually.

If you want to read further this is amazing: https://www.cs.duke.edu/brd/Teaching/Bio/asmb/current/Papers/chap3-forward-kinematics.pdf

See you all in the next blog!