‫Welcome back.
‫I think it's good now to look at the big picture.
‫You have your plant and you have your controller.
‫The controller takes in the reference values.
‫X, Y, Z.
‫Which are the position, reference values and Fifita and BPCI, which are the attitude, reference values.
‫Right now, we don't care about the controller, we only care about the plant, the controller right
‫now is a black box.
‫We don't know what's inside there.
‫We're almost done with the plant so soon, very soon, we're going to go and start unpacking the controller.
‫The thing is that our controller will, in fact, need a lot of stuff.
‫It will need the state values in the body frame, so you, the W, P, Q and R and you get it from the
‫plant.
‫So in this plant, you have a box, a mini box inside the big box where you have you that weeda w dot
‫p q that an r that this mini box consists of all these six states based equations.
‫Because this is where you get your due date with the W dot and then that Cuidad and R dot from these
‫equations, so that many boxes for these equations here and then you put it through an integration box
‫and that integration box, it will give you U, V, W, P, Q and R, and this integration box is for
‫these equations here where you take your state now, the time derivative of your state, your sample
‫time interval and then your end value and then you compute your new state.
‫So that's the integration box over there.
‫And so these new states then go into the controller, but not only.
‫If you look at this set of state base equations, then you see that in order to compute the time derivatives
‫of your states, you need the states themselves.
‫You see, you have the here you have WQ are because remember, the states based equations mean that
‫your state time derivatives, they are a function of your states and inputs.
‫So you need the actual states in these equations as well.
‫That means that these body frame states, they have to go back into this box as well.
‫So the states that leave the plant, they leave the plant as states at K plus one, but then the same
‫states the same numbers that leave the plant when they go back into this box here, then they go into
‫this box as states at K, then you compute the new derivatives, you perform the integration again,
‫and then you compute the new states that will be states at K plus one.
‫And then these new states, they will go back into the plant and into this state's basic equation box.
‫And when they do again, they will enter this box as states at K.
‫And then again you perform the integration new states at Kapos one, and that's how the loop goes.
‫And in the meantime, of course, these states enter the controller because as you will see in the future,
‫the controller will need them to.
‫One additional remark, this integration method here, this is called an oilor integration method.
‫In this oilor integration method is the simplest one, however, it is also the most imprecise one,
‫which is why often times you need some kind of end value here in order to integrate it with smaller
‫intervals.
‫In the previous course in this series, I used this method, however, in this course, I'm going to
‫teach you a more advanced method to perform this kind of integration.
‫So this is the Euler method.
‫It is the simplest, but also.
‫It is not that much used anymore, especially in advanced projects, because there are some issues associated
‫with it.
‫There are some problems with it and I'm going to talk about it very soon.
‫So in this course, I'm going to teach you a method called Runga Kutta.
‫More precisely, a fourth order wrong Akutan integrator.
‫It's a very popular integration technique in order to compute new states.
‫It is very widely used.
‫For example, in Matlab, there is a very advanced, integrated function called Odie's forty five.
‫And they created that function using the fourth order Runga Kouta method.
‫And that's why you have four here.
‫I'm not sure what the five stands for, but what I know is that four stands for the fourth order.
‫Wrong Kutta integrated method.
‫This is going to be a slightly more complicated than the Oilor method that we used in the previous course.
‫However.
‫Learning that would be very beneficial to you, because in the engineering community, it's very popular
‫and very widely used, so we're going to talk about it very soon in this section, in fact.
‫So in this integrated box, you can use either Oilor, which is this one here in yellow or.
‫Runga Kouta.
‫OK, so let's carry on now.
‫Now, we also had another box here.
‫We had an omega box.
‫Which had to be as a function of the control inputs, the use, remember, the controller will give
‫you four system inputs.
‫It will give you you one, you two, you three and you four, and we needed that box because the state's
‫basic equation box also needs the Omega's, right.
‫So from this box, you will get your omega one Omega to Omega three and Omega four like this, because
‫if you look at the states basic equations here, then you see you need an Omega.
‫And this total Omega is composed of four Omega's from each model.
‫So to be precise, this box will actually give the total sum of all the omega three.
‫Because inside this box, once you have your four or Mangahas from your four mortars, you will add
‫them all up and then you will send that total Omega into this state base equation box.
‫But to be honest with you, that even our controller will need that Omega.
‫So what will really happen is that.
‫This Omega will not only go to that box, but it also needs to go into the controller, so this Omega
‫will go into the controller, then the controller will compute.
‫You want you to use 3U for it will go into this omega box and then a new Omega will come out.
‫And of course, we're going to treat that box as well.
‫And now if you look at your state base equations, then you see that you also have you want you to use
‫three and you four here.
‫So that means that they use that go into this omega box.
‫The same use need to go into the state's basic equation box.
‫So the same you want you to use three and you four will go into this box as well.
‫Then if you look at your integrator, in this case, Oilor and later Runga Kutta, which by the way,
‫will also be used in the code.
‫So this time in the code, I will use Runga Kutta, but in either case, in order to compute a new state,
‫you need a present state.
‫You see you have your EUC, V.K., W.K., etc. It means that these body frame state values, they also
‫have to find their way into this integrated box.
‫So there you go.
‫The same body frame states go also into this integrated box.
‫And now due to the fact that the reference values these ones here they are all in the inertia frame.
‫Your states that come out of the planned model must also be in the inertia frame.
‫So not only in the body frame, but you also have to convert them into the inertia frame and then they
‫also have to get out of the plant and into the controller.
‫Otherwise, if you don't do the conversion, then you compare the inertia frame reference values to
‫the body frame states and that would be like comparing apples with oranges.
‫You shouldn't compare measurements that are made in different reference frames.
‫It would simply not make sense.
‫It's like comparing two distances and one is in kilometers and the other one is in miles.
‫So in addition to the body frame states, the controller will also need the states in the initial frame.
‫So it will need X, Y, Z and Fifita and BPCI.
‫However, thanks to the massive previous chapter that you had, you now have tools in your tool bag
‫to perform this conversion in an easy way.
‫So let it be your exercise now you have your states which are translational and angular velocities in
‫the body frame, you BWP, you are they are in the body frame and your job now is to convert them into
‫the inertia frame.
‫So knowing your body frame states, what do you need to do in order to.
‫Get your states in the inertia frame.
‫What do you need to do to get them in this state?
‫So how do you get your X, Y, Z position values and then Fifita and BPCI attitude values?
‫Again, no calculations are necessary.
‫It's a concept testing one or two minute exercise.
‫I want you to think in terms of general steps of what you would do in order to get that.
‫What would be your blueprint for that?
‫So I'll tell you that in the next video.
‫But first, try yourself as well.
‫All right.
‫So see you in the next video.
‫Thank you very much.