The following content is provided under a Creative
Commons license.
Your support will help MIT OpenCourseWare
continue to offer high-quality educational resources for free.
To make a donation or view additional materials
from hundreds of MIT courses, visit MIT OpenCourseWare
at ocw.mit.edu.
PROFESSOR: OK.
Welcome back.
If all goes well, we'll be joined in a few minutes
by a simple pendulum, a little robot
that we're going to demonstrate everything.
It turns out we had a little license
issues in the last minute, but we're
hoping to bring down and actually play
with a real pendulum today.
The goal of today is fairly modest.
We're just going to think about pendula, a simple pendulum.
When I say a simple pendulum, I mean
the mass is concentrated at the endpoint.
Typically, we assume that the inertia of the rod
is negligible.
In many cases, I'll write the inertia in there just in case.
OK.
So why should we spend an entire lecture on a simple pendulum?
Right?
It seems boring.
Well, I think you could argue that if you
know what the simple pendulum does,
and you know what it does when it's
got complicated interaction forces, then
everything, because most of our robots
are just a bunch of pendula.
But more important, I think, is that the pendulum
is simple enough that we can pretty much
completely understand it in a single lecture.
And it's going to be an opportunity for me to introduce
basically all of the topics I want to introduce in terms
of nonlinear dynamics and the basic definitions
that we're going to use throughout the class,
and I can plot everything about it.
So actually, even in research, when we're testing out
new algorithms, we almost always spend a lot of time thinking
about how it works on the simple pendulum.
OK?
It's so simple, but it's a staple.
OK.
So what are the dynamics of the simple pendulum?
I told you how to do the Lagrangian dynamics quickly
yesterday, and there's a more worked-out example
in your notes.
If you pop in the Lagrangian, the energy terms,
into the Lagrangian for this system, then what you get is I
theta double dot t plus mgl sine theta equals whatever
my generalized forces are, which I've been calling Q.
And for today's purposes, let's assume
that Q, there's two generalized torques that I care about.
I want to model a damping torque,
because most pendula have some damping,
and I want to model a control input torque.
OK?
So I'm going to worry about the case
where Q is of the form negative B theta dot plus some control
input u of t.
The damping doesn't come out of Lagrange.
You think of that as an external input.
OK.
So all together, b theta dot plus mgl sine theta equals u.
OK?
All right.
So this is a one-dimensional, second-order differential
equation.
What would it mean to solve this differential equation?
To really solve this differential equation, what
that would mean is that if I gave you theta times 0
and theta dotted times 0, the initial conditions.
Right?
And I gave you some control input over time,
then I'd like you to be able to tell me theta of t
and theta dot of t.
Right?
That would be a satisfying solution to the differential
equation, if we could have that, and that's the standard way
to think about solving the differential equation.
It turns out for the pendulum, if what you care about
is the long-term dynamics of the pendulum, that's
actually not a very practical way to think
about the pendulum.
It turns out if you just try to integrate this enclosed form,
there's no solution in terms of elementary functions.
In fact, the integral of these sine terms
comes up enough that people created
a different type of function which are
sort of elementary functions.
They're called elliptic integrals of the first kind,
and long story short, there's not a lot of insight
to be gained by actually integrating,
in just a pure calculus sense, these equations.
It'll give you an elliptic function
that you could pop into Matlab and make a plot,
but it's not going to give you a lot of insight.
And actually in the notes, for completeness, I
did give you the elliptic integral form,
but I won't trouble you with that on the board here.
OK.
So maybe there's another way.
If I care about what this pendulum's going
to do in the long term, if I care about where theta is going
to be as time goes to infinity, then there
are a bunch of other techniques I can use.
OK?
And the ones that I'm going to use today
are graphical solution techniques.
And it's actually the best reference
for that is this book by Steve Strogatz called
Nonlinear Dynamics and Chaos.
Has anybody seen that book?
It's a great book, very, very readable book, just brilliant.
So it's a Nonlinear Dynamics and Chaos by Steve Strogatz.
He's at Cornell.
OK.
So let's think about how we could possibly
solve that system graphically, and let me start by solving
a slightly simpler problem.
Instead of making u a function of time,
let's make a constant torque.
OK?
And I'm going to look at a special case, where
the system has very heavy damping, just to get started.
Let's think about a special case, a very heavily damped
pendulum with constant torque.
OK?
OK.
So what do I mean by that?
So in this equation, the heavily damped, what I care about
is that the viscous forces do the damping are significant
compared to the inertial forces of the pendulum.
If you're in fluid's, it feels like a Reynolds number
argument.
This would be equivalent to having a very low Reynolds
number system.
OK?
But what I care about for this argument,
I want to say that b over I is much, much greater than 1.
Right?
And I'm going to say that u of t is just
some nominal, some constant u0.
OK?
AUDIENCE: [INAUDIBLE]
PROFESSOR: It's not a dimensionless quantity.
Right?
So if you want a dimensionless Reynolds number,
an analogy would be you'd need a square root of g
over l or some time constant on the bottom,
but this is a number with units that's greater than 1.
Good catch.
OK.
So why is this the relevant thing?
So now, if I look at the same equation,
if I do u0 minus mgl sine theta equals I
theta double dot plus be theta dot.
If b is dramatically bigger than I,
then this right-hand side looks about like just b theta dot.
These terms swap these terms.
Then, I'm going to make an approximation
of this right-hand side with just b theta dot.
Reasonable.
OK.
So the reason I'm thinking about this heavily-damped pendulum
example is because it changes our second-order system
into our first-order system.
OK?
It'll just be a way to start.
And that's a general thing.
At a very low Reynolds number, you
can start thinking of things as being mostly first order also.
OK.
So now, I've got this simpler equation.
I want to make one more simplification, actually,
for a minute.
I'm going to just forget about the fact
that theta wraps around on top of each other.
OK?
So just let's ignore wrapping.
It's not a big deal, but let's just keep it clean.
And to be very explicit about that, I'm
going to replace theta with x.
Just remember that we've ignored wrapping.
So my equations now are bx dot--
excellent-- is u0 minus mgl sine x.
Thanks, guys.
AUDIENCE: [INAUDIBLE]
PROFESSOR: Yeah.
OK.
So we have a pendulum, but it's got a boot.
So it's amazing that clocks work so well.
OK.
Simple, first-order equation, it's a nonlinear equation.
So how do I understand the long-term behavior
of that system?
OK.
Well, Strogatz says, if you've got a one-dimensional system,
first-order, then you can think of that like a flow on a line.
So let me tell you what.
So one d, first-order, we're going
to do it a flow on a line.
OK?
So what I want to plot here, I'll plot it really big.
I'm going to plot theta over here, x over here.
We're in x-coordinates here, x, and I
want to plot x dot over here.
OK?
So this is just a simple function,
x dot as a function of x.
What does it look like?
Well, it looks like negative sine of x possibly shifted
up or down a little bit.
Right?
Let's say, let me draw the no-torque input case first.
Then, it just looks like x dot is negative sine of x,
so something like this.
OK?
Where the height of that is mgl over b.
Right?
OK?
So now, can you tell me quickly where the fixed
points of the system Are
AUDIENCE: [INAUDIBLE]
PROFESSOR: Yeah.
So any time x dot equals 0, we have a fixed point
of the system, and that's really the first dynamic concept
I care about here is when, in this case, x dot equals 0.
OK?
And in this case, it's not too hard to solve
for the 0s of that equation anyways,
but graphically, it's blatantly obvious
that you get a fixed point here, a fixed point here, a fixed
point here, and of course, every 2 pi, it'll repeat.
Right?
Every pi it'll repeat.
Right?
Pretty simple.
OK.
But now, let's think about the stability of those fixed
points and not just in a local sense,
but let's really think about the stability of those fixed
points.
Is this fixed point stable?
Yes.
OK.
How can you see graphically that it's stable?
AUDIENCE: The slope is negative.
PROFESSOR: So locally, the slope tells me exactly
that if the slope is negative, then it's got to be stable.
But even in a more global nonlinear thinking about it
sense, anywhere that this curve is above the line,
that means I have a flow going to the right.
Right?
So everywhere in this regime, I know that the system
is moving that way.
Right?
Everywhere in this regime, I know
the flow's going to this way, and so on and so forth.
OK?
So even without any local analysis,
it's crystal clear that if I start the system somewhere
over here, some amount of time later it's going to be there.
Right?
So I'm going to use a filled in circle
to describe that stable fixed point,
and this one is going to be stable also.
And then is this fixed point stable or unstable?
AUDIENCE: Unstable.
PROFESSOR: Unstable, right?
Nearby points are going to leave that fixed point
and go somewhere else.
OK.
But stability is such a central concept
in robotics and in this class that I
want to be a little careful about it.
There's multiple forms of stability that we care about.
Typically, we talk about even local stability.
The first definition we care about
is a fixed point can be locally stable in the sense
of Lyapunov, which is often shorthand isl.
A fixed point can be locally, asymptotically stable,
and a fixed point can be locally, exponentially stable.
OK.
Who knows what it means to be stable in the sense
of Lyapunov?
Anybody have an intuitive understanding
of what that means?
AUDIENCE: We start within a certain distance of that point.
Well, it's kind of founded the more we go farther away.
PROFESSOR: Perfect.
Yeah.
So typically, I have to define some sort of distance metric,
let's say just some Euclidean distance.
What I want to say is that, if I start
with my initial conditions are near some point,
then they're not going to go away from that point.
And specifically, the way that the sense of Lyapunov
is written, it says if I want to guarantee that for all time
I am within this distance, say epsilon distance of the fixed
point, then you need to be able to pick
some delta, some small delta, for which
if I start the system inside the delta--
delta is going to have to be less than the epsilon--
then it'll always, for all time, it'll
stay inside the epsilon ball.
I'm going to write it down.
OK.
A fixed point, let's say that a fixed point x
star is stable in the sense of Lyapunov if for all epsilon
there exists a delta for which if x of 0 minus x
star in some norm, let's say a Euclidean distance
or something like that, is less than delta,
then for all t, x of t minus x star is less than epsilon.
Does that make sense?
OK.
So we've got a simple pendulum plot that tells us
something about stability here.
Is this fixed point stable in the sense of Lyapunov?
Yeah.
Right?
It's stable in the sense of Lyapunov.
Let's say you tell me that for all time
I want this thing to be within this epsilon distance.
Right?
Then you can pick anything, any delta
smaller than that epsilon, and I know that it's
going to stay inside that ball.
Right?
So in fact in this one, you could choose delta as epsilon,
and it would be fine.
OK?
So these flows on a line are certainly
sufficient for checking stability
in the sense of Lyapunov.
People OK with that?
Good.
OK.
What about asymptotically stable?
What does it mean intuitively to be asymptotically stable?
AUDIENCE: [INAUDIBLE]
PROFESSOR: Good.
So a system is asymptotically stable,
if as t goes to infinity x is actually
going to be at the fixed point.
If you start in a neighborhood, then as time goes to infinity,
x is actually going to get to the point.
So if x0 equals x star plus some epsilon--
I'm saying epsilon and delta meaning things that are small,
because these are, when I talk about local stability,
I mean these small things.
If x0 starts a small distance away from the fixed point,
then x at infinity equals a fixed point.
OK.
So can we tell from our plots that this thing
is asymptotically stable?
What's that?
AUDIENCE: [INAUDIBLE]
PROFESSOR: Yeah.
I think you can.
I think that this system we know is
going to go to this, as time goes to infinity.
I think that's quite OK.
Asymptotic stability is considered a stricter form
of stability than stability in the sense of Lyapunov.
Right?
OK.
What about exponential stability?
Exponential stability means not just
that I'm going to get there, but I'm
going to get there at some rate, at some exponential rate.
So if x0 is x star plus some epsilon, that implies,
exponential stability implies, that x of t minus x star
is less than some exponential for C alpha greater than 0.
OK.
Then, I'm going to get there in exponential fashion,
at least as fast as an exponential.
So can you tell exponential stability in this?
The point of these methods is not
to talk about the rate of something converging.
So I think the first answer is not really.
But if you think about it, if you were to draw some line,
if something was a constant slope here,
then that system would converge exponentially fast.
So I think as long as your curve is bounded by--
is above some line, then that would satisfy the time
constant criteria.
OK?
But we're going to use those different definitions
throughout the class, so I want to make sure
that they're clear.
OK.
So we said fixed points.
We talked about a little bit about local stability.
Let's talk about another important concept which
is the basins of attraction.
OK?
So for some fixed point x star, some stable fixed point x star,
I want to know, if I ask what the basin of attraction is,
that means it's the set of initial conditions, which will
get me to this fixed point.
Right?
It's the bounded region of initial conditions,
then set of initial conditions for which x of t as t
goes to infinity equals x star.
So what's the basin of attraction of that fixed point?
AUDIENCE: [INAUDIBLE]
PROFESSOR: Yeah.
Good.
Right?
OK?
So this entire region here, not including those points,
but this entire region here is the basin of attraction
of that fixed point, and these borders here, these lines which
separate the basins of attraction,
they're called the separatrix.
Right?
Does it look like it's working?
AUDIENCE: It will.
PROFESSOR: OK.
OK.
So let's just think about this for a second here.
So I've got an overdamped pendulum.
OK?
This is the fixed point at 0.
My coordinate system is sets of 0 is the bottom.
Right?
I don't have to use my arm.
I've got a pendulum right here, and even if it's off--
can I move it?
Yeah.
OK.
So this is state equals 0.
We just said that, if the system's overdamped,
then we've got a stable fixed point at the bottom.
I think we can all believe that.
If it was overdamped, it would just go like this.
Right?
This is an underdamped system, but the first-order dynamics
will take it to this stable fixed point.
OK?
The separatrix of that stable fixed point
are the unstable fixed points, up here.
Right?
So an overdamped pendulum, if it's right here,
will come to rest here.
Right?
If it's right here, it'll come to rest on the other side.
Right?
That's the basin of attraction.
That's the separatrix.
I think it makes total sense.
OK.
What happens now, if we start adding control torque
to this overdamped pendulum?
It's just this constant control torque, what happens?
AUDIENCE: [INAUDIBLE] up or down.
PROFESSOR: Good.
Yeah.
So remember, I'm just working of this equation here.
That's going to move that whole line up or down.
All right?
So what's that going to do to the fixed points?
What happens if I do u0 equals mgl over 2b?
You see where I'm going with that?
AUDIENCE: [INAUDIBLE]
PROFESSOR: Yeah.
It might be that simple.
It could be that.
I didn't think it out that far.
OK.
So if u0 not equals mgl over 2b, then this curve
is going to be up.
Right?
So it's going to be some sine wave like this.
OK.
And the fixed points are going to move together.
Right?
So I've got fixed points like this, fixed points like this.
AUDIENCE: [INAUDIBLE]
PROFESSOR: Why do you say that?
AUDIENCE: Well, just because it gets divided by d.
PROFESSOR: Oh, it does get-- you're right.
Good call.
Yep.
Thank you.
Just mgl over 2.
Good.
Yep.
OK.
So the fixed point start moving together.
Do you believe that?
Do you believe that in the physical interpretation
of the pendulum?
This one's still going to be stable.
We could see that quickly.
This one's going to be unstable.
Right?
So if I apply a constant torque, which
I will do as soon as Zack gives me a green light,
but if I apply constant torque, positive torque,
it's going to start moving the fixed point like this.
OK?
The unstable fixed point is also going to move.
Right?
It's going to be coming down like this,
and the basins of attraction changed.
The separatrix moved.
So if this system's here, it's actually
going to go around to this and likewise.
OK?
It's nice you can see that so easily from these little plots.
OK, and what happens if I put in u is 2mgl?
AUDIENCE: [INAUDIBLE]
PROFESSOR: Yeah.
Exactly.
Right?
I won't do that, because I might hurt Zack.
But as soon as this, at the critical point
where this whole curve is above the line,
then the thing's just going to move this way forever.
OK.
So just thinking about these flows on a line,
you could start seeing what first-order,
single, one-dimensional systems can do.
So you know they can go to a fixed point.
We just saw they can go to infinity, if u0 is 2mgl.
Can they ever oscillate?
I don't see how they could.
Right?
I said, it's either going this way, or it's going this way.
There's no oscillations in a first-order system,
and the mechanical engineers know that,
but this is a graphical way to see what
that happens, what that means.
So actually, it turns out the only thing
that a first-order, one-dimensional system could do
is end up at a fixed point or blow up.
Right?
There can be a lot of fixed points.
Right?
It could be a flat line.
It could be that it could be stable anywhere.
That's fine, but it'll always either end up at a fixed point,
or it'll blow up.
OK?
All right.
So it's a general tool.
It's certainly good for things other than pendula.
Let me just give one other nonlinear system
example that's one dimensional and first order, so we can
think about a few more terms.
OK.
So this one is called, just another example,
this one's actually called a nonlinear autapse.
Anybody have any guess what the heck that means?
Even a crazy guess?
It's actually a model of a neuron.
OK?
I did my PhD with the neuroscientists,
so I often think about things that are like neurons.
OK?
If you've ever seen neural networks,
dynamic neural networks, a pretty common representation
of a neural network is with one of these sigmoid functions that
are weighted by some parameter w,
let's say, a weight parameter, but that's inconsequential.
All you have to care about here is
that I've got a first-order, nonlinear system
with a parameter w.
OK?
And again graphically, we can tell you everything
you need to know about the system pretty quickly.
OK?
So who knows what it tanh looks like?
I just said it's a sigmoid.
Right?
So if you know a lot about a tanh, so a tanh,
it goes from 1 to negative 1.
This is x.
This is tanh of wx.
For w equals 1, it turns out you have a slope of 1 here,
and you go up, and you asymptote like this.
OK?
That's w equals 1.
For w a lot greater than 1, you're even steeper,
but you get to the same place.
So let's say that's w equals 3.
And then if you're less than 1, it's
going to be even more shallower.
This is why bring sidewalk chalk to class.
OK?
So let's say that's w equals 0.5.
OK.
So now, what is the system x dot equals
negative x plus tanh look like?
If I want to actually draw my flow on the line,
what's that going to look like?
If I want to plot x versus x dot here, OK, well, I
could plot both of them independently.
So I know how x dot equals negative x looks.
I know how tanh looks.
That function is just going to be
this thing put on the line x dot equals negative x.
So what that means is for w equals 1,
I have a system that comes in like this and goes like that.
For w equals 3, I have a system that goes like this,
and for w equals 1/2, I have a system that goes like this.
OK?
Does that make sense?
So the reason I chose this system
is I want to tell you quickly about bifurcations
and how to make bifurcation diagrams.
OK?
So where are the fixed points of this system?
AUDIENCE: [INAUDIBLE]
PROFESSOR: Good.
So I definitely have a fixed point here.
Is it stable or unstable?
AUDIENCE: Unstable?
PROFESSOR: It depends on w though.
Right?
In one case, it's unstable, and in one case, it's stable.
OK?
And then in some cases, in the blue case,
I have fixed points here, and in the red case, I don't.
Right?
So this is a system which, as I change my run parameter w,
I change the number of fixed points,
and I change the stability of those fixed points.
OK?
It's one of the simpler systems where you see that.
So a change in the number of fixed points,
as you vary parameter is called the bifurcation.
OK?
And you can make bifurcation diagrams,
which for a system like this, the x-axis is
the parameter you're changing, and the y-axis is the fixed
point.
OK?
So if w is less than 1, what did we say?
We've got a fixed point at the origin,
and is it stable or unstable?
AUDIENCE: Stable?
PROFESSOR: Stable.
OK?
So there's a critical point here, where w equals 1.
We know that now, because that's where the slope of tanh is 1.
And if it's less than 1, it turns out
for all w less than 1, I have a stable fixed point
at the origin.
So I use a solid line to say a stable fixed
point and a dashed line for an unstable fixed point.
OK?
And then for w greater than 1, what do I have?
I've got three fixed points.
Which ones are stable?
Which one's unstable?
I just used my plurals in a way that
could only imply one solution.
AUDIENCE: The middle one is not as stable.
PROFESSOR: The middle one is not stable, is unstable,
and the outside ones are stable.
OK?
So and it turns out, if you vary w smoothly, then you get this.
OK?
Where this goes to 1, something like 1.
It's not quite 1.
It's around 1.
It's whatever 1 plus the tanh of 1 is.
OK?
It asymptotes like this, and this fixed point in the middle
remains, but it becomes unstable.
OK?
So bifurcations are a critical concept in nonlinear dynamics.
Give us a crash course.
This is actually called a pitchforked bifurcation
for obvious reasons.
Right?
And that's actually a pretty common one.
You'll run into many others.
There's saddle bifurcations, and there's also,
I think there's just strangely named ones.
I think there's a blue sky bifurcation.
Pretty much any name you look for, you can find
a bifurcation named after it.
OK.
So good.
I think we know a lot of what there
is to know about first-order, nonlinear, one-dimensional
systems.
OK?
I think in a lot of classes, we're
trained to think linear systems, linear systems, linear systems.
I can do everything in linear.
It turns out, you can do everything
in a nonlinear system too, if it's
first-order one-dimensional.
But that's an important axis that we don't see too much,
I think, and it helps to know what all these concepts are.
I think Zack says can now do--
can we do the overdamped.
ZACK: Sure.
How overdamped do you want it?
PROFESSOR: We wanted gravity to be at 0.8.
ZACK: OK.
PROFESSOR: And we wanted to damping to be, I think--
I'm sorry.
Damping is negative 8, and gravity was positive 0.85.
ZACK: OK.
PROFESSOR: OK.
So what do we have here?
We've got a big motor, a little pendulum.
Yeah?
ZACK: Could you move it into [INAUDIBLE]??
PROFESSOR: Can I move it?
Yeah?
ZACK: As long as we don't--
PROFESSOR: Don't pull the power.
Right?
Good.
That's fine.
OK.
Big motor, DC motor.
There's a gearbox here, but we're
going to be commanding current which is just
like applying that torque there, modulo
some errors in the gearbox, and just
an otherwise passive pendulum.
OK?
So Zack has written the basic system identification,
so we know what the mass is, what the damping is.
It's not quite the simple damping I showed you,
but it's not too much worse.
And now, he can do things like cancel out.
He can change the damping.
He can remove the damping.
He can add more damping.
He can change gravity.
Its just the feedback linearization game
we said yesterday.
All right.
So we just said we're going to make it
an overdamped system here.
So there you go.
Now, overdamped is actually the hardest one
I'm going to show today from the control
plane of view, because you get chatter like crazy when you--
[BUZZING] See?
Because there's an encoder that's discreet,
and we're sampling it.
OK.
So that's an overdamp.
Now, can you give me a little bit of a constant torque?
ZACK: Sure.
PROFESSOR: Like 0.1.
ZACK: Yeah.
PROFESSOR: I changed it to the gain.
ZACK: I know.
I'm trying to figure out where that--
PROFESSOR: It's--
ZACK: There.
PROFESSOR: I think it's probably that torque.
Yeah.
ZACK: Yeah.
OK.
How much do you want?
PROFESSOR: 0.1.
ZACK: OK.
PROFESSOR: Yeah.
OK.
So I applied 0.1 of torque.
Actually, we've got a sign error compared to my things,
but that's OK.
Now, I've got a fixed point here.
Right?
So the same overdamped pendulum, it's stable here.
There's a little bit of stiction in here,
so it's not going exactly.
OK.
The other place we feel it is right up there.
That's the other fixed point.
Right?
If I put it over here, then that constant torque
moves me right over there, just like I said.
OK?
It's all good.
Let's just-- we can play with it a little bit now.
So give me maybe twice the gravity or something like that.
ZACK: OK.
PROFESSOR: Right?
What's going to happen if I double gravity?
AUDIENCE: Nothing.
PROFESSOR: What's that?
AUDIENCE: Nothing.
PROFESSOR: Nothing.
ZACK: Let me turn this damping gain back down.
PROFESSOR: Yeah.
Good idea.
OK?
ZACK: OK, and now we want twice gravity?
OK.
PROFESSOR: OK.
Changes the natural frequency, right?
We're going to see that in a second.
I didn't actually do all this secondary stuff yet.
Still got high damping in there though.
ZACK: Yeah.
Oh.
Yeah.
PROFESSOR: OK.
ZACK: Take that out.
PROFESSOR: Cool.
So we're going to play with that again,
when I do the second-order version here.
But at least I hope you believe wherever
it went the constant torque overdamped tells me everything
I need to know about the simple pendulum,
so that's kind of cool.
OK.
Let's get rid of this overdamped constraint which
is the only reason it was first order,
and let's get to the second-order case.
OK?
But before we do the whole dynamics,
we'll make another quick assumption.
Let's do a different special case.
I could have left that, I guess.
Let's do an undamped pendulum, and we'll start with 0 torque.
OK.
So b equals 0, and u0 equals 0.
OK?
All right.
So what do those equations look like?
Now, I've just got I theta double dot is negative mgl sine
theta.
Right?
OK.
So how am I going to graphically investigate
this second-order system?
Well now, there's two things I care about evolving over time.
Right?
I need to know what theta does over time,
but I also need to know what theta dot does over time.
OK?
So I'm going to need a two-dimensional plot,
and this is the phase plot.
OK?
So let's make a phase plot.
OK.
So a phase plot, what I'm going to plot
is theta versus theta dot, and what I'm going to plot is not--
my separatrix doesn't want to go away.
What I'm going to plot on this, it's a vector plot.
OK?
I'm going to plot I have two equations floating.
Right?
This is the second-order system is equivalent to two equations.
One is theta dot, looks a little silly to write this,
but you can think of a second-order system
as coupled first-order systems of two variables here,
and this is mgl sine theta.
OK?
So what I'm going to plot here is a vector
which is theta dot versus theta double dot
as a function of theta and theta dot.
I see angry looks.
Right?
I can write this as, if I want to think
of this as a first-order system, I'm
going to say that x is theta, theta dot.
Right?
And now, I can write x dot is some function of x,
a first-order equation which describes
this second-order system.
OK?
It's a vector equation, and what I want to plot is, for all x,
I want to plot x dot.
x is 2 by 1, and it happens to be theta dot, theta double dot.
And it's a function of a 2 by 1, so I'm
going to make a vector plot on this two-dimensional system.
OK?
Maybe as I start drawing things, it'll become crystal clear.
OK.
So given this equation here for the undamped pendulum,
let's plot some of the vectors.
OK?
So it turns out that it's simple to think
about it along the line of theta dot equals 0.
Let's think about that.
I have a vector who's y component is going to be 0,
and its x component--
sorry.
This component is going to be 0.
I should call it the x component,
and its y component is going to be negative mgl sine theta.
OK?
So at 0, I've got nothing.
Here, I've got a little vector going down.
Its y component is this.
It gets back to another 0.
So if I plot this vector field along that line, I get this.
Right?
OK?
If I plot it up at some positive-- or let's
even plot it now along the other line.
So if theta is 0, then I get a thing
that's only got an x component.
This term is 0, and it's actually a linear thing,
so it just looks like this.
You with me on that?
OK?
And if I plot something in between some positive x,
some positive theta, positive theta dot,
then I'm going to get a combination of these two
things.
I'm going to get a vector like this.
Right?
If you plot that through, or if you
hand it to Matlab to plot it through, for instance,
then you can again graphically quickly interrogate
the nonlinear dynamics of the system.
OK?
So in this phase plot, if I start
with some positive velocity and 0 angle,
then I'm going to get some angle.
Right?
I'm going to go around until I get to the theta dot equals 0.
I go around.
That could have been more circular, but you get the idea.
OK.
It turns out in here, things really
do look like circles around the origin,
and they should be cocentric.
Out here, the nonlinearity shows up a little bit more.
You get these eyeball looking things.
OK?
All right.
So what does that say?
So if I start my pendulum-- is it--
ZACK: It's ready.
PROFESSOR: OK.
If I start my pendulum with 0 position and some velocity,
is it 0 damping [INAUDIBLE] good man.
OK.
Then, what's it going to do?
It's going to start oscillating forever.
Right?
As close as we can to canceling out damping by measuring it
and subtracting it.
OK?
So it's just going around.
It's got some positive theta, negative theta dot,
positive theta dot, negative theta dot,
and it was pretty close.
I'll give you a better chance by going like that.
OK?
And I can really test our model by starting it up here.
That's pretty good.
Right?
So if I start way up here, it's going to take these orbits.
OK?
And it turns out, if I were to wrap the pendulum around once--
again, now I'm testing the encoder counts.
ZACK: [INAUDIBLE]
PROFESSOR: OK.
Well then, I would do the same thing but over
by that other fixed point.
Right?
So this whole pattern repeats over here.
Right?
ZACK: [INAUDIBLE]
PROFESSOR: Yep.
ZACK: [INAUDIBLE]
PROFESSOR: Oh, great.
We should plug that in which is going
to be mechanically impossible.
OK.
ZACK: There we go.
PROFESSOR: You can sort of see there's an eyeball there.
Right?
This is the real data from the encoders.
OK?
So I moved it around there, and then I jerked it over here.
I got an orbit there, moved it over here,
and got that nonlinear orbit.
OK?
That's the exact same phase plot that we just did.
OK.
So now, where are the fixed points of the system?
On a phase plot, two variables, where can the fixed points even
be?
Can I have a fixed point up here?
If I have a velocity, I don't have a fixed point.
So right away, you know you're only
going to be looking for fixed points on the x-axis here.
Right?
And again, on the x-axis, it just reduced to the sine.
So I've got a fixed point here.
I've got a fixed point at pi.
I've got a fixed point at 2 pi.
Right?
OK.
Are they stable?
Is this one stable?
You should ask, what do I mean?
One more sense.
Good.
Is it asymptotically stable?
AUDIENCE: No.
PROFESSOR: No.
Right?
If I start it here, it's just going to go around and around
and around forever.
It's not going to get to the point.
Is it stable in the sense of Lyapunov?
Yes.
Good.
And this one is not stable at all.
Right?
OK.
Cool.
All right.
Let's add a little damping in.
What happens if I add my damping back in but leave
my torque off?
What do I get then?
I want to ask you one more question.
So this thing is a trajectory.
I didn't tell you carefully what--
this is a closed orbit.
Right?
Is that closed orbit stable?
AUDIENCE: What do you mean?
PROFESSOR: That's a fair question.
What do I mean?
So we have to define orbital stability, and we will.
But just intuitively, what do you feel about--
do you think that trajectories that are near that
are going to get to that?
No, right?
This is the same sort of marginal stability case
that you see here.
So if there was a sense of Lyapunov sort
of definition for the orbit, then we might say that.
It's not a limit cycle stability we're going to talk about,
where it's not going to converge to that trajectory.
OK?
If I'm on this orbit, and I give it a little push,
then it'll start moving in this different orbit.
OK?
OK.
Now, what happens if I do the damping case?
So my equations are--
I think it's just unsatisfying to see that.
Let me just write x dot is still going to be theta dot out here,
but now it's going to be negative b
theta dot minus mgl sine theta.
Right?
It turns out, if I make that same plot, at the origin
all is well.
It's the same thing.
Right?
I still get my sine wave dynamics at the origin.
OK, but what happens up here?
Now, this is still theta versus theta dot phase plot,
but now when I have 0 theta, I have the same x component,
theta dot, but now I have some negative y component.
Yeah?
So I'm going to get a vector that looks like this,
and these things go down like that.
OK?
And in general, it looks something like this,
and what are my trajectories going to look like?
AUDIENCE: Spirals.
PROFESSOR: Spirals, good.
Right?
You might want to restart it.
I might have moved it too quick.
It's got to grab the encoder 0.
ZACK: OK.
PROFESSOR: OK.
That's no damping still, right?
ZACK: Yep.
PROFESSOR: Let's put some damping in there.
ZACK: No, wait.
That's with normal damping.
PROFESSOR: Normal damping.
ZACK: Yeah, not doing anything to it.
PROFESSOR: OK, so this is normal damping,
just the damping from the motor, the friction and the gearbox
mostly probably.
OK.
Let's see a phase plot.
ZACK: OK.
Let me get the data off it.
PROFESSOR: Yep.
ZACK: There we go.
PROFESSOR: OK.
So you'll see a few blips in the plot.
That's when the encoders are slipping away,
but you can see a pretty spirally trajectory.
I think if we triple the damping or something,
it'll look more compelling.
ZACK: Yeah.
PROFESSOR: Let's try that.
Yeah?
ZACK: OK.
PROFESSOR: OK.
So while he's setting that up, what
happens to the fixed point over here?
It's going to have some sort of dynamics over here.
OK?
Right?
It's going to have spiral dynamics down here,
but what happens if I start with a really large velocity
or a really large negative velocity, let's say, and 0.
AUDIENCE: [INAUDIBLE]
PROFESSOR: Yeah.
Right?
So this is my unstable equilibrium.
If I'm coming down, and I don't make it
to that unstable equilibrium, then it
will actually tip back up, and I'll go in
and spiral to this fixed point.
Right?
So let's see how--
ZACK: You going to give that a try?
Let's do just the normal--
ZACK: OK.
It's ready to go.
PROFESSOR: OK.
OK.
That was the benign case.
We'll try the high energy case in just a second here.
ZACK: Let me get that data [INAUDIBLE]..
PROFESSOR: Yeah.
ZACK: There we go.
PROFESSOR: OK.
Minus the little blips, you can see that's the spiral going in.
Now, let's see if I can--
ZACK: Let me restart the--
PROFESSOR: Sorry.
Let me leave it.
ZACK: OK.
PROFESSOR: OK?
Yep.
So it looks like it hit the brakes here and came back down.
You might think it's like a discontinuity in the trajectory
or something, but hopefully, it'll
look exactly like what I pictured up on the board.
Yep, again, minus the encoders slipping,
and this is me lifting it.
It goes around and finds, stabilizes
into that fixed point.
OK?
All right.
So finally now, for those of you that
are quite familiar with dynamics,
thank you for listening.
Let's think about controlling this system.
OK?
What does it mean to control this system?
Let's say, I put in u again.
Forget about constant u.
We're past that now.
Let's say, in general, I can make
u be a function of the theta and theta dot.
Right?
And my equations now are going to have
this plus u which could in general be a function of theta
and theta dot.
OK?
What is it going to do to my phase plot?
Doesn't change this component, right?
Which means things are basically still going to go around.
Things always go around this way.
That's how it works.
OK?
But what I can do is I can move this guy up or down.
Right?
That's all I can do.
Now, in a lot of cases, that's everything I'd want to do,
so maybe we should.
You want to do the feedback linearization
of gravity example?
ZACK: Yeah.
PROFESSOR: OK.
ZACK: Give me a couple seconds.
PROFESSOR: Sure.
Right?
So it turns out, that's enough, if you
think about what this plot looks like,
even if I have a damped thing.
So for instance, if I do my feedback linearization,
and I make this function.
Let me be a little bit more careful, I'll call this pi.
I'll say u is pi of theta, theta dot.
That's the notation we use most of the time here.
Let's say, I just made it b theta dot.
That cancels out this component the thing,
flattens it out, and gets me back to that plot.
That's actually exactly how we did the 0 damping case there.
Right?
We just canceled out the damping to make that plot,
because the real thing has damping.
OK?
And if we do the feedback linearization,
we can actually do plus 2mgl sine theta.
Right?
If I make the controller look like that then, lo and behold,
the system's now an upside-down pendulum.
Right?
Same thing I showed you last time.
This time it's on a piece of metal,
so that's more impressive.
Right?
OK?
OK.
So here's the name of the game, and I
want you to think about this between now
and next week, let's say.
Let's say, I want to put a fixed point.
You can only put fixed points along here.
Let's say, I want to stabilize, turn the system
into a system that's stable at this fixed point,
unstable here.
I want all trajectories to end here,
and I want to do it by making minimal changes to that vector,
by adding minimal torque.
OK?
So you get this geometric phase plot view of the world now.
What would you do to those vectors
to try to get all trajectories to get there
with minimal torque?
Or another nice version of the problem
is let's say I have a bounded torque.
Let's say, I don't care about being minimal,
but let's say I just have a motor that can only
put out so many newton meters.
Right?
Let's say, that means there's a limit to how much
I can move those vectors.
OK?
How do I shape those vectors in order
to guide all system trajectories where I want to go?
OK?
It's when those constraints start
coming into play that you can't just change these vectors to be
whatever you want.
You have to think about pushing them and pulling them.
Right?
And that's the under-actuated robotics case,
where you're thinking about moving your dynamics around
instead of squashing them.
OK?
And for the computer scientists out there,
I'd actually love to see what you come up with.
Think about-- write a program that
could try to in some minimal way stabilize that fixed point
on the vector field.
I think there's a lot of ways to do it.
It'd be interesting to see what you come up with.
OK?
That's the name of the game.
Turns out, there's the right way to formulate those problems,
I think, is we're going to talk about optimal control
next week.
The most straightforward answer I have for the computer science
world is that, if I can describe some function on my vector
field that I want to minimize, some cost function, I'll
call it g of x.
Possibly it depends, I want to penalize actions too,
some cost function, and let's say,
I care about the long-term cost over some trajectory.
We're going to call this thing J, where this is x of t,
u of t.
If you can define a cost function that
describes the thing I just said in this form,
then that's going to turn everything from this fuzzy
dynamics problem into a strict computational problem,
and we can use all our favorite optimization tools to solve it.
OK?
We're going to hammer that out big time next week.
Good.
I think you know most of what there
is to know about the pendulum.
Anybody have any questions?
You know fixed points.
You know stability in the sense of Lyapunov,
asymptotic stability, exponential stability, basins
of attraction, separatrix.
What else?
Closed orbits, you've got it all.
OK?
That's mostly it.
Let me just say a couple of the administrative details
that I didn't get to last time.
Your first problem set is posted tonight.
It's going to be due--
problem sets will be due basically every other week,
on Tuesdays.
It happens that the first Tuesday that it's
going to be due is one of those weird Tuesdays,
but just to keep the clock on schedule,
we're going to ask for an online submission on that Tuesday.
They'll be every two weeks.
There's six of them throughout the term.
We do have a midterm in the class.
It's just before spring break, I think,
and so you can enjoy spring break.
We don't have a final exam in the class.
We're going to do final projects instead.
So I'd like you to start thinking soon
about final projects, and feel free to ask me.
Homeworks, you're fine to work on as a group.
I don't care, whatever it takes to learn the material.
Everybody should turn in their own problem set.
The midterm, you'll work by yourself.
The final project, you can team up with somebody,
as long as the contributions are clear from each person,
and that's totally fine with me.
Throughout the class, as you might guess,
we're going to have Matlab simulations and physical robots
trying to show the basic phenomenon.
Many of those will be available for you
for your final projects, if you so choose.
Maybe I'll ask you to show me that something's
stable on a simulation, before we put it
on the robot or something like that, but it should be fun.
I think it's such a young field that we can definitely
do publication quality final projects.
So those of you that are in robotics,
think about writing an [INAUDIBLE] paper
for the final project.
I think that's it.
I think we've got a, yeah, the PDFs from the lecture one
were online sometime yesterday.
Today's will be online immediately,
and let me know what you think about this [INAUDIBLE] thing.
I saw one comment last night, anonymous, but that's good,
and I'll see you next week.