0:06

The next thing we're going to do now is talk about how you pick the right gains.

And this is where MRP's actually shine as well.

It makes it quite simple to predict what the close loop performant is going to

be because the MRP's linearize very, very well.

They're not perfectly linear but they're easy to linearize.

So we're going to go back to our classic PDE with the feet fold feedback parts.

because this especially with the full quadratic

omega measure leads to these closed loop kinetics equations.

Then associated with this you also have the sigma dot equations, right?

So we still end up with six differential equations.

Now we want to figure out what k do I pick and that's a scalar with this control.

P could be a fully populated matrix because that's going to impact,

is it going to be overshooting, undershooting.

Is it over damp, is it critically damp,

what's the decay time, all those classic linear control measures.

We want to see how we can apply that.

So this right now is linear here but

the differential equations themselves are going to be non-linear.

So what we're going to do next to linearize this gets dead simple.

1:45

>> Identity >> Identity.

The one minus sigma term.

There's this tilde thing that drops everything out as quadratic and

then there's another one that was an outer product.

Sigma, trans-sigma, sigma transpose, also quadratic terms.

So it's just proxy, so really if you remember MRP's linearized to angles over

four, it's also true for the rates.

So the sigma-dot first over approximation is just equal to del mega over four,

that's it.

So this is the full equation but

now you have a nonlinear dynamical closed loop system.

We know it's stable and everything, but we want to linearize it so

we can use classic linear control, rise time, settling time, all those principles.

So I'm going to approximate this b now as being basically

identity over four and that's it.

And if you go back and look at your MRP notes you will remember that tangent phi

over four function it's very flat,

very straight right up to well past 100 degrees.

3:36

And if you go, I'm just going to keep this here.

This is a diagonal.

This is a diagonal, this is already a diagonal identity.

P, let's write P also as a diagonal just as a fully populated matrix.

I'm just going to use the same gain p for all the different states.

Omega one, omega two, omega three, it just becomes a p scalar times identity.

And that times I inverse is the same.

So if you that you can actually rewrite this six-by-six

as three decoupled, into three different two-by-twos.

You just have to look at the sigma1 omega1's that's how they couple.

And this sigma2 with omega2's coupled the same way.

Sigma3, delta omega3's coupled the same way.

So it's a nice way to look at, it's pretty common.

I've seen rare implementations where they pick a fully populated p.

You could do it, but I'm using the same,

no actually this form I'm using different p's, that's right, sorry.

I'm using a diagonal p one, two and three, so I'm still losing some generality, but

I'm getting this decoupling.

So I can look at two-by-two systems.

Two-by-two is great because it tends to out to be exactly spring mass damper like

systems.

And you can pretty much look up now what the closed loop stuff is.

In fact I just solved this for the characteristic equation.

This is where my roots will lie.

These are the two roots.

So if you want to pick these gain you could do a root locus plot and

study change in p.

How does that impact my roots, change in k, how does it impact the roots?

And you can go back and forth.

And if you have different inertia, what happens here?

5:31

This is how you get from the roots, also to the, what's this?

This is the decay time when you've dropped to half the value essentially.

That's what you're looking at and the damped natural frequency.

So how do we pick gains?

You can start here.

There's a lot of competing arguments.

You only have one k and I have three p's.

[LAUGH] That gives me four parameters.

And so you can pick some of them.

But once you pick, if you have inertia and you want a certain decay time

per axis that's going to dictate the three P's right away, right.

Then you still get to pick a k.

And you can see you can pick here with the coefficient.

Maybe you want to make the damping ratio one making it critically damped

less than one, slightly underdamped.

That's a popular choice.

But there's only four gains you get to pick.

So once you've dictated enough conditions the rest of the conditions

come out of this.

So you have to pick the right conditions to pick it.

6:24

But does this make sense?

At least a little bit?

It's this classic linear control which I'm assuming you've seen at some point or

at least familiar with the spring mast ampere system.

Or something like this you get the characteristic equation.

These are the roots.

And once you have the roots of a system you can look up on Wiki.

You can pull out all these standard form factors.

So that's really cool.

So we can now start with, I have this decay time.

I don't what this actually when I write code I often do it this way.

I don't say just pick a p(1) but I'm looking at my inertia and saying.

You know what this craft I should settle but within 20 seconds,

30 seconds it should be at least half as close, right?

I think that as a starting value and

then whatever the inertia is it sets the right gain.

And this could be done even in a self tuning way.

So I'm going to show you some examples here where we compare how linear or

how well we can predict the response.

Got my interias, got some large initial altitude errors and rates,

it's going to tumble.

