This brief digression into the mathematics that allows us to perform coordinate transformation between
two reference frames has provided us with some very powerful tools.
As we approach solving much more complex problems.
The first one of these problem is how do I find how do I calculate the position of the robot gripper
in the three dimensional space, knowing the angle so the position of each joint of the robot.
The mathematics that is used to answer this question is called forward Kinematics.
The second question we asked ourselves was how do I calculate the angle of each joint of the robot that
has brought the gripper to its current position in space?
Or how do I calculate the angles of the joints if I know the position and the orientation of the gripper
in the space?
The mathematics.
Instead.
That answer this question is called inverse kinematics.
Let's see how to express and solve the first of these two problems.
So the forward kinematics.
Let's start by considering the architecture of our robot.
As we know, it has three degrees of freedom, so it has three movable joints driven by three motors
that allows us to move the robot's gripper in space.
We need to focus on their movement and orientation to solve the forward kinematic problem.
Let's consider a simplified version but still accurate representation of our robot architecture consisting
of three cylinders representing the three rotational joints of the robot, connected by three links
representing its arms.
The problem of forward kinematics is nothing more than a different form of representing the same problem
we have already faced and solved in previous lessons.
That is, how do I express the position and the orientation of our reference frame with respect to one
other after it has arbitrarily rotated and translated?
Therefore, we define two reference frames, one that is fixed and is called word frame, which we call
W in short, and the other one that is mobile and is attached to the robots and the link.
So located at the gripper which we call R and which moves along with the robot gripper by rotating and
translating as the angle of each joint of the robot change.
The goal of the forward kinematics is to know at every moment in time the position of the reference
frame.
R with the respect to the reference frame W.
In fact, since the reference frame R is connected to the robot's gripper and moves along with it.
This implicitly means knowing at every moment in time the position and the orientation of the robot's
gripper in the world.
Correct.
To solve the forward kinematics problem, it is enough to calculate a transformation matrix precisely
the one that expresses how the reference frame, W and R are connected to each other.
However, be aware that this calculation is not trivial, as it depends on three variables.
The three angles of the three joints of the robot.
A change in the position of any of these three joints affect the position and the orientation of the
gripper and therefore of the reference frame.
Ah, and so this change the transformation matrix.
As always when dealing with a very complex problem, Let's try to break it down into many smaller and
more easily solvable problems.
We associate our reference frame to each movable joint.
Although the position and the orientation of this intermediate reference frame are arbitrary, there
are robotics convention, such as the Dynamic Artwork convention that allows us to arrange these frames
in a way that minimize and facilitate calculations.
In general, we position each reference frame so that it is translated and can rotate relative to the
previous reference frame only around one axis.
For example, in this case the frame too can rotate relative to the frame one only around the z axis
and does this when the first rotational joint of the robot said one at the base rotates.
If you recall from theoretical lesson on rotation matrices, this is a very useful result because we
can easily determine the rotation matrix between the frames two and one using just an elementary rotation
matrix around the Z axis that depends only on a single variable.
So on a single angle that is namely the position of the joint at the base of the robot.
At this point, it becomes very easy for us to calculate the intermediate transformation matrices between
each of these reference frames.
They will be composed of a certain translation vector that depends on the physical dimension of the
robots links and ascertained rotation matrix that depends on the rotation angle of each of the movable
joints.
By simplifying the forward kinematics problem, we now only need to calculate four simple and elementary
intermediate transformation matrices instead of dealing with a single complex transformation matrix.
We just need to compose these transformation matrices.
That is, we just need to multiply them to calculate the overall transformation matrix that connects
the word reference frame to the gripper reference frame of the robot.
And this is the matrix that solves the forward kinematic problem.
When composing transformation matrices and calculating their product.
Be aware of one thing The order of the multiplication is crucial.
The transformation matrices must be composed and multiplied in the order that follows the entire chain
of transformation.
So the one that connects the initial frame to the final one in the order they appear.
To better understand why the order of multiplication is crucial.
Let's do a small example.
Let's assume that we have a parallelepiped in a three dimensional reference frame and we apply two successive
transformation to it.
First, we rotate it by 90 degrees around its Z axis, and then we rotate it by another 90 degrees this
time around the Y axis.
Now let's perform the same transformation.
So the same operation with the same parallelepiped in the same initial configuration simply by reversing
the order of rotations.
So first we rotate the parallelepiped 90 degrees around the y axis and then we rotate it around the
Z axis by another 90 degrees.
As you can see, even though we started with the same initial configuration and rotated both parallelepipeds
by the same angle around the same axis, the result and therefore the final configuration of the parallelepiped
is different.
Keep this in mind when composing transformation matrices.