1
00:00:01,500 --> 00:00:08,040
OK, now we are going to apply homogeneous transformation matrix in MATLAB.

2
00:00:08,580 --> 00:00:14,430
So in practice, we will use, as always, Peter Rackauckas Library in order to achieve that.

3
00:00:14,940 --> 00:00:15,840
So let's start.

4
00:00:16,500 --> 00:00:19,980
First of all, let's create on screen and create our Bibles.

5
00:00:20,880 --> 00:00:29,870
Let's start first on the meeting homogeneous transformation matrix book homogeneous.

6
00:00:29,880 --> 00:00:31,560
It's a bit difficult for me to write it.

7
00:00:31,710 --> 00:00:35,220
Transformation Matrix.

8
00:00:35,410 --> 00:00:40,820
OK, let's first let me explain some comments.

9
00:00:40,830 --> 00:00:50,730
OK, let's we will describe our homogeneous transformation matrix with these combination of translation

10
00:00:50,730 --> 00:00:53,910
transformation and rotation transformation.

11
00:00:55,080 --> 00:00:58,080
OK, let me first try it, and then I will explain.

12
00:01:01,010 --> 00:01:01,400
OK.

13
00:01:03,690 --> 00:01:08,580
And then again, translational transformation.

14
00:01:09,270 --> 00:01:12,180
Zero one zero.

15
00:01:12,210 --> 00:01:13,320
So what does it mean?

16
00:01:14,130 --> 00:01:18,020
First, what we are doing with Trans L?

17
00:01:18,060 --> 00:01:27,960
One zero zero So with these first come home, what we're doing is we translate our reframe in one unit

18
00:01:27,960 --> 00:01:29,460
in extraction.

19
00:01:29,820 --> 00:01:30,330
OK.

20
00:01:31,080 --> 00:01:38,580
Remember that as we post multiply the, uh, either translational or rotational transformation mattresses.

21
00:01:38,880 --> 00:01:42,690
This is about the motion is about the current axis.

22
00:01:42,960 --> 00:01:43,380
OK.

23
00:01:43,650 --> 00:01:45,060
Because we post multiply them.

24
00:01:45,840 --> 00:01:54,030
And then what we are doing with t r o t ex-spy overture, as you know from before and what we rotate

25
00:01:54,030 --> 00:01:55,800
about x direction.

26
00:01:56,010 --> 00:01:56,430
OK.

27
00:01:56,460 --> 00:02:00,340
This is let me just to the current X direction.

28
00:02:00,420 --> 00:02:00,840
OK.

29
00:02:00,870 --> 00:02:02,670
It's about current x axis.

30
00:02:04,320 --> 00:02:07,080
And then we rotate our frame.

31
00:02:07,380 --> 00:02:10,690
And what we are doing is Trans L zero one zero.

32
00:02:11,810 --> 00:02:16,720
We translate one unit in the current Y direction, not before y direction.

33
00:02:16,740 --> 00:02:17,790
OK, not fixed.

34
00:02:18,030 --> 00:02:21,210
Uh y direction, but the current y direction.

35
00:02:21,450 --> 00:02:31,800
So after rotation, after we rotate, we get the new frame and we move one unit in in y direction in

36
00:02:31,800 --> 00:02:32,730
the new frame.

37
00:02:33,600 --> 00:02:34,000
OK.

38
00:02:34,380 --> 00:02:40,500
So let's write this OK, I will copy some of the comments in order not to lose too much time.

39
00:02:41,370 --> 00:02:41,760
OK.

40
00:02:42,000 --> 00:02:43,380
This is our translation.

41
00:02:43,390 --> 00:02:46,920
Uh, the, uh, homogeneous transformation matrix.

42
00:02:46,920 --> 00:02:49,050
So this is our rigid motion.

43
00:02:49,680 --> 00:02:54,600
As you know, our rigid motion consists of translation and rotation.

44
00:02:55,110 --> 00:03:00,810
OK, then let's try to animate, animate transformation.

45
00:03:03,730 --> 00:03:04,400
OK.

46
00:03:04,600 --> 00:03:14,800
We will use T r the command in order to animate our homogeneous transmission matrix.

