0:05

But here, let's say you have the initial attitude.

Â Your sounding rocket stands perfectly still on the pad.

Â So initial attitude is zero real, zero roll, zero pitch.

Â And you measure the rate gyro information so you have this.

Â You have a whole time history.

Â We've curve fitted it with a polynomial function or something.

Â 0:24

And now we integrate this.

Â Are there any issues with this integration, Daniel.

Â >> Have a singularity.

Â >> Theta singularity, we have trouble potentially.

Â There's a zero over zero ambiguity.

Â Depending on your time step you may get closer to that zero singularity.

Â And then the next time step you punch through it to the, you might get lucky.

Â [LAUGH] But that's definitely an issue.

Â Are there issues with the DCM.

Â We talked about them being a constrained set of coordinates.

Â And when you integrate that kind of constraint

Â doesn't stay there it starts to get corrupted.

Â Do we have such corruption issues when we deal with Euler angles.

Â >> No it's not [INAUDIBLE].

Â >> That's a benefits of a minimal coordinate set is that at least you may

Â have some integration errors where you're off by three seconds in your altitude,

Â because whatever integration you use.

Â What you ended up was still a perfectly valid description of pitch and roll.

Â Everything is good.

Â Versus with the DCM.

Â If you don't do something about that error, it builds up and

Â you end up with a DCM that's not at all orthogonal.

Â And you map things, you have values that are bigger than one in there, and

Â all craziness will happen.

Â Then that's an extra step in how you have to reapply those constraints during

Â an integration.

Â We will see that again when we go to other sets that are redundant as well.

Â This is a minimal set.

Â With minimal sets, you don't have to worry about that, but you do have somewhere,

Â always a singularity, as you pointed out.

Â That's something to consider.

Â I think the next homework, you're actually going to be integrating this.

Â I'm actually giving you time history of a simple first order integrator.

Â 2:20

I'm going to show you some really simple way.

Â because I know your first instinct is go to MathLab and type in OD four,

Â OD f four five, whatever it's called, and integrate there.

Â But down the road we're going to get to coordinates where you're going to

Â have to do to particular coordinates within the integration.

Â Very tricky to do in OD four, five.

Â If you just, this is such a simple integration,

Â this is a good one to practice.

Â Let's just talk quickly about how to make a simple integrator.

Â 2:54

they usually write everything into state space form.

Â X start equals to F of X comma t.

Â Something like that.

Â They all look up like a or Euler method, or second type of runner.

Â They're all in this form.

Â X here is a state vector.

Â 3:12

Let's apply that to the yaw, pitch, roll problem.

Â That's actually your next homework which you have to do.

Â So, Nick, what is my state vector if you're integrating.

Â So let me just kind of flesh out these equations, all right.

Â 3:50

>> Yes it would your Euler angle.

Â >> Angles, the rates are their derivatives.

Â >> Right. >> So x is just yaw, pitch, roll.

Â That's it.

Â When we get to the kinetic side we're actually going to find differential

Â equations for this.

Â 4:07

Are you a dual spinner.

Â Are you a single spacecraft.

Â A spacecraft with three [INAUDIBLE].

Â It's all going to have different equations.

Â And then you just plug it in differently.

Â I really encourage you at this stage with this very simple integrator problem

Â to write nice clean code that's modular.

Â And you want to write it in this way where you just have a state vector and

Â right now we just have three variables.

Â If later on you have three or six, you just have to expand out.

Â Okay now I have attitude and rates and something else,

Â like reaction rules at the end of the class, that we can include.

Â And you're ready to go.

Â It'll save you lots of time.

Â To write an integrator, there is nothing particularly tricky

Â in this class that really requires a fourth order, time varying,

Â self healing whiz bang magic of OD four, five that MathLab has.

Â It's a very powerful integrator.

Â But it's complete overkill for what we're doing in this class.

Â I'm going to show you the simplest integrator you can possibly write which is

Â a first order Euler integrator and that's the steps.

Â If you want to get better, you can do a fixed time step fourth order.

Â Just look on the Wiki it's like if you call this f function four times