I've got my games that I've picked and with the system and

you saw we decoupled the one access stuff.

The access stuff and the three access stuff but

making some diagonalizing assumptions on the p matrix and the i matrix.

So we can look at them individually and just got a sum squared, the F's along

is the mean route errors, root mean squares of sigma i's and omega i's.

That's what I'll be plotting here.

So the control, you can see it's a large maneuver it actually goes past

128 where it switches to the other one and then stabilizes.

I picked gains on purpose to have different kind of expected decay times.

Some of the axes decayed their errors very quickly.

This other axis which is sigma 2 it looks like is getting there but

it takes much longer.

So I'll give this different frequencies that should match up with my linearized

predictions.

The omega's same thing, as your sigma's settled the omegas, that's omega ones,

omega twos,

delta omega two's going to take longer control you get all your access.

Now here I can show,

you can see that that second axis is decaying at a much slower rate.

And the one and twos are decaying at a much faster rate.

From this figure plotting these epson on a log scale, I can extract out,

you can do kind of a curve fit and figure out what the mean trend is.

That's your exponential decay time and

I can compare it to my linearized predictions.

And keep in mind I'm doing a very large tumbling maneuver here,

this is not a small maneuver.

So what I get out of this is decay times what came out of my linearized

predictions was 15, 75, and 15 seconds, the half life.

The actual ones come out of the four non linear simulations are pretty darn

close to that.

That's kind of a nice it doesn't take much post tuning of the parameters to get those

decay times close to what you wanted.

So the differences here only a few percent.

And this is a down natural frequency.

That's why I'm looking at these oscillations.

So you get about ten of them.

And then divide by ten that gives you a good mean.

What is that to damp frequency?

And what my linearized predictions were were here.

And the actual response is here.

And you can see we've only got a few percent errors out of this stuff.

So this is kind of a nice thing then right.

So we've got some good feedback in selection technique that we can use.

Now dispute this wonderful lecture I just gave, I can promise you in the home works.

The last homework you do, you do a lot of controls.

And there's always people that comes to me going well I think everything's working

but and this is what their plot looks like.

10:42

Is your stiffness K going to be large?

With a stiff system do you have a fast oscillation or

with a stiff system do you have slow oscillations?

>> Fast.

>> Fast, right?

So if you have fast oscillations that must means you must have a really

stiff system and the issue here is the most popular gain in the world is one.

[LAUGH] Doesn't matter what the inertia is.

Cube said or hog worth that's star.

I can promise you at some point some control engineer threw in

one just to help it, to see what would happen.

That's where people start.

What I hope to show you is with the other analysis you can quickly throw in that one

there at least tells you, hey this is the k time part if you want 20

seconds response with this inertia this is roughly where the game should be, right.

So you need to back off on the proportional part.

What you want to have is something that's hopefully close to critically damped maybe

it comes in.

And you know it slightly overshoots and then it settles.

People like slightly under done systems because you get close

to the target quickly.

And overall settling time to get within a certain tolerance is faster

than a critically done system that adds a little bit more lag to the system.

But that means back off in those gains.

Don't just start with one, we'll maybe start with one just for the hell of it.

And then bring it down or use this analysis that I gave you and

you can quickly plug in numbers.

And go okay, I should have a value of .001 or this should be .5, you know?

Some other value.

But that's a common thing that happens with gain selections.

And this really is hard to see or

they're going well, I think it's I think it's getting smaller.

I'm really hopeful.

I do think so.

I just took six hours to compute that equation but

I think it's getting this blip is smaller than this.

It probably means you picked some crazy gains.

Maybe your rates are way too big, your rate feedback part, and

that's going to actually prevent you from converging.

If you have a huge rate, you might be way over depth.

And in that case it's just kind of doing this and

then you're saying hey that proves it's data destabilizing.

And I go bullshit.

This doesn't prove anything.

It may have gotten closer but

how do I know it's all getting closer to a fixed offset, right?

If it's logger unstable, it's taking a long time and

you just haven't run out long enough Enough.

So these games are important.

Play with them a little bit and you can see.

Okay, if I'm guaranteeing as some product stability

show me as some product stability on the system.

And so this one cutted the homework when you do this.

It should go to zero.

Show me something that goes to zero.

Pick the right games one not long enough.

That's all about games there.

Good, any question on gain selection?

This is the one part of a class that I have a little a bit of a prerequisite I

don't go through all system.

I don't explain what natural frequencies are, damped natural frequencies.

I assume you've seen this or I swear there's probably several Wiki pages.

So you can just go read the concepts, this is all you need.

Then you're ready to go.

Okay.