47
00:03:14,810 --> 00:03:16,090
So let's do that.

48
00:03:16,210 --> 00:03:17,830
Let's run all of this.

49
00:03:22,680 --> 00:03:24,090
OK, give it the time.

50
00:03:24,810 --> 00:03:31,420
Perfect, then let me just first make it in this way so you can easily see what's happening.

51
00:03:31,440 --> 00:03:37,770
Let's come to 3D and let's run this one again, Ron section.

52
00:03:38,820 --> 00:03:39,290
OK?

53
00:03:40,230 --> 00:03:43,200
As you can see, it's very interesting.

54
00:03:43,890 --> 00:03:45,060
You can approximate that.

55
00:03:45,060 --> 00:03:46,650
Try to understand what's happening.

56
00:03:46,890 --> 00:03:53,230
First of all, as you as you can see, we are moving in the X direction.

57
00:03:53,250 --> 00:03:55,680
As you can see in the current acceleration, it's moving.

58
00:03:56,070 --> 00:04:02,010
It's moving because of this common one zero zero because we are moving in this direction.

59
00:04:02,340 --> 00:04:08,880
However, why we are, you can see then if it is in the right direction, why we are moving in this

60
00:04:09,000 --> 00:04:09,450
direction.

61
00:04:09,450 --> 00:04:11,940
As you can see, it also moves up.

62
00:04:12,600 --> 00:04:15,150
As you can see, it rotates and moves up.

63
00:04:15,390 --> 00:04:25,740
This is because when we rotate our, uh, frame the current y axis, or let me just do that with the

64
00:04:25,740 --> 00:04:29,460
current y axis, here is zero one zero.

65
00:04:30,090 --> 00:04:30,530
OK.

66
00:04:30,750 --> 00:04:34,900
Is in the direction of the fixed frame.

67
00:04:34,920 --> 00:04:35,430
OK.

68
00:04:36,660 --> 00:04:44,790
I highly recommend you try these cords yourself and try to analyze it and try to understand what's happening.

69
00:04:45,000 --> 00:04:51,120
You have to understand because we have seen these lists and they are not really difficult.

70
00:04:51,300 --> 00:04:53,760
You can understand if you're on the lens of beat the cord.

71
00:04:54,600 --> 00:05:07,470
OK, so let's then continue with transforming a vector for K transforming transforming vector.

72
00:05:07,650 --> 00:05:08,040
OK.

73
00:05:08,580 --> 00:05:09,720
So what does it mean?

74
00:05:09,720 --> 00:05:10,800
Transforming a vector?

75
00:05:11,040 --> 00:05:14,190
We will transform Vector from, uh.

76
00:05:14,700 --> 00:05:16,830
So we will transform.

77
00:05:17,190 --> 00:05:19,230
Indeed, we will transform a point.

78
00:05:19,710 --> 00:05:25,740
And we will draw a vector in order to see this point from the zero frame to this point.

79
00:05:26,010 --> 00:05:32,160
And you will see how we transform a point from one point to another point or from one frame to another

80
00:05:32,160 --> 00:05:32,460
frame.

81
00:05:32,850 --> 00:05:33,930
OK, let's do that.

82
00:05:34,440 --> 00:05:36,300
First of all, again, it's clear.

83
00:05:36,600 --> 00:05:37,280
OK.

84
00:05:38,340 --> 00:05:40,230
Then let's create our vector.

85
00:05:40,800 --> 00:05:41,310
OK.

86
00:05:41,610 --> 00:05:44,070
As you can see, this is our Richter one.

87
00:05:44,100 --> 00:05:46,230
This is X, Y and Z.

88
00:05:46,500 --> 00:05:47,190
OK.

89
00:05:48,360 --> 00:05:51,330
So let's draw now our reference frame.

90
00:05:51,750 --> 00:05:52,500
OK?

91
00:05:53,370 --> 00:05:54,810
This is a reference frame.

92
00:05:55,180 --> 00:05:56,340
OK, let's throw it.

93
00:05:57,430 --> 00:05:57,720
Let's.

