OK, now we are going to apply homogeneous transformation matrix in MATLAB.
So in practice, we will use, as always, Peter Rackauckas Library in order to achieve that.
So let's start.
First of all, let's create on screen and create our Bibles.
Let's start first on the meeting homogeneous transformation matrix book homogeneous.
It's a bit difficult for me to write it.
Transformation Matrix.
OK, let's first let me explain some comments.
OK, let's we will describe our homogeneous transformation matrix with these combination of translation
transformation and rotation transformation.
OK, let me first try it, and then I will explain.
OK.
And then again, translational transformation.
Zero one zero.
So what does it mean?
First, what we are doing with Trans L?
One zero zero So with these first come home, what we're doing is we translate our reframe in one unit
in extraction.
OK.
Remember that as we post multiply the, uh, either translational or rotational transformation mattresses.
This is about the motion is about the current axis.
OK.
Because we post multiply them.
And then what we are doing with t r o t ex-spy overture, as you know from before and what we rotate
about x direction.
OK.
This is let me just to the current X direction.
OK.
It's about current x axis.
And then we rotate our frame.
And what we are doing is Trans L zero one zero.
We translate one unit in the current Y direction, not before y direction.
OK, not fixed.
Uh y direction, but the current y direction.
So after rotation, after we rotate, we get the new frame and we move one unit in in y direction in
the new frame.
OK.
So let's write this OK, I will copy some of the comments in order not to lose too much time.
OK.
This is our translation.
Uh, the, uh, homogeneous transformation matrix.
So this is our rigid motion.
As you know, our rigid motion consists of translation and rotation.
OK, then let's try to animate, animate transformation.
OK.
We will use T r the command in order to animate our homogeneous transmission matrix.
So let's do that.
Let's run all of this.
OK, give it the time.
Perfect, then let me just first make it in this way so you can easily see what's happening.
Let's come to 3D and let's run this one again, Ron section.
OK?
As you can see, it's very interesting.
You can approximate that.
Try to understand what's happening.
First of all, as you as you can see, we are moving in the X direction.
As you can see in the current acceleration, it's moving.
It's moving because of this common one zero zero because we are moving in this direction.
However, why we are, you can see then if it is in the right direction, why we are moving in this
direction.
As you can see, it also moves up.
As you can see, it rotates and moves up.
This is because when we rotate our, uh, frame the current y axis, or let me just do that with the
current y axis, here is zero one zero.
OK.
Is in the direction of the fixed frame.
OK.
I highly recommend you try these cords yourself and try to analyze it and try to understand what's happening.
You have to understand because we have seen these lists and they are not really difficult.
You can understand if you're on the lens of beat the cord.
OK, so let's then continue with transforming a vector for K transforming transforming vector.
OK.
So what does it mean?
Transforming a vector?
We will transform Vector from, uh.
So we will transform.
Indeed, we will transform a point.
And we will draw a vector in order to see this point from the zero frame to this point.
And you will see how we transform a point from one point to another point or from one frame to another
frame.
OK, let's do that.
First of all, again, it's clear.
OK.
Then let's create our vector.
OK.
As you can see, this is our Richter one.
This is X, Y and Z.
OK.
So let's draw now our reference frame.
OK?
This is a reference frame.
OK, let's throw it.
Let's.
OK.
This is our reference frame.
Let's first roll until this one and to see how it is drawing our reference frame.
OK, uh, well, it's always on top.
OK.
As you can see this, our reference frame, it throws our reference frame in this way.
So let's then add again our homogeneous transformation matrix.
OK.
This is the old one, the same one we have used before.
Then what we have to do, as you know, we have to multiply the homogeneous transformation matrix with
our vector in it to get our new or re moved vector.
OK?
In order to get new vector, which moved rigidly.
OK.
So but as we have said before, we cannot directly multiply the vector with the homogeneous transformation
matrix.
Let's try.
For example, this is our new vector equals thirty one multiplied by V. one.
Let's do that, and you will see that it will give error because of why.
T1 is four by four.
You can see that if we run, you will see the T one is four by four, while we V1 is three by one,
as you can see, three by one.
So the dimensions are not correct and it will not work.
Let's try and see.
OK.
As you can see, incorrect dimension for multi-course matrix multiplication.
So what we had to do, we have to first convert this one to homogeneous corners.
So let's try to do that.
OK.
So what we will do will make homogeneous coordinates.
OK.
What we have to do in order to make it in a homogeneous coordinate.
We have to add only one.
OK.
This is our one.
And we add one below it in order to have our homogeneous coordinates.
So let's run this one in front and see what I mean.
We won't take this object.
As you can see it, only add extra one, you know, to get, uh, homogeneous coordinates.
So then we can get our new vector, which is also homogeneous.
OK.
This is our new, homogeneous, new vector in homogeneous coordinates.
OK.
So we are multiplying our rotation, a homogeneous transformation matrix with our homogeneous vector,
and we got our new homogeneous vector and we tried to convert it again back to a normal coordinate.
OK.
So let's try to then plot the vectors.
Let me just copy all of these in order not to lose time.
OK.
We are just doing what this is.
Uh, we just plot from the reference frame.
So reference frame is zero zero zero and our vector is X is v one one.
Why is v one two and it is v one three?
So here we just define the limits of our axes.
We just hold on in order to stick to the same plot, and we just then plot what our uh, second, uh,
the new or, uh, the vector that have, uh, been moved rigidly.
OK, let's first of all, uh, close the old graph.
And, uh, okay.
Brian S..
OK.
As you can see, as you can see, it's really easy to see.
Let me just make it in this way.
OK.
This is our old vector.
The blue one.
And this is our new actor, which is, as you can see, rotated and also moved rigidly.
OK.
If you want, you can analyze it step by step.
What do I mean step by step?
For example, you can first delete all of these and only see the effect of this.
Then what you can do.
Delete this one and see the effect of these two.
And you can, at the end, apply a total of these, uh, homogeneous transformation metrics and you
can see how it affects.
So it will be much more easier for you to understand that.
But it is very important, please.
Uh, it is not enough to just copy paste this code, try to understand what you are doing and try to
see the concepts in the real world.
So they are really working.
Try to grasp this concept.
OK.
It would be very good for you.
Really?
OK, then let's do composition of transformation mattresses.
OK.
Transformation in composition of transformation.
Homogeneous transformation mattresses.
So again, let me just, uh, clean the screen and clear the variables.
And again, let's write our transformation.
Homogeneous transformation matrix.
OK.
OK, then let's try to plot our reference frame again, and let's define our X limits and Y limits and
means also, let's to hold on in order to stick with the old plot and then create, uh, again, uh,
digit motion.
OK.
By creating new homogeneous transformation matrix, we will create additional, uh, rigid motion and
we will call this one t one.
OK, now let's see two composition methods of transformation at, uh, homogeneous transformation mattresses,
and you will see that they give totally different answers.
Let's first do rigid motion about current X.
So if we are doing in the current axis as you move, we have to post multiply the rotation.
OK.
Excuse me, transformation mattresses.
I just sometimes say rotation mattresses, but this is a homogeneous transformation.
Mattresses?
OK.
And let's this is our new homogeneous transformation matrix, which is composition of Ti zero and T
one.
As you can see, we just multiply the rotations and this is our new, uh, new transformation matrix,
which is about, uh, current axis and.
He drew it the in frame.
So with this script, it is frame and cold.
This frame, as for one, and let's two is also rigid motion about fixed axis.
Okay, let's do fixed axis.
So what we have to do, we have to play, multiply the mattresses, OK, transform each month, as you
can see now, we have multiplied them and called these three and let's draw it as frame or two.
OK, now let's run, and you will see that the result of these two compositions will be quite different.
So let's three.
Let's try to see it in 3D.
Let me just.
OK, perfect.
As you can see, as you can see.
Be careful here.
This is our reference metrics.
Excuse me, reference frame.
This is zero.
As you can see, the one is, uh, because of possible duplication or it is because of current axis.
However, the second one is because of what the second one is because of, uh, fixed axis.
As you can see, they have two, uh, quite different answer.
Quite different answers.
OK.
So you have to be careful about the composition of transformation mattresses as in the case of rotation
mattresses.
Thank you very much.
See you on the next lesson.