Â instead of once.

Â And once you've written in this form,

Â it's really easy to go from a first order to a fourth order.

Â And you just you know do it four times and then blend in and then you're there.

Â With any integration we always start out with X-naught the initial set of states.

Â So if this is a sounding rocket, where am I.

Â Right [COUGH] this is my initial attitude maybe it was tilted.

Â Whoever mounted it was a little bit careless.

Â It's five degrees off.

Â You give it initial attitude that that's set.

Â Then the next thing is you start your time loop.

Â 6:23

What I need to do here is, I have this, and the update.

Â The digital updated equation for Euler's integration says, the next time step

Â is equal to the current time step plus F times DT.

Â Graphically it means if you have some state, here's time T.

Â 6:48

F is really the local slope.

Â You're just doing a first order extrapolation.

Â If that's the rate you're moving at and

Â this is the current state, then one second later I am up here.

Â That's a first order integrator.

Â So here this would be T plus DT.

Â 7:04

And this would be your predicted X and plus one state.

Â That's it.

Â In here what you have to do is you have to compute this F function.

Â I'm just going to write it.

Â And I'm going to call this function and

Â store the answer with my current time and my current state.

Â This gives me my slope.

Â 7:27

And then if you want to be explicit, you can say, look, XN plus 1 is equal to

Â current XN plus F times DT as a first order integrator.

Â And then before you finish, you want to replace new with old.

Â So you would say XN is equal to XN plus one.

Â Now you're ready for the next time loop.

Â When you go up to the next time,

Â you've already got the new currently predicted states.

Â And that's all you have to do.

Â But the beauty is if you write it this way,

Â then homework two does some of these integrators.

Â Homework three will have integrators that might be slightly different with omegas.

Â You get to reuse a lot of your code.

Â And you just have to go well now, my F does something slightly differently.

Â But I'm still sending it a generic state vector.

Â Use at the four states, five states, whatever you're integrating.

Â 8:14

You can do this in OD four, five especially later.

Â That's fine.

Â But my recommendation is do this.

Â This will be helping you a lot during this class and saving you some time.

Â And later on you're not resting.

Â When you get to MRPs I'm going to expect you to do switching

Â within the integration.

Â And you can set up events in MRPs.

Â So in OD four, five but it gets a lot trickier to implement that.

Â It's possible, but it's a lot, lot trickier.

Â This, actually in research too, I typically write my own integrators so

Â then I know precisely what's happening.

Â And I'm doing and I can control what's happening within the integration very,

Â very meticulously.

Â So, simple process, Mary.

Â 8:49

>> Does the method matter.

Â Are you going to indicate that in the homework, or whatever, or.

Â >> Sorry. >> Does the method matter.

Â >> No, just indicate so we know where the answer came from.

Â And, hey, here's the plot, and like, well, [LAUGH].

Â So if you show quickly, yeah, I used this.

Â And for this one, I was running a low in time.

Â I used it only four, five, this is what I get my three lines but

Â that I solved it with.

Â Cool, full points.

Â If you write one of these, great.

Â Most students tend to write by the end.

Â Because not only please me at the beginning it just says kind of I'm so

Â busy, I don't have time to learn this.

Â I will do this a little bit later.

Â I just want to make everybody aware that this class has a series of programs that

Â are going to be happening.

Â And the earlier you spend putting them into a modular form

Â the more you'll get to reuse them.

Â And it will save you lots of time down the road as well.

Â So just some suggestions.

Â But yeah.

Â No, good question, good.

Â This is a review of differential kinematic equation.

Â With these If you measure omega, you can do tons of useful stuff all ready.

Â We're just assuming we can measure this stuff.

Â Somewhere in this function,

Â you'd have a, you would be specified this is what omega is, right now.

Â Play with that.

Â Some of you've done a lot of this, you'll be done in ten minutes.

Â Some of you've never really written or integrated these systems too much.

Â You will be spending an hour on this.

Â But it's a hour well spent, because it will, all the math,

Â that how does this apply.

Â And the numerics is going to sink in way better.

Â