94
00:05:59,910 --> 00:06:00,420
OK.

95
00:06:09,730 --> 00:06:10,230
OK.

96
00:06:10,930 --> 00:06:12,160
This is our reference frame.

97
00:06:12,340 --> 00:06:17,020
Let's first roll until this one and to see how it is drawing our reference frame.

98
00:06:18,220 --> 00:06:21,280
OK, uh, well, it's always on top.

99
00:06:22,420 --> 00:06:22,840
OK.

100
00:06:22,900 --> 00:06:27,340
As you can see this, our reference frame, it throws our reference frame in this way.

101
00:06:28,300 --> 00:06:35,800
So let's then add again our homogeneous transformation matrix.

102
00:06:36,550 --> 00:06:37,090
OK.

103
00:06:37,150 --> 00:06:40,420
This is the old one, the same one we have used before.

104
00:06:40,900 --> 00:06:49,660
Then what we have to do, as you know, we have to multiply the homogeneous transformation matrix with

105
00:06:49,660 --> 00:06:56,980
our vector in it to get our new or re moved vector.

106
00:06:57,010 --> 00:06:57,430
OK?

107
00:06:58,240 --> 00:07:02,770
In order to get new vector, which moved rigidly.

108
00:07:02,920 --> 00:07:03,400
OK.

109
00:07:03,970 --> 00:07:12,430
So but as we have said before, we cannot directly multiply the vector with the homogeneous transformation

110
00:07:12,430 --> 00:07:12,760
matrix.

111
00:07:12,760 --> 00:07:13,330
Let's try.

112
00:07:13,600 --> 00:07:19,240
For example, this is our new vector equals thirty one multiplied by V. one.

113
00:07:19,390 --> 00:07:23,160
Let's do that, and you will see that it will give error because of why.

114
00:07:23,500 --> 00:07:25,180
T1 is four by four.

115
00:07:25,210 --> 00:07:33,700
You can see that if we run, you will see the T one is four by four, while we V1 is three by one,

116
00:07:33,700 --> 00:07:35,360
as you can see, three by one.

117
00:07:35,380 --> 00:07:37,810
So the dimensions are not correct and it will not work.

118
00:07:38,020 --> 00:07:40,940
Let's try and see.

119
00:07:41,140 --> 00:07:41,560
OK.

120
00:07:41,770 --> 00:07:46,960
As you can see, incorrect dimension for multi-course matrix multiplication.

121
00:07:48,010 --> 00:07:53,160
So what we had to do, we have to first convert this one to homogeneous corners.

122
00:07:53,170 --> 00:07:54,760
So let's try to do that.

123
00:07:56,470 --> 00:07:56,760
OK.

124
00:07:57,310 --> 00:08:01,510
So what we will do will make homogeneous coordinates.

125
00:08:02,080 --> 00:08:02,590
OK.

126
00:08:04,660 --> 00:08:08,340
What we have to do in order to make it in a homogeneous coordinate.

127
00:08:08,610 --> 00:08:10,620
We have to add only one.

128
00:08:10,660 --> 00:08:11,030
OK.

129
00:08:11,070 --> 00:08:12,390
This is our one.

130
00:08:12,750 --> 00:08:18,210
And we add one below it in order to have our homogeneous coordinates.

131
00:08:18,510 --> 00:08:22,740
So let's run this one in front and see what I mean.

132
00:08:22,920 --> 00:08:24,270
We won't take this object.

133
00:08:24,480 --> 00:08:32,580
As you can see it, only add extra one, you know, to get, uh, homogeneous coordinates.

134
00:08:33,000 --> 00:08:39,630
So then we can get our new vector, which is also homogeneous.

135
00:08:41,130 --> 00:08:41,600
OK.

136
00:08:41,820 --> 00:08:45,880
This is our new, homogeneous, new vector in homogeneous coordinates.

137
00:08:45,900 --> 00:08:46,320
OK.

138
00:08:47,010 --> 00:08:55,290
So we are multiplying our rotation, a homogeneous transformation matrix with our homogeneous vector,

