‫Welcome back.
‫So how would you solve this problem with two controllers where the feedback legalization controller
‫gives you five are and theater?
‫Well, it gives it to the PC controller, but then the NPC does not have enough time to reach your firearm.
‫theTr are.
‫Meaning that the real drones angles are unable to reach these values.
‫The answer is very simple for every time you use the feedback legionaries Asian controller, you use
‫the NPC multiple times.
‫Essentially, what you have is an inner loop for the NPC and then the outer loop for the feedback leaners
‫Asian controller.
‫So it looks like this your states are coming out from here.
‫And this would be your inner loop.
‫And this would be your outlook.
‫So every time you do the outer loop, you do multiple inner loops.
‫It means that the inner loop runs at the higher rate or at the higher frequency than the outer loop.
‫It means that for each outer loop, you run the inner loop more times in.
‫Of course, the ratio is four to one.
‫It means that you have four inner loop runs per one outer loop run.
‫And in our case, this is enough time for the NPC controller to reach their 5R and set our targets before
‫starting to chase new targets and so on a graph, it would look something like this.
‫And by the way, I'm just going to do it for the fire angle now, but the same principle applies to
‫the city angle as well.
‫So let's say that this is your FI-, our one.
‫The time span is from zero to 0.4 seconds.
‫The inner loop completes one cycle in 0.1 seconds, which is our sample time interval.
‫So this inner loop, it happens in one two seconds.
‫So I'm just going to put here one times piece.
‫And since the ratio is four to one, that means that the outer loop happens.
‫In 0.4 seconds or four times T sub s seconds.
‫So I'm going to put here four times.
‫T.S. it takes 0.4 seconds to complete this outer loop.
‫And during the time this inner loop goes in circles four times, that's what it means.
‫Now, keep in mind that each fighter and fighter are.
‫Is given to the NPC for 0.4 seconds, which means that it has five data points.
‫You have one data point at K.
‫One at Cape Plus, one one at Cape lost, two, one at Cape Plus three.
‫And then one at Cape Plus for.
‫And so this key here, this is for now.
‫This is for PR. And then keep us one, keep us to keep us three and keep us for they are for the future.
‫So essentially, what really happens is that every 0.4 seconds, the feedback legalization controller
‫will give an array of five equal numbers to the embassy controller.
‫And that's why this line here is a straight line because these values here are equal.
‫So if you plot five are against time, then this here would be zero point three radiance.
‫And then if you had a graph for the thetr angle, then you would have a similar thing a straight line
‫for.
‫The angle seats are so your seats are would be at 0.2 radiance.
‫It would be a straight line as well, with five data points and then 0.4 seconds later, the feedback
‫legalization controller will give the NPC another two arrays.
‫Fire and thetr are then have five numbers each that are equal in each array.
‫And so the NPC will start working.
‫And let's say that the first inner loop that happens here in one time stands seconds right in one interval.
‫This first inner loop will get the drone here in terms of the fire angle.
‫The second inner loop will get the drone here in terms of its fly angle.
‫The third in the loop will take it here, and then the fourth in a loop will take it here, and then
‫a new outer loop happens every 0.4 seconds.
‫And again, you have new reference values here.
‫So this would be your seat are two.
‫Again, this would be your K for your present.
‫Then this data point would be for your future.
‫This as well, this as well.
‫And also this one.
‫So this data goes to the embassy and the embassy will start working.
‫And so this would be the first in a loop.
‫Then the second inner loop, then the third inner loop and the fourth inner loop.
‫And then again, just like at the very beginning at time, equals zero seconds and then like at time
‫equals zero point four seconds.
‫Again, you will have an outer loop, so the feedback legalization controller will do its job and give
‫this data to the embassy controller, which will be your FY Sub R three.
‫And of course, the same thing for SETA.
‫And again, your embassy controller will work its magic to get the real drone to this position in terms
‫of its fi angle.
‫And so when your inner loop runs at the higher frequency than your outer loop, which means that your
‫attitude controller your NPC runs at the higher rate than your position or feedback minimization controller.
‫Then we say that the ads the controller has.
‫Higher.
‫Dynamics, or you can also see stronger dynamics.
‫So the inner loop has stronger dynamics because it runs more often.
‫It runs at the higher frequency.
‫Compared to the outer loop.
‫So you can also say that this outer loop has weaker dynamics.
‫All right.
‫And so in terms of programming, you can imagine that you have two loops, one inside another like this.
‫You have a for loop here that ends here.
‫And then inside it, you will have another for loop that will end here and then in between you have
‫some kind of code.
‫And you can also have some kind of code here as well, of course.
‫And here it depends on how you program it.
‫So essentially, you can read it like this for each outer loop that you have here, you have four inner
‫loops.
‫So every time you run this outer loop, you run this inner loop four times.
‫And also remember that the embassy had something called the horizon period and the horizon period in
‫embassy was how much into the future you predicted your states.
‫Later, when we start with the embassy, you will see that the horizon period for the embassy will also
‫be for samples.
‫So for the samples at time now, plus zero point one seconds.
‫Time now, plus zero point two seconds.
‫Time now, plus 0.3 seconds.
‫And time now, plus zero point four seconds.
‫And this is your time now here.
‫So from T and up until 10 plus zero point four seconds, that would be your entire outer loop.
‫And so your horizon period would then be for so.
‫Using the US vs mathematical model, it will try to predict the state values for Kate Plus one Kate
‫Plus two, Kate Plus three and Kate plus four.
‫And then your present state values would be at.
‫But of course, you don't have to predict that because you already know that because it's a time now.
‫And so that's why you see that your horizon period has four values year horizon period is for.
‫And then after one inner loop, you are here, since the embassy controller only works during this period
‫of 0.4 seconds until it's given a new target, because of that, the horizon period does not slide.
‫So after the first inner loop, the horizon period becomes three K plus one, K plus two and K plus
‫three.
‫So the embassy predicts the state values three times steps ahead.
‫Then the third inner loop happens and you are here, then Horizon period becomes too.
‫So the embassy will predict the state values two steps into the future.
‫Kate Plus one.
‫And then Kate Plus two.
‫Then the fourth inner loop happens in your Horizon period becomes one.
‫So you only predict one sample time into the future and then in the next cycle, the outer loop happens
‫and so you get yourself a new target.
‫So the horizon period equals four here.
‫It equals three here to here.
‫One here.
‫And when the new outer loop starts, you get yourself a new target and then the same thing will start
‫all over again.
‫And now in the next video, let's talk a little bit about this are.