‫Welcome back.
‫So hopefully you have found the time derivatives for these equations and the second time derivatives
‫as well, I simply followed the calculus rules, the trigonometric rules, the chain rule, and these
‫are the answers here.
‫So in Orange, you have the first time derivative of these equations and then here in purple, you have
‫the second time derivatives of them.
‫And so what the planner does, it essentially creates a table where you have your time, your X are,
‫Y are and NCAR, X or Y that are, and Z that are and their second derivatives.
‫And so you have this table here and then here you have time equals zero seconds, then zero point four
‫seconds, because remember the outer loop lasted for zero point four seconds and then during that time
‫you had four inner loops, then zero point eight seconds here and so on.
‫And for each time value you had a value for the reference values, their first time derivatives and
‫second time derivatives.
‫So for each time value, you would have all these nine values here like this.
‫And so to get these values here, for example, if you want to know the values for time equals zero
‫point eight seconds, then you just take this zero point eight seconds and then you put it here, here,
‫then here, here as well.
‫Also here.
‫Well, here you will have a constant so you don't have a time variable here, but then you put it here
‫and then here.
‫And then the second derivative of the reference Z value is zero.
‫And that's how you compute these values here.
‫And then once this table is ready, then the planner gives it to the feedback lionization controller.
‫And now due to the fact that the two controllers run at different frequencies, then that means that
‫the new one control force that was produced by the position controller will have the same value throughout
‫all the internal loop iterations.
‫However, you two, you three and you four will have different values in every inner loop iteration
‫because they are found by the attitude controller in each inner loop iteration in each in a loop cycle.
‫So, for example.
‫You have your you want you to use three and you four and then you one was, of course, in Newtons and
‫then you two, you three and you four, they were Newton meters.
‫So this would be your time sample, now K, then K plus one K plus two, K plus three and K plus four.
‫And let's say that you one is one point three Newtons.
‫So one outer loop will produce these values here, and you can see that they are all the same because
‫they were produced by one outer loop.
‫At the same time, you have had four inner loops.
‫And so in each inner loop, the controller is going to produce some kind of value for you to Q3 and
‫Q4.
‫And let's say that during the first inner loop, the NPC controller will produce these values for you
‫to use three and you you've had one inner loop.
‫And so the NPC controller will give you the first batch of your values, you two, three and four.
‫Then another in a loop happens.
‫And again, you have new Q2, Q3 and Q4 values in Newton meters, another in a loop and another you
‫two use three and you four values.
‫And then the final fourth inner loop will produce these values for the control moments.
‫These are all random numbers, of course.
‫I'm just taking them from the top of my head.
‫And so in one outer loop, you have four identical U.
‫One values, but you two use three and you four, they're different every time an inner loop happens.
‫And now you might ask yourself why I didn't put these numbers from Kate plus one to Kate plus four.
‫Well, remember, from the previous course, if you remember then we used this kind of notation when
‫we dealt with the NPC controller where a control input at K would influence the states and therefore
‫it would produce the states at K plus one.
‫So let's say that here you have states, whatever they are, and so you have states one.
‫States to states three and states four, and so these inputs here that you have at K will produce these
‫states here at K plus one.
‫Then the inputs at K plus one will produce the states at K plus two inputs at K plus two will produce
‫the States and K plus three and then inputs at K plus three will produce the states at K plus four and
‫then a new outer loop happens and then the old K plus four will become the new K.
‫And then from here, it goes to Kate plus one, Kate plus two and et cetera.
‫Because remember how it was with this graph, for example, when we had our fly, right?
‫This was our first fly, our.
‫Then a new alternative happens and then we start from here, and that would be our second fire, our.
‫And then that, for example, would be our third are so for this point, it would be our Kate plus four,
‫but then for this point it would be our OK.
‫And then it would be Kate plus four here, and then again, you would start from K here and then end
‫up here at K plus four.
‫So that's the logic behind our notation here.
‫And finally, let's close up these loops like this from the plant, you get all these 12 states, six
‫in the body frame and six in the frame.
‫This inner loop happens every two seconds and the outer loop at every four times two seconds, and then
‫the state's P, Q, R, Phi Theta and PSI will enter into the NPC controller.
‫Because after all, for the attitude control, you need the angle of the losses of the drone, and then
‫you will also need the orientation angles in the inertia frame, and then you will also need the omega
‫value from the plant.
‫That will go into the controller.
‫And then the states that enter into feedback lionization are this X, Y and Z, then Phi Theta and Passi
‫and then you V and W, after all, it's a position controller.
‫So you might think that you need information about X, Y, Z, and also about you, the W, but also
‫you have a rotation matrix there.
‫So you need these five three time BPCI values as well.
‫And that's it for this section.
‫In the next section we will focus on the NPC controller and we treat the feedback lionization controller
‫as a black box.
‫We won't care how it works.
‫We will simply assume that it magically gives you fire.
‫And Sittar that NPC sees as reference values.
‫And then in the section after that, we will see what's inside the feedback patronization box.
‫And then in the final section, we will look at the code just like we did in the previous course in
‫this series.
‫Thank you very much and see you in the next section.