139
00:08:55,590 --> 00:09:02,730
and we got our new homogeneous vector and we tried to convert it again back to a normal coordinate.

140
00:09:03,570 --> 00:09:04,170
OK.

141
00:09:04,740 --> 00:09:07,470
So let's try to then plot the vectors.

142
00:09:07,500 --> 00:09:12,210
Let me just copy all of these in order not to lose time.

143
00:09:12,450 --> 00:09:13,200
OK.

144
00:09:13,770 --> 00:09:16,260
We are just doing what this is.

145
00:09:16,290 --> 00:09:18,930
Uh, we just plot from the reference frame.

146
00:09:18,940 --> 00:09:25,350
So reference frame is zero zero zero and our vector is X is v one one.

147
00:09:25,530 --> 00:09:28,290
Why is v one two and it is v one three?

148
00:09:28,590 --> 00:09:32,280
So here we just define the limits of our axes.

149
00:09:32,610 --> 00:09:42,470
We just hold on in order to stick to the same plot, and we just then plot what our uh, second, uh,

150
00:09:42,930 --> 00:09:48,330
the new or, uh, the vector that have, uh, been moved rigidly.

151
00:09:48,840 --> 00:09:53,190
OK, let's first of all, uh, close the old graph.

152
00:09:53,220 --> 00:09:54,720
And, uh, okay.

153
00:09:56,040 --> 00:09:56,940
Brian S..

154
00:09:57,450 --> 00:09:57,960
OK.

155
00:09:58,230 --> 00:10:02,400
As you can see, as you can see, it's really easy to see.

156
00:10:02,400 --> 00:10:06,090
Let me just make it in this way.

157
00:10:06,120 --> 00:10:06,630
OK.

158
00:10:07,560 --> 00:10:09,300
This is our old vector.

159
00:10:09,540 --> 00:10:10,280
The blue one.

160
00:10:10,290 --> 00:10:17,370
And this is our new actor, which is, as you can see, rotated and also moved rigidly.

161
00:10:17,850 --> 00:10:18,330
OK.

162
00:10:20,310 --> 00:10:23,010
If you want, you can analyze it step by step.

163
00:10:23,550 --> 00:10:25,140
What do I mean step by step?

164
00:10:25,140 --> 00:10:32,010
For example, you can first delete all of these and only see the effect of this.

165
00:10:32,340 --> 00:10:33,610
Then what you can do.

166
00:10:33,630 --> 00:10:36,990
Delete this one and see the effect of these two.

167
00:10:37,290 --> 00:10:43,740
And you can, at the end, apply a total of these, uh, homogeneous transformation metrics and you

168
00:10:43,740 --> 00:10:45,780
can see how it affects.

169
00:10:46,140 --> 00:10:49,950
So it will be much more easier for you to understand that.

170
00:10:50,790 --> 00:10:52,620
But it is very important, please.

171
00:10:52,990 --> 00:10:59,190
Uh, it is not enough to just copy paste this code, try to understand what you are doing and try to

172
00:10:59,190 --> 00:11:02,070
see the concepts in the real world.

173
00:11:02,070 --> 00:11:03,990
So they are really working.

174
00:11:03,990 --> 00:11:05,580
Try to grasp this concept.

175
00:11:05,820 --> 00:11:06,240
OK.

176
00:11:06,480 --> 00:11:08,010
It would be very good for you.

177
00:11:08,370 --> 00:11:08,820
Really?

178
00:11:10,290 --> 00:11:14,970
OK, then let's do composition of transformation mattresses.

179
00:11:15,900 --> 00:11:16,530
OK.

180
00:11:18,450 --> 00:11:21,200
Transformation in composition of transformation.

181
00:11:21,210 --> 00:11:22,770
Homogeneous transformation mattresses.

182
00:11:22,980 --> 00:11:27,360
So again, let me just, uh, clean the screen and clear the variables.

183
00:11:27,600 --> 00:11:30,930
And again, let's write our transformation.

184
00:11:30,930 --> 00:11:32,710
Homogeneous transformation matrix.

185
00:11:32,730 --> 00:11:33,120
OK.

