Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:01,020 --> 00:00:02,910
Speaker1:
Hello, my name is Carlos Osorio.
2
00:00:03,480 --> 00:00:07,650
I'm an application engineer here at the
mathworks, and this is part one of a series
3
00:00:07,650 --> 00:00:13,920
of recorded sessions that I am doing for the
power differential equation becomes a robot
4
00:00:13,920 --> 00:00:18,370
seminar. In this section, I'm going to focus
on rigid body dynamics.
5
00:00:18,390 --> 00:00:22,230
So we're going to talk about mechanisms and
how to build the differential equations for
6
00:00:22,230 --> 00:00:24,690
these mechanisms. We're going to look a
little bit at analytics.
7
00:00:24,990 --> 00:00:29,790
Then also, I'm going to show you how to
interface with cat tools and import the
8
00:00:29,790 --> 00:00:36,000
information directly from cat tools to build
full dynamic models of your three dimensional
9
00:00:36,000 --> 00:00:40,860
mechanisms. So hopefully, you watch the
overview section.
10
00:00:41,490 --> 00:00:46,140
But just to recall the problem, we're trying
to build a multi degree of freedom mechanical
11
00:00:46,140 --> 00:00:49,950
manipulator. In this case, it's a seven
degrees of freedom robotics manipulator.
12
00:00:50,100 --> 00:00:55,050
So the argument I was making is this idea of
to solve a complex problem.
13
00:00:55,050 --> 00:00:58,200
We have to decompose it in simpler, more
manageable problems.
14
00:00:58,380 --> 00:01:01,470
So we're going to concentrate on the
mechanics right now, even though there's
15
00:01:01,470 --> 00:01:04,860
electrics and there's controls and all kinds
of other things.
16
00:01:04,860 --> 00:01:08,010
So let's just concentrate on the mechanics
for now.
17
00:01:08,220 --> 00:01:12,240
So even when we look at the mechanics, we
want to look at the simplest possible
18
00:01:12,240 --> 00:01:15,870
situation to try to understand and gain some
insight into the problem.
19
00:01:15,990 --> 00:01:17,780
So let me look at a single pendulum.
20
00:01:17,910 --> 00:01:20,910
There's a multi-link multi-link mechanism.
21
00:01:21,240 --> 00:01:26,160
So what are the primary variables that are
involved in this are there's an angle of
22
00:01:26,160 --> 00:01:29,160
rotation, there's length of the making.
23
00:01:29,170 --> 00:01:31,980
There's a mass that is pushing it down or
bringing it down.
24
00:01:32,760 --> 00:01:37,650
I can think of now, once I have this
established, I might want to grab a piece of
25
00:01:37,650 --> 00:01:39,390
paper and start writing some equations.
26
00:01:39,390 --> 00:01:42,390
But the problem is like manual approaches
are always prone to error.
27
00:01:42,390 --> 00:01:46,380
And I mean, I've written it here as an
example, but even writing this in a clean
28
00:01:46,380 --> 00:01:47,730
manner, it took me a little bit.
29
00:01:47,880 --> 00:01:54,510
And so we have a symbolic analysis tool that
can a very powerful, symbolic analysis tool
30
00:01:54,510 --> 00:01:56,400
that can assist you with this kind of task.
31
00:01:56,430 --> 00:01:59,520
So let me go into MATLAB with MATLAB.
32
00:02:00,090 --> 00:02:05,640
In order to open the symbolic analysis tool,
you can go on the start menu toolboxes and
33
00:02:05,640 --> 00:02:07,830
look for that symbolic math toolbox.
34
00:02:07,840 --> 00:02:12,810
So if you have the symbolic mark toolbox in
your license, you will have this interface,
35
00:02:12,810 --> 00:02:18,150
which is called Muppet Newport is the
notebook interface that allows me to build my
36
00:02:18,150 --> 00:02:22,830
symbolic analysis, or you can call it
directly from from the MATLAB environment
37
00:02:22,830 --> 00:02:27,300
here. So this is a blank notebook.
38
00:02:28,080 --> 00:02:30,750
It's a full editing notebook so I can do
text.
39
00:02:31,440 --> 00:02:39,660
For example, I can bring in Sara title
dynamic mix of simple pendulum.
40
00:02:41,670 --> 00:02:47,490
Pendulum, I can insert images, for example,
if I wish, I have an image library somewhere
41
00:02:47,490 --> 00:02:50,520
here, so let me look for a pendulum picture.
42
00:02:50,700 --> 00:02:53,670
Ok, there you go. This is going to help me
keep track of what I'm building.
43
00:02:54,480 --> 00:02:59,370
If I'm going to use a first principle
equations or I'm trying to follow a paper or
44
00:02:59,370 --> 00:03:02,820
a book in this case for like the dynamics of
a pendulum.
45
00:03:02,820 --> 00:03:06,410
The first law that I'm going to use is
Newton's laws.
46
00:03:06,420 --> 00:03:08,850
Or let me say, Typekit Newton's law.
47
00:03:09,840 --> 00:03:15,700
Newton's law says sum of talks is equal to
the inertia times, the angular acceleration.
48
00:03:15,870 --> 00:03:18,300
So I'm going to define an expression.
49
00:03:18,300 --> 00:03:22,380
This is going to be a symbolic expression,
not notice that I'm using the call on equal
50
00:03:22,380 --> 00:03:27,180
notation. And I'm going to say this is some
of torques is equal to the inertia, which
51
00:03:27,180 --> 00:03:29,430
would be the inertia around the z axis.
52
00:03:29,430 --> 00:03:34,260
The rotational axis multiplied by the
angular acceleration.
53
00:03:34,260 --> 00:03:35,930
So the angle is theta.
54
00:03:35,940 --> 00:03:39,000
The angular acceleration will be the second
derivative of theta.
55
00:03:39,450 --> 00:03:41,850
So I can evaluate them directly.
56
00:03:41,880 --> 00:03:45,060
Of course, nothing very interesting is
happening is happening here because I
57
00:03:45,060 --> 00:03:48,710
haven't. I haven't. I haven't defined any of
the terms.
58
00:03:48,720 --> 00:03:52,860
And this is a very simple problem because
what I want to do is just give you a sense
59
00:03:52,860 --> 00:03:54,420
for how this tool operates.
60
00:03:54,600 --> 00:03:57,060
So let's let's just define some of the
terms.
61
00:03:57,370 --> 00:04:02,040
So let me find the the moment of inertia of
a thin road, for example, around the center
62
00:04:02,040 --> 00:04:06,510
of mass. You can look it up in any book you
find that that is supposed to be more square
63
00:04:06,510 --> 00:04:16,410
over 12, so the mass multiplied by the the
length squared and more squared over
64
00:04:16,410 --> 00:04:20,760
12. So that's the moment of inertia around
the center of mass.
65
00:04:20,760 --> 00:04:25,680
But at the moment of inertia I want is around
Z, so I have to use the parallax theorem.
66
00:04:25,920 --> 00:04:34,050
So I ICC will be actually that ICM and
translated by the parallax theorem.
67
00:04:34,050 --> 00:04:42,240
So mass times the distance which would be in
this case are over two squared times mass
68
00:04:42,240 --> 00:04:47,190
times square. So not as even in simple
things like this, it's actually doing all the
69
00:04:47,190 --> 00:04:50,130
factoring and computing the whole operation
for me.
70
00:04:50,170 --> 00:04:54,870
And so that starts the more complicated my
operations start becoming, the more helpful
71
00:04:54,870 --> 00:04:57,060
this becomes. Let's find the talk.
72
00:04:57,240 --> 00:05:03,870
The talk will be produced by whatever the
the gravity force in this case, which is mkg.
73
00:05:04,110 --> 00:05:08,160
But the force that is producing the torque
is the one perpendicular to the rotation.
74
00:05:08,160 --> 00:05:10,530
So mkg sine of the sign of theta.
75
00:05:10,530 --> 00:05:20,370
So it will be minus m g sine of theater of T
minus because the force is opposing
76
00:05:20,370 --> 00:05:25,260
the the direction of theta multiplied by the
moment arm, which is half the length of the
77
00:05:25,260 --> 00:05:28,260
road, so multiply by R over two.
78
00:05:28,890 --> 00:05:31,260
So I am creating expressions right now.
79
00:05:31,710 --> 00:05:35,520
They are all this is very different than
programming in MATLAB or programming in C.
80
00:05:35,520 --> 00:05:36,930
I'm Eq..
81
00:05:36,930 --> 00:05:43,140
One is a symbolic expression that contains
these values.
82
00:05:43,320 --> 00:05:47,250
So note is that now the equation looks a
little bit more like what we want it to look.
83
00:05:47,250 --> 00:05:51,540
Although I still have Theda there, that is
kind of bothering me so I can replace that.
84
00:05:51,540 --> 00:05:59,520
Let me define Theta as the Greek symbol
corresponding to see it as a symbol of theta.
85
00:06:00,060 --> 00:06:06,150
For example, once you once you get a little
a little practice on this with a notation, it
86
00:06:06,150 --> 00:06:08,820
becomes pretty, pretty straightforward at
first.
87
00:06:09,180 --> 00:06:11,910
Maybe if you are MATLAB programmer, it might
be a little bit different.
88
00:06:12,060 --> 00:06:16,650
So if I look at Equation one again now, now
it looks more like the kind of equation that
89
00:06:16,650 --> 00:06:22,840
I want to look at. Let me get clear double.
90
00:06:22,890 --> 00:06:27,030
Let me get this second derivative of cleared
from this equation because I want theta
91
00:06:27,030 --> 00:06:29,130
double equal to something so I can.
92
00:06:29,400 --> 00:06:30,660
I can do things like this.
93
00:06:30,660 --> 00:06:35,040
For example, let me define a second a second
expression that would be the first
94
00:06:35,040 --> 00:06:36,990
expression, the first symbolic expression.
95
00:06:36,990 --> 00:06:41,370
So equation one, if I want a clear m r
squared over three, I'm going to divide this
96
00:06:41,370 --> 00:06:46,470
by m multiply by r squared, divided by
three.
97
00:06:46,860 --> 00:06:50,880
So I am dividing both sides of the
expression by M.R.
98
00:06:50,880 --> 00:06:51,930
Square over three.
99
00:06:52,080 --> 00:06:54,720
So now it's clearing out three double dots.
100
00:06:54,720 --> 00:06:57,660
Theta double dot is equal that a function of
sine of fidelity.
101
00:06:57,690 --> 00:06:58,710
This is a differential.
102
00:06:58,830 --> 00:07:00,870
Second order nonlinear differential
equation.
103
00:07:01,500 --> 00:07:03,650
I can try to solve it analytically.
104
00:07:03,660 --> 00:07:07,890
And by the way, there is some menus here
that allow me access to some functions
105
00:07:07,890 --> 00:07:09,510
directly without me having to memorize
everything.
106
00:07:09,840 --> 00:07:11,740
So there solve all these.
107
00:07:11,760 --> 00:07:18,240
This is the form of the equation for of the
expression, for solving differential
108
00:07:18,240 --> 00:07:21,390
equations. So by the way, this is all like
MATLAB.
109
00:07:22,020 --> 00:07:25,110
So let me open, bring it up a little bit.
110
00:07:25,110 --> 00:07:27,300
So if I put my cursor on top of one of the
functions.
111
00:07:28,200 --> 00:07:30,630
Notice how it will give me the form of the
expression.
112
00:07:31,230 --> 00:07:35,730
So this tells me, oh, in curly brackets, I
have to put the equation and the initial
113
00:07:35,730 --> 00:07:37,290
conditions to solve the differential
equation.
114
00:07:38,310 --> 00:07:40,530
Or you can also use the f one command.
115
00:07:40,630 --> 00:07:44,860
To go directly to the documentation, same as
you do in Malta, where there's examples,
116
00:07:44,860 --> 00:07:46,360
explanation, everything.
117
00:07:47,440 --> 00:07:50,590
So the equation I want to solve again, curly
brackets.
118
00:07:51,250 --> 00:07:54,400
So just remember that the equation I want to
solve is equation two.
119
00:07:54,730 --> 00:07:58,810
And the initial conditions, because it's a
second order, I have to give two initial
120
00:07:58,810 --> 00:08:01,450
conditions. I have to give an initial
condition for Theda.
121
00:08:02,530 --> 00:08:06,730
In order for our pendulum to flip around, we
need to give it a little bit of an angle to
122
00:08:06,730 --> 00:08:09,010
start moving. Otherwise everyone is just
going to hang there.
123
00:08:09,010 --> 00:08:13,690
So I'm going to give it a small angle pi
over 12, and then I need the initial
124
00:08:13,690 --> 00:08:16,730
condition for the velocity to because it's a
second order thing.
125
00:08:16,750 --> 00:08:18,370
I'm going to say the velocity is equal to
zero.
126
00:08:19,480 --> 00:08:25,000
And here is what variable I am solving for,
which is speed of T in this case.
127
00:08:25,420 --> 00:08:30,820
So as in any symbolic analysis tool to solve
differential equations, this is going to look
128
00:08:30,820 --> 00:08:35,620
for patterns. And this form this this form
of this equation, this particular form of
129
00:08:35,620 --> 00:08:37,820
this equation c the double dot equals sign
of theta.
130
00:08:37,840 --> 00:08:40,740
It doesn't have a closed form solution.
131
00:08:40,750 --> 00:08:44,170
So what this is telling me is that there's
no close frame solution.
132
00:08:44,170 --> 00:08:45,900
It's just giving me back the equation.
133
00:08:45,910 --> 00:08:50,920
And so if I want to solve this in this
particular case, let me add a little comment
134
00:08:50,920 --> 00:08:53,500
here. I'm going to use a small numerical
trick.
135
00:08:53,890 --> 00:08:59,830
So when you have very small angles, you can
you can use what is called the small angle
136
00:08:59,830 --> 00:09:06,040
approximation, which means which says that
for a small angle, that's the value of the
137
00:09:06,040 --> 00:09:10,330
sign of theta is is the same as the value of
theta in radiance.
138
00:09:10,450 --> 00:09:13,780
So let me create a third expression here.
139
00:09:13,780 --> 00:09:20,050
I'm going to create Equation three, Equation
three, and that's going to be what I'm going
140
00:09:20,050 --> 00:09:26,050
to do is I'm going to use the command subs,
which substitutes substitutes in equation to
141
00:09:26,080 --> 00:09:27,880
substitute in equation two.
142
00:09:28,180 --> 00:09:29,770
What is it that I want to substitute?
143
00:09:29,770 --> 00:09:36,220
I want a substitute sign of theta of T sine
a fleet of T.
144
00:09:37,390 --> 00:09:40,300
I want to substitute that for just three of
the.
145
00:09:40,640 --> 00:09:45,970
So what I'm saying in this with this command
is wherever in this expression equation to
146
00:09:46,000 --> 00:09:49,990
wherever you find sine of feed of T, just
replace it by by thede of TW.
147
00:09:50,110 --> 00:09:54,530
So notice how it always has done it has done
that, that substitution.
148
00:09:54,680 --> 00:09:58,870
And now I have a second order linear
differential equation, which hopefully I can
149
00:09:58,870 --> 00:09:59,920
solve analytically.
150
00:10:00,280 --> 00:10:03,880
Actually, I will be able to solve this
analytically, so let me use the same command.
151
00:10:03,880 --> 00:10:08,500
Only in this case, I'm going to solve
equation three same initial conditions.
152
00:10:08,500 --> 00:10:13,090
Let me run it, and it's giving me a general
solution of the differential equation, any
153
00:10:13,090 --> 00:10:15,100
symbolic analysis to do this.
154
00:10:15,250 --> 00:10:19,270
So it's giving me all the possible
conditions, but we have some physical insight
155
00:10:19,270 --> 00:10:21,840
into this. We know that gravity is not equal
to zero.
156
00:10:21,850 --> 00:10:25,960
So what I'm going to do is I'm going to add
a little a little additional command here.
157
00:10:25,960 --> 00:10:30,640
I'm going to say assuming solve it, assuming
that G is greater than zero because I know
158
00:10:30,640 --> 00:10:32,800
that and also we can help it a little bit
more.
159
00:10:33,030 --> 00:10:37,090
Even we can say we know that our the length
of the road is greater than zero.
160
00:10:37,420 --> 00:10:39,310
So now it gives me a better form.
161
00:10:39,310 --> 00:10:44,400
So as a slightly prettier solution, I can
replace the values of G.
162
00:10:44,410 --> 00:10:47,620
For example, G I know is nine point eighty
one.
163
00:10:49,360 --> 00:10:53,770
I know. Ah, let me define our SEM value.
164
00:10:53,770 --> 00:10:55,450
Let me say VAR is equal to one.
165
00:10:57,010 --> 00:11:02,800
Now, if I look at Saul again, I will have an
evaluation of the numerics here.
166
00:11:03,790 --> 00:11:07,780
Notice that it's in curly brackets because
it's giving me a vector of solutions, really.
167
00:11:07,780 --> 00:11:14,020
So if I want, I'm going to define Redefine
Saul as just the first element of that
168
00:11:14,020 --> 00:11:16,510
vector. And so now I'm extracting it out.
169
00:11:16,510 --> 00:11:17,730
That's the element I want.
170
00:11:17,740 --> 00:11:21,310
And once I have this solved, I can actually
just do all kinds of things I can do
171
00:11:21,310 --> 00:11:23,380
plotting, for example, I'm going to plot
Saul.
172
00:11:24,340 --> 00:11:27,220
And it's a function of T, so I need to tell
it.
173
00:11:27,370 --> 00:11:30,730
I want T to vary from zero to five seconds.
174
00:11:30,730 --> 00:11:37,600
For example, let me press enter, and that is
going to evaluate the the expression for T
175
00:11:37,600 --> 00:11:42,460
equals zero, for T equals zero to five this
analytic expression.
176
00:11:42,790 --> 00:11:47,050
Once I have this, not only I have a clean
solution that I can change and modify and
177
00:11:47,050 --> 00:11:49,030
correct or whatever, but I can also.
178
00:11:49,060 --> 00:11:53,380
Well, first of all, save it as a notebook
that I can share with other people that have
179
00:11:53,380 --> 00:11:55,120
MATLAB and the symbolic tool.
180
00:11:55,150 --> 00:11:56,370
Or I can export it.
181
00:11:56,380 --> 00:12:00,700
I can export it where it's going to put it
in my images, director.
182
00:12:00,700 --> 00:12:05,350
I'm going to export it as like my pendulum,
for example, my pendulum.
183
00:12:06,220 --> 00:12:12,070
And you can export things as PDFs, as HTML,
as just text.
184
00:12:12,220 --> 00:12:16,120
I'm going to just select the default, which
is PDFs and stay safe.
185
00:12:16,450 --> 00:12:20,300
So what I has done is it has saved this
notebook into a PDF format.
186
00:12:20,320 --> 00:12:22,870
Actually, let me go back one here.
187
00:12:22,870 --> 00:12:24,970
It's in my images directory now.
188
00:12:25,300 --> 00:12:27,790
So here I should have some PDF.
189
00:12:28,000 --> 00:12:29,920
There go my pendulum PDF.
190
00:12:29,920 --> 00:12:34,600
So let me open it outside of MATLAB and I
have a fully documented version of the
191
00:12:34,600 --> 00:12:38,140
analysis that I just did with all the
plotting, all the commands, all the
192
00:12:38,140 --> 00:12:39,580
expressions. And it is a.
193
00:12:39,770 --> 00:12:44,840
The file, so I can email it to whoever I
want, and they don't need to have MATLAB to
194
00:12:44,840 --> 00:12:50,720
take a look at it. The one thing that I
wanted to show you to let me go back to the
195
00:12:50,720 --> 00:12:52,190
directory where I was before.
196
00:12:53,660 --> 00:12:58,880
So what I have here is a MATLAB script that
shows some of the interconnection between
197
00:12:58,880 --> 00:13:03,290
mobile and MATLAB and the big a big part of
the power of this tool is the fact that it
198
00:13:03,290 --> 00:13:07,880
runs on MATLAB so you can once you have your
script, you can call it from MATLAB.
199
00:13:07,880 --> 00:13:10,100
You can do you can evaluate all the
functionality.
200
00:13:10,730 --> 00:13:15,830
This is exactly the same script that that
same archive that it just created before.
201
00:13:15,830 --> 00:13:19,610
Only I have a few more comments, but the
important thing is here at the end, we are
202
00:13:19,610 --> 00:13:24,860
defining a variable. So it's a symbolic
variable and I want you to notice, let me go
203
00:13:24,860 --> 00:13:26,150
back to my script.
204
00:13:26,180 --> 00:13:33,530
There's commands like get VAR MATLAB
functions like get VAR and set VAR that allow
205
00:13:33,540 --> 00:13:38,300
you to communicate back and forth, either
from the Muppet notebook into MATLAB or vice
206
00:13:38,300 --> 00:13:42,500
versa. I'm going to use that notebook that I
created.
207
00:13:43,070 --> 00:13:47,800
I want to bring up the variable Salz, and
it's going to put it into a variable my soul.
208
00:13:47,810 --> 00:13:52,940
So when I run that, if I look at MATLAB now,
I have my sole variable, which is a symbolic
209
00:13:52,940 --> 00:13:54,650
expression. I can look at it here.
210
00:13:55,160 --> 00:13:58,250
It's the symbolic expression of what I just
calculated there.
211
00:13:58,280 --> 00:14:03,740
This is still a symbolic expression, so if I
want to actually use it, there's commands
212
00:14:03,740 --> 00:14:07,550
like MATLAB function that allow you to
convert that symbolic expression into a
213
00:14:07,550 --> 00:14:09,950
numeric expression that can be evaluated by
MATLAB.
214
00:14:10,430 --> 00:14:14,660
You can create function handles, or you can
let me run this second one here.
215
00:14:14,660 --> 00:14:18,290
So this is going to create actually a
function file, for example.
216
00:14:18,620 --> 00:14:25,370
So it just created here my func file Durham,
which is a fully operational numerical MATLAB
217
00:14:25,370 --> 00:14:26,630
evaluation function.
218
00:14:26,630 --> 00:14:30,880
So you can call it from your MATLAB script
so you can put it in a block in signaling,
219
00:14:30,890 --> 00:14:32,390
for example, there's output.
220
00:14:32,420 --> 00:14:34,730
There's automated automatic ways of doing
this.
221
00:14:34,970 --> 00:14:40,340
And so if you look at the script again here,
there's a commands like MATLAB function block
222
00:14:40,370 --> 00:14:46,010
that allows you to directly from the
symbolic expression, create a simulant block
223
00:14:46,010 --> 00:14:48,770
that you can use for a dynamic simulation,
for example.
224
00:14:49,550 --> 00:14:55,460
Let me go back to my slides right now, so I
have shown you how you can use a symbolic
225
00:14:55,460 --> 00:14:59,540
interface to analytically solve a problem
and create equations.
226
00:14:59,540 --> 00:15:04,320
This symbolic analysis tool has multiple
animation commands.
227
00:15:04,340 --> 00:15:09,470
It's very powerful to do visualization and
graphics, so I would recommend you guys take
228
00:15:09,470 --> 00:15:13,070
a look at it. So once I have the
differential equation, I can solve it.
229
00:15:13,070 --> 00:15:19,520
If it has an analytic solution, I can solve
it in the new power interface or I can solve
230
00:15:19,520 --> 00:15:20,540
it numerically.
231
00:15:21,710 --> 00:15:28,490
So Nimue, but also has numerical solvers that
allow you to to solve a nonlinear
232
00:15:28,490 --> 00:15:32,960
differential equations, for example, or you
can obviously bring it back to MATLAB.
233
00:15:32,990 --> 00:15:38,000
Matlab has all kinds of 0d solvers, ordinary
differential equations, solvers that can be
234
00:15:38,000 --> 00:15:41,780
called once you define the function that you
want to solve the set of differential
235
00:15:41,780 --> 00:15:43,040
equations that you want to solve.
236
00:15:43,070 --> 00:15:48,590
You can call the odd solver, and that would
solve that will give you the solution of that
237
00:15:48,590 --> 00:15:50,330
differential equation in this case.
238
00:15:50,360 --> 00:15:52,700
This example, for example, I'm here.
239
00:15:52,700 --> 00:15:56,510
You noticed that the equation that I'm
solving and I'm calling an odyssey solver to
240
00:15:56,510 --> 00:16:05,180
do it, or I can bring this up to simulate,
for example, let me go, let me go back to my
241
00:16:05,960 --> 00:16:09,080
my script here, and I'm going to open a
single example.
242
00:16:09,080 --> 00:16:12,080
This is a similar implementation.
243
00:16:12,560 --> 00:16:16,370
This is a similar implementation of that
differential equation that I calculated
244
00:16:16,370 --> 00:16:21,320
analytically simulating such all kinds of
mathematical capabilities to build any kind
245
00:16:21,320 --> 00:16:25,850
of linear, nonlinear, continuous,
discontinuous differential equation and
246
00:16:25,850 --> 00:16:30,320
simulating already has the notion of time
and all that all the numerical solvers
247
00:16:30,320 --> 00:16:34,850
embedded in it. So I don't have to worry
about calling the different the the numerical
248
00:16:34,850 --> 00:16:39,620
integrators. I just build my equation
simulating press play, and in this case, it
249
00:16:39,620 --> 00:16:41,150
will be running it with an O.D.
250
00:16:41,270 --> 00:16:45,740
or the rancor of four or five algorithm, and
it's giving me the solution of that
251
00:16:45,740 --> 00:16:47,000
differential equation.
252
00:16:47,030 --> 00:16:51,680
The advantage of the graphical nature of
simulation is that you can componentes things
253
00:16:51,680 --> 00:16:53,450
and start very quickly changing things.
254
00:16:53,450 --> 00:16:57,650
If I want to add additional nonlinear it is
there's all kinds of blocks that allow you to
255
00:16:57,650 --> 00:17:02,930
do saturations and backlashes and all lookup
tables.
256
00:17:03,860 --> 00:17:07,700
If you start, if you start programming
systems that are much bigger in MATLAB
257
00:17:07,700 --> 00:17:12,010
becomes very complicated to manage one.
258
00:17:12,050 --> 00:17:16,760
The other part of the power of this is the
fact that signaling us, as I showed you with
259
00:17:16,760 --> 00:17:22,420
MOBA runs on top of MATLAB so it can make
use of the programming capability of MATLAB.
260
00:17:22,430 --> 00:17:27,550
So let me close this and show you one more
example where I have a MATLAB script.
261
00:17:27,560 --> 00:17:30,920
This is a MATLAB script where you have
MATLAB commands that allow you to talk
262
00:17:30,920 --> 00:17:32,790
between MATLAB and signaling.
263
00:17:32,810 --> 00:17:34,520
So there's full communication here.
264
00:17:34,520 --> 00:17:36,200
I'm opening a system.
265
00:17:36,590 --> 00:17:38,390
It's just the same equation that I show you.
266
00:17:38,390 --> 00:17:41,120
Only I added like a dumping and dumping
element.
267
00:17:41,690 --> 00:17:46,070
This is a full, full dynamic simulation
environment, so all the integration is
268
00:17:46,070 --> 00:17:47,330
happening automatically.
269
00:17:47,380 --> 00:17:51,470
Now I am seeing seeing the behavior of the
system in this case has damping.
270
00:17:51,470 --> 00:17:52,730
So the oscillation is.
271
00:17:52,820 --> 00:17:59,450
Coming down. But the important part here is
that because I can run this from a script and
272
00:17:59,930 --> 00:18:05,030
outside of all this stuff, that is a lot of
graphics, what I want to wear you, I want you
273
00:18:05,030 --> 00:18:10,310
to pay attention to this line in the in the
in the script, the same line, same is a
274
00:18:10,310 --> 00:18:16,520
MATLAB function that allows you to call a
dynamic simulation, so simulates a dynamic
275
00:18:16,520 --> 00:18:20,540
system. So you tell tell MATLAB what model
you want to run and what are the parameters
276
00:18:20,540 --> 00:18:22,070
that you want to use for a particular
simulation.
277
00:18:22,940 --> 00:18:26,960
And the cool thing is that you can put that
inside a for loop, for example, and very
278
00:18:26,960 --> 00:18:30,020
quickly run a parameter sweep or multiple
parameters.
279
00:18:30,500 --> 00:18:35,450
You can see how you can have like nested for
loops where you switch many, many parameters
280
00:18:35,450 --> 00:18:41,240
and then automatically, I can play here and
this is going to use the simulation model in
281
00:18:41,240 --> 00:18:44,660
the background is going to run it many, many
times, and it's going to automatically
282
00:18:44,660 --> 00:18:45,860
capture all the result.
283
00:18:45,860 --> 00:18:50,540
And I'm putting them all in a printed matter
plot, for example.
284
00:18:50,870 --> 00:18:56,810
So a big value of the environment is the
fact that all these tools can talk to each
285
00:18:56,810 --> 00:18:58,220
other, as I just showed you.
286
00:18:59,210 --> 00:19:01,220
Now let's go back to our original problem.
287
00:19:01,220 --> 00:19:05,480
We have a full full six degrees of freedom
mechanism, and I just started with a single
288
00:19:05,480 --> 00:19:08,510
pendulum. So let me extend the approach to a
double pendulum.
289
00:19:08,510 --> 00:19:13,100
And very quickly when you start doing this,
it becomes it starts becoming complicated pre
290
00:19:13,100 --> 00:19:18,380
pretty easily. And because now you have
relative motion and the inertia are varying.
291
00:19:18,380 --> 00:19:24,650
So the equations for solving this are more
are much more complicated than that than just
292
00:19:24,650 --> 00:19:25,790
using Newton's law.
293
00:19:25,850 --> 00:19:29,270
Actually, I did the exercise just to figure
out how complicated will be.
294
00:19:29,320 --> 00:19:31,730
No, and I'm not trying to exaggerate here.
295
00:19:31,730 --> 00:19:36,230
I'm just using Euler LeoGrande equations,
calculating the the energies, kinetic and
296
00:19:36,230 --> 00:19:41,840
potential energy to to express the different
differential equations and notice that it
297
00:19:41,840 --> 00:19:46,790
took me seven or eight pieces of paper to
write those equations for just a double
298
00:19:46,790 --> 00:19:52,880
pendulum. Of course, you can do this still
with me, but let me show you actually that
299
00:19:52,880 --> 00:19:54,290
one will be worth showing you.
300
00:19:55,160 --> 00:19:57,590
Let me go back to my script here.
301
00:20:00,120 --> 00:20:02,970
So this, again, is a mute notebook.
302
00:20:03,180 --> 00:20:05,520
But in this case, I have done all the
analysis.
303
00:20:06,090 --> 00:20:07,860
Let me evaluate it.
304
00:20:08,220 --> 00:20:11,640
I have done all the analysis for a double
pendulum in this case.
305
00:20:12,630 --> 00:20:18,870
While this is solving it, what I want to
mention is, again, I am trying to get insight
306
00:20:18,870 --> 00:20:23,490
into the problem that I'm trying to solve,
and that's why I'm getting and I'm trying to
307
00:20:23,490 --> 00:20:28,200
get an idea of the effects of the lengths or
the effects of the the initial conditions,
308
00:20:28,200 --> 00:20:31,440
maybe and see what my ranges of motion are.
309
00:20:31,470 --> 00:20:33,030
But notice here I have.
310
00:20:33,180 --> 00:20:38,370
I am. When this becomes a big advantage, now
I'm telling you from doing it on paper, which
311
00:20:38,370 --> 00:20:39,690
is super prone to error.
312
00:20:39,810 --> 00:20:43,470
I cannot tell you how many hours I spent
writing it in paper.
313
00:20:43,470 --> 00:20:45,630
So I have some say my clean solution.
314
00:20:45,900 --> 00:20:51,510
But getting I'm making a mistake on a sign
or on a simple derivative is very easy.
315
00:20:51,690 --> 00:20:58,260
So here I define positions as length times,
cosine of angles, for example, and to
316
00:20:58,260 --> 00:21:03,180
calculate velocities and accelerations, I
simply differentiate positions, differentiate
317
00:21:03,180 --> 00:21:10,290
velocities. I am using Euler, Lagrange,
Lagrange equations of motion to solve this
318
00:21:10,290 --> 00:21:14,160
problem. No, because it's the generic
equation that solves that allows me to solve
319
00:21:14,160 --> 00:21:16,080
multi degrees of freedom mechanisms.
320
00:21:16,110 --> 00:21:19,440
I have to calculate the Lagrange point,
which would require me to calculate the
321
00:21:19,440 --> 00:21:21,480
kinetic energy and look.
322
00:21:21,900 --> 00:21:25,920
So even for a double pendulum, this
expression start getting really, really ugly.
323
00:21:26,700 --> 00:21:31,080
Potential energy I calculate the Lagrangian,
which is the difference between those two.
324
00:21:31,200 --> 00:21:35,430
Then I have to start taking partial
derivatives with respect to each one of the
325
00:21:35,430 --> 00:21:41,640
states. So this is this is really cumbersome
when you're doing it without the help of some
326
00:21:41,640 --> 00:21:43,350
kind of symbolic analysis tool.
327
00:21:43,860 --> 00:21:50,300
And eventually, I will get to the to the
basic equations of motion to a connected
328
00:21:50,310 --> 00:21:53,820
second order, nonlinear differential
equations that you are seeing down here once
329
00:21:53,820 --> 00:21:55,020
I replace all the values.
330
00:21:55,290 --> 00:22:00,390
So now I can use this for my similar model,
for example, or I can solve them here.
331
00:22:00,390 --> 00:22:03,420
I'm showing here the use of the numerical
solvers in Newport.
332
00:22:04,530 --> 00:22:09,990
I am. This is again, this form equation
doesn't have a closed form solution, so I
333
00:22:09,990 --> 00:22:11,310
need to solve it numerically.
334
00:22:11,400 --> 00:22:15,690
And so this is doing the numerical solution,
and I'm showing I want to show a little bit
335
00:22:15,690 --> 00:22:20,080
of the animation capability so you can
create objects, all kinds of access.
336
00:22:20,100 --> 00:22:25,170
What this animation is showing you is it's
animating the solution of that pair of
337
00:22:25,170 --> 00:22:27,120
differential equations, for example.
338
00:22:27,990 --> 00:22:29,220
Let me just stop that.
339
00:22:30,000 --> 00:22:34,260
Of course, as I said, once I get the
equations, you can actually build them in
340
00:22:34,260 --> 00:22:38,550
simulation. So once I have those equations,
I can use Smerling to build those
341
00:22:38,550 --> 00:22:43,230
expressions. The more complicated the
problem, the more complicated the models are
342
00:22:43,230 --> 00:22:48,780
going to become. So there are many, many
terms in this case, but I can component so I
343
00:22:48,780 --> 00:22:53,040
can start adding elements and notice that
I'm doing the integration from three double
344
00:22:53,040 --> 00:22:59,460
dot to fit a dot to Theda in this very
simple form, just by adding integrator blocks
345
00:22:59,460 --> 00:23:03,930
and signaling. And the solution that you're
going to see here is exactly the same as the
346
00:23:03,930 --> 00:23:05,010
solution that you get.
347
00:23:05,010 --> 00:23:10,560
If you do the analytics, it's the analytics
or if you're doing a numerical source using a
348
00:23:10,560 --> 00:23:15,900
numerical solver. But the problem that we
are noticing is that the more complicated the
349
00:23:15,900 --> 00:23:18,690
problem becomes, the more complicated these
equations become.
350
00:23:18,690 --> 00:23:22,830
So it gets to a point where those equations
are not going to give me very much insight.
351
00:23:23,070 --> 00:23:27,990
So there are there's this saying about using
the appropriate tool for the appropriate
352
00:23:27,990 --> 00:23:32,100
problem. So if we want to think of this
problem, this mechanics, so if we want to
353
00:23:32,100 --> 00:23:36,000
think of this problem in a slightly
different way now, for example, think of
354
00:23:36,000 --> 00:23:41,490
mechanisms as just bodies, rigid bodies that
have inertia and masses, and they have
355
00:23:41,490 --> 00:23:45,210
degrees of freedom that are giving back
given by certain joints.
356
00:23:45,480 --> 00:23:49,650
We have a specific tool called simple
mechanics that is a part of signaling that
357
00:23:49,650 --> 00:23:52,200
allows you to model this in a very straight
manner.
358
00:23:53,250 --> 00:23:58,480
So let me go to the tool to show you how a
little bit of how the mechanics works.
359
00:23:58,500 --> 00:24:00,090
So first, I'm in MATLAB.
360
00:24:00,090 --> 00:24:04,470
I can open simulant using the simulant icon
or by typing Citilink at the MATLAB command.
361
00:24:04,500 --> 00:24:07,860
This is the basic signaling library browser.
362
00:24:07,950 --> 00:24:13,680
Now what you're seeing here is the space
signaling product that has all the
363
00:24:13,680 --> 00:24:19,770
mathematical blocks to do integration
systems of differential equations, transfer
364
00:24:19,770 --> 00:24:22,520
functions. You can do all kinds of nonlinear
charities.
365
00:24:23,550 --> 00:24:27,870
You have all kinds of mathematical
operations that you can implement and
366
00:24:27,870 --> 00:24:31,470
underneath. Here you see a list of add on
products or signaling.
367
00:24:31,470 --> 00:24:35,870
So under the same scope heading here, you
will find some mechanics.
368
00:24:35,880 --> 00:24:41,220
So same mechanics is our three dimensional
mechanical modeler, and it's all based on
369
00:24:41,220 --> 00:24:42,510
rigid body dynamics.
370
00:24:42,510 --> 00:24:47,790
So you see libraries for bodies and joints,
and the way you model things here is let me
371
00:24:47,790 --> 00:24:49,410
open a blank canvas here.
372
00:24:49,440 --> 00:24:53,550
Let me dragging a body and a body is
defined.
373
00:24:54,630 --> 00:24:58,140
A body is defined by its mass and its
inertia tensor.
374
00:24:58,330 --> 00:25:02,540
And what you see on this table here are the
coordinated locations of hookup points.
375
00:25:02,560 --> 00:25:07,660
So where those see us one and see us to see
a stance for coordinated systems?
376
00:25:07,700 --> 00:25:14,800
And so I am going to define key one as zero
zero zero with respect to an adjoining
377
00:25:14,800 --> 00:25:19,690
reference. What that means is that this
coordinate system is going to fall on top of
378
00:25:19,690 --> 00:25:21,580
whatever it is is connected to.
379
00:25:21,760 --> 00:25:24,520
And what I am going to do is I am going to
define the CG.
380
00:25:24,520 --> 00:25:26,920
I'm going to have very simple. Simply create
a bar.
381
00:25:26,920 --> 00:25:31,840
For example, I'm going to say the CG is one
meter on the X direction with respect to that
382
00:25:31,840 --> 00:25:37,600
c one. And that as to the second hook up
point is going to be two meters to the right
383
00:25:37,750 --> 00:25:40,300
of that kes one point, for example.
384
00:25:40,480 --> 00:25:45,010
So I am just I'm doing a relative notation,
for example, in this case, I'm creating a two
385
00:25:45,010 --> 00:25:46,180
meter long bar.
386
00:25:46,210 --> 00:25:51,010
The CG is in the middle and then one extreme
is the zero or the other extreme is up to
387
00:25:51,160 --> 00:25:56,830
four. Because for the sake of argument here,
what we're doing is we're let's let's imagine
388
00:25:56,830 --> 00:26:01,810
that X is a horizontal axis here and Y is a
vertical axis here.
389
00:26:02,140 --> 00:26:07,450
So then that means that C would be the z
axis will be coming out of the screen,
390
00:26:07,450 --> 00:26:10,060
essentially. So I have a body I can bring
in.
391
00:26:10,780 --> 00:26:13,990
I'm going to bring our ground a reference
because that's what this is.
392
00:26:14,410 --> 00:26:17,470
This is going to be all these measurements
are going to be referenced to some kind of
393
00:26:17,470 --> 00:26:21,430
ground. This is just a coordinate location
of that ground.
394
00:26:21,430 --> 00:26:27,130
I need an environment port because every
time you, you create a machine in mechanics,
395
00:26:27,130 --> 00:26:29,240
you have to bring one of this solver point.
396
00:26:29,270 --> 00:26:31,010
What one of the solver blocks.
397
00:26:31,030 --> 00:26:36,970
Let me flip it around, and this environment
is going to control how the solution of the
398
00:26:36,970 --> 00:26:39,370
equations of motion for the mechanism are
happening.
399
00:26:39,820 --> 00:26:43,850
So here you define your constraints and
tolerances for that solver.
400
00:26:43,870 --> 00:26:45,520
And also, you define the direction of
gravity.
401
00:26:46,030 --> 00:26:48,580
By default, gravity is negative in the y
direction.
402
00:26:49,060 --> 00:26:50,320
So it's vertical here.
403
00:26:50,320 --> 00:26:53,410
So we're happy with that, but we can input
it from the outside.
404
00:26:54,460 --> 00:26:58,150
If I connect this to, nothing is going to
happen because as I'm connecting my bar to
405
00:26:58,150 --> 00:27:03,140
ground, so the way you give motion to things
is by adding degrees of freedom and the way
406
00:27:03,160 --> 00:27:07,120
degrees of freedom are added is by using
this libraries of joints.
407
00:27:07,330 --> 00:27:10,450
So notice that the library of joints has all
kinds of combinations here.
408
00:27:10,540 --> 00:27:16,750
Bushings one degree of freedom, revolution
or prismatic joint up to six degrees of
409
00:27:16,750 --> 00:27:18,640
freedom. In this case, what I want is a
revolution.
410
00:27:19,210 --> 00:27:23,680
A revolution is how you will think of a has
opened a door, for example, a hinge on a
411
00:27:23,680 --> 00:27:27,250
door, and also on one side, they have the
frame of the door and the other side I have
412
00:27:27,250 --> 00:27:28,450
my moving pendulum.
413
00:27:28,720 --> 00:27:32,560
And the way joints are defined is by an axis
of action.
414
00:27:32,830 --> 00:27:36,610
So notice that the axis of action for this
joint is zero zero one is around.
415
00:27:36,730 --> 00:27:39,700
It's a rotational degree of freedom around
the z axis.
416
00:27:39,700 --> 00:27:44,170
So around the axis coming out of the screen,
which is what I want.
417
00:27:44,380 --> 00:27:47,840
So I have a bar that is going to rotate
around that point.
418
00:27:47,860 --> 00:27:52,870
So once I have set all that I can, and
because this is a three dimensional
419
00:27:52,870 --> 00:27:55,030
mechanical modelling tool, it has a
visualization.
420
00:27:55,900 --> 00:27:57,100
So I'm going to just set it.
421
00:27:57,100 --> 00:28:00,160
So it it starts when I run the simulation
here.
422
00:28:01,960 --> 00:28:07,570
Some mechanics show animation and display
machines when we update the diagrams.
423
00:28:08,200 --> 00:28:09,610
That's all I need to do to turn on the
animation.
424
00:28:11,080 --> 00:28:15,820
And when I press play here, what you're
going to see is the animation is going to
425
00:28:15,820 --> 00:28:22,330
start. The animation is going to start and I
have a bar that is freely rotating.
426
00:28:22,510 --> 00:28:24,370
Let me run it again here.
427
00:28:24,400 --> 00:28:28,470
So this is a single pendulum rotating back
and forth.
428
00:28:28,480 --> 00:28:33,760
This is the zero zero where the ground
location is my CG and that system is over
429
00:28:33,760 --> 00:28:38,080
here. But notice that this doesn't look very
realistic because I'm just rotating.
430
00:28:38,080 --> 00:28:41,890
I this will keep on rotating no matter how
long I'm simulating it, because the joint
431
00:28:41,890 --> 00:28:44,720
that I have defined is an idealized joint.
432
00:28:44,740 --> 00:28:47,680
There's no no friction, no no damping, no
losses.
433
00:28:48,340 --> 00:28:50,880
So this will keep on rotating forever.
434
00:28:50,890 --> 00:28:56,740
So the way I can affect joints, for example,
is by opening additional ports so I can open
435
00:28:56,740 --> 00:29:01,240
however many ports. I want notice that a
couple of extra years appear on this, and
436
00:29:01,240 --> 00:29:05,800
when I go in the library, there's a section
for sensors and actuators so you can activate
437
00:29:05,800 --> 00:29:07,660
on bodies and measure things from bodies.
438
00:29:07,660 --> 00:29:10,630
Or you can activate on joints and measure
things from joints.
439
00:29:10,690 --> 00:29:16,960
Let me bring a joint actuator and I joined
sensor so I can activate on this with any
440
00:29:16,960 --> 00:29:21,280
kind of signaling calculation and I can
measure things, for example.
441
00:29:21,280 --> 00:29:26,860
So this actuators allow me to activate with
either talks or forces, or I can do motion
442
00:29:26,860 --> 00:29:30,520
profiles, for example, if I want to send a
motion for a specific motion profile.
443
00:29:30,550 --> 00:29:36,790
I can set it like this now if I want to
apply a damping force, for example.
444
00:29:36,790 --> 00:29:41,410
To make this more realistic, a damping force
is going to be proportional to the velocity
445
00:29:41,410 --> 00:29:43,250
in which at which this is rotating.
446
00:29:43,270 --> 00:29:48,800
So in my measurement side, I can select
notice that it recognizes it's a revolution
447
00:29:48,820 --> 00:29:51,910
or it gives me all the possible measurements
that I might want from a revolution.
448
00:29:52,120 --> 00:29:55,990
I can measure angle, angular velocity talks,
for example.
449
00:29:55,990 --> 00:29:57,940
I'm going to measure an angular velocity in
this.
450
00:29:58,160 --> 00:30:00,550
Case that is going to come out as a symbolic
signal.
451
00:30:01,160 --> 00:30:07,430
And I can actually feed it back if I want to
as a force is going to be fed back as a force
452
00:30:07,430 --> 00:30:09,130
proportional to the velocity.
453
00:30:09,140 --> 00:30:11,060
In this case, I want it proportional to the
velocity.
454
00:30:11,540 --> 00:30:16,710
So let me let me go to my simple math
operators and bring in again here.
455
00:30:16,730 --> 00:30:20,810
So it's going to be proportional to the
velocity and it's going to be opposing the
456
00:30:20,810 --> 00:30:21,200
motion.45287
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.