186
00:11:34,530 --> 00:11:46,090
OK, then let's try to plot our reference frame again, and let's define our X limits and Y limits and

187
00:11:46,350 --> 00:11:56,900
means also, let's to hold on in order to stick with the old plot and then create, uh, again, uh,

188
00:11:56,910 --> 00:11:57,810
digit motion.

189
00:11:58,050 --> 00:11:58,560
OK.

190
00:11:58,980 --> 00:12:04,950
By creating new homogeneous transformation matrix, we will create additional, uh, rigid motion and

191
00:12:04,950 --> 00:12:07,110
we will call this one t one.

192
00:12:07,720 --> 00:12:16,170
OK, now let's see two composition methods of transformation at, uh, homogeneous transformation mattresses,

193
00:12:16,170 --> 00:12:20,730
and you will see that they give totally different answers.

194
00:12:21,120 --> 00:12:23,780
Let's first do rigid motion about current X.

195
00:12:23,800 --> 00:12:31,910
So if we are doing in the current axis as you move, we have to post multiply the rotation.

196
00:12:32,310 --> 00:12:32,640
OK.

197
00:12:32,670 --> 00:12:34,620
Excuse me, transformation mattresses.

198
00:12:34,890 --> 00:12:41,760
I just sometimes say rotation mattresses, but this is a homogeneous transformation.

199
00:12:41,760 --> 00:12:42,290
Mattresses?

200
00:12:42,370 --> 00:12:42,630
OK.

201
00:12:43,170 --> 00:12:50,880
And let's this is our new homogeneous transformation matrix, which is composition of Ti zero and T

202
00:12:50,880 --> 00:12:51,260
one.

203
00:12:51,270 --> 00:13:00,240
As you can see, we just multiply the rotations and this is our new, uh, new transformation matrix,

204
00:13:00,240 --> 00:13:03,480
which is about, uh, current axis and.

205
00:13:03,560 --> 00:13:06,380
He drew it the in frame.

206
00:13:06,410 --> 00:13:08,990
So with this script, it is frame and cold.

207
00:13:08,990 --> 00:13:15,860
This frame, as for one, and let's two is also rigid motion about fixed axis.

208
00:13:15,890 --> 00:13:17,870
Okay, let's do fixed axis.

209
00:13:17,880 --> 00:13:24,110
So what we have to do, we have to play, multiply the mattresses, OK, transform each month, as you

210
00:13:24,110 --> 00:13:33,170
can see now, we have multiplied them and called these three and let's draw it as frame or two.

211
00:13:33,680 --> 00:13:42,440
OK, now let's run, and you will see that the result of these two compositions will be quite different.

212
00:13:42,830 --> 00:13:44,060
So let's three.

213
00:13:44,390 --> 00:13:47,420
Let's try to see it in 3D.

214
00:13:48,440 --> 00:13:49,100
Let me just.

215
00:13:49,400 --> 00:13:50,900
OK, perfect.

216
00:13:51,140 --> 00:13:53,420
As you can see, as you can see.

217
00:13:53,480 --> 00:13:54,560
Be careful here.

218
00:13:54,950 --> 00:13:56,750
This is our reference metrics.

219
00:13:57,230 --> 00:13:58,450
Excuse me, reference frame.

220
00:13:58,460 --> 00:13:59,120
This is zero.

221
00:13:59,600 --> 00:14:08,420
As you can see, the one is, uh, because of possible duplication or it is because of current axis.

222
00:14:08,600 --> 00:14:16,130
However, the second one is because of what the second one is because of, uh, fixed axis.

223
00:14:16,460 --> 00:14:20,750
As you can see, they have two, uh, quite different answer.

224
00:14:20,990 --> 00:14:23,390
Quite different answers.

225
00:14:23,810 --> 00:14:24,230
OK.

226
00:14:24,470 --> 00:14:33,410
So you have to be careful about the composition of transformation mattresses as in the case of rotation

227
00:14:33,680 --> 00:14:34,400
mattresses.

228
00:14:35,240 --> 00:14:36,200
Thank you very much.

229
00:14:36,230 --> 00:14:37,760
See you on the next lesson.
