﻿1
00:00:00,660 --> 00:00:01,470
‫Welcome back.

2
00:00:02,280 --> 00:00:09,750
‫So how would you solve this problem with two controllers where the feedback legalization controller

3
00:00:10,230 --> 00:00:13,100
‫gives you five are and theater?

4
00:00:14,190 --> 00:00:22,620
‫Well, it gives it to the PC controller, but then the NPC does not have enough time to reach your firearm.

5
00:00:22,620 --> 00:00:23,580
‫theTr are.

6
00:00:24,690 --> 00:00:31,830
‫Meaning that the real drones angles are unable to reach these values.

7
00:00:32,920 --> 00:00:41,380
‫The answer is very simple for every time you use the feedback legionaries Asian controller, you use

8
00:00:41,530 --> 00:00:44,110
‫the NPC multiple times.

9
00:00:44,740 --> 00:00:54,390
‫Essentially, what you have is an inner loop for the NPC and then the outer loop for the feedback leaners

10
00:00:54,400 --> 00:00:55,300
‫Asian controller.

11
00:00:56,470 --> 00:01:00,940
‫So it looks like this your states are coming out from here.

12
00:01:02,070 --> 00:01:04,910
‫And this would be your inner loop.

13
00:01:06,120 --> 00:01:08,070
‫And this would be your outlook.

14
00:01:09,180 --> 00:01:15,800
‫So every time you do the outer loop, you do multiple inner loops.

15
00:01:16,840 --> 00:01:25,120
‫It means that the inner loop runs at the higher rate or at the higher frequency than the outer loop.

16
00:01:25,600 --> 00:01:33,460
‫It means that for each outer loop, you run the inner loop more times in.

17
00:01:33,500 --> 00:01:37,750
‫Of course, the ratio is four to one.

18
00:01:38,740 --> 00:01:45,130
‫It means that you have four inner loop runs per one outer loop run.

19
00:01:46,210 --> 00:01:56,500
‫And in our case, this is enough time for the NPC controller to reach their 5R and set our targets before

20
00:01:56,500 --> 00:02:03,070
‫starting to chase new targets and so on a graph, it would look something like this.

21
00:02:03,490 --> 00:02:09,760
‫And by the way, I'm just going to do it for the fire angle now, but the same principle applies to

22
00:02:09,760 --> 00:02:11,170
‫the city angle as well.

23
00:02:12,300 --> 00:02:16,650
‫So let's say that this is your FI-, our one.

24
00:02:17,810 --> 00:02:21,530
‫The time span is from zero to 0.4 seconds.

25
00:02:22,730 --> 00:02:31,250
‫The inner loop completes one cycle in 0.1 seconds, which is our sample time interval.

26
00:02:32,420 --> 00:02:37,280
‫So this inner loop, it happens in one two seconds.

27
00:02:38,320 --> 00:02:42,050
‫So I'm just going to put here one times piece.

28
00:02:43,090 --> 00:02:49,750
‫And since the ratio is four to one, that means that the outer loop happens.

29
00:02:50,810 --> 00:02:57,860
‫In 0.4 seconds or four times T sub s seconds.

30
00:02:58,880 --> 00:03:01,130
‫So I'm going to put here four times.

31
00:03:01,830 --> 00:03:07,550
‫T.S. it takes 0.4 seconds to complete this outer loop.

32
00:03:07,940 --> 00:03:15,620
‫And during the time this inner loop goes in circles four times, that's what it means.

33
00:03:16,630 --> 00:03:22,300
‫Now, keep in mind that each fighter and fighter are.

34
00:03:23,390 --> 00:03:33,950
‫Is given to the NPC for 0.4 seconds, which means that it has five data points.

35
00:03:34,970 --> 00:03:37,070
‫You have one data point at K.

36
00:03:38,150 --> 00:03:45,620
‫One at Cape Plus, one one at Cape lost, two, one at Cape Plus three.

37
00:03:45,800 --> 00:03:49,280
‫And then one at Cape Plus for.

38
00:03:50,450 --> 00:03:53,840
‫And so this key here, this is for now.

39
00:03:54,290 --> 00:04:02,330
‫This is for PR. And then keep us one, keep us to keep us three and keep us for they are for the future.

40
00:04:03,420 --> 00:04:13,140
‫So essentially, what really happens is that every 0.4 seconds, the feedback legalization controller

41
00:04:14,340 --> 00:04:21,090
‫will give an array of five equal numbers to the embassy controller.

42
00:04:22,020 --> 00:04:29,070
‫And that's why this line here is a straight line because these values here are equal.

43
00:04:30,220 --> 00:04:39,280
‫So if you plot five are against time, then this here would be zero point three radiance.

44
00:04:40,320 --> 00:04:47,550
‫And then if you had a graph for the thetr angle, then you would have a similar thing a straight line

45
00:04:47,970 --> 00:04:48,810
‫for.

46
00:04:50,000 --> 00:04:55,340
‫The angle seats are so your seats are would be at 0.2 radiance.

47
00:04:55,550 --> 00:05:04,550
‫It would be a straight line as well, with five data points and then 0.4 seconds later, the feedback

48
00:05:04,550 --> 00:05:10,370
‫legalization controller will give the NPC another two arrays.

49
00:05:10,610 --> 00:05:17,900
‫Fire and thetr are then have five numbers each that are equal in each array.

50
00:05:18,770 --> 00:05:21,620
‫And so the NPC will start working.

51
00:05:21,860 --> 00:05:32,870
‫And let's say that the first inner loop that happens here in one time stands seconds right in one interval.

52
00:05:33,470 --> 00:05:39,470
‫This first inner loop will get the drone here in terms of the fire angle.

53
00:05:40,720 --> 00:05:46,690
‫The second inner loop will get the drone here in terms of its fly angle.

54
00:05:47,900 --> 00:05:55,760
‫The third in the loop will take it here, and then the fourth in a loop will take it here, and then

55
00:05:56,030 --> 00:06:00,500
‫a new outer loop happens every 0.4 seconds.

56
00:06:01,160 --> 00:06:04,310
‫And again, you have new reference values here.

57
00:06:05,240 --> 00:06:08,810
‫So this would be your seat are two.

58
00:06:09,560 --> 00:06:13,370
‫Again, this would be your K for your present.

59
00:06:13,970 --> 00:06:16,790
‫Then this data point would be for your future.

60
00:06:17,690 --> 00:06:20,690
‫This as well, this as well.

61
00:06:20,930 --> 00:06:23,450
‫And also this one.

62
00:06:24,530 --> 00:06:29,510
‫So this data goes to the embassy and the embassy will start working.

63
00:06:29,870 --> 00:06:32,930
‫And so this would be the first in a loop.

64
00:06:33,500 --> 00:06:42,200
‫Then the second inner loop, then the third inner loop and the fourth inner loop.

65
00:06:43,130 --> 00:06:50,330
‫And then again, just like at the very beginning at time, equals zero seconds and then like at time

66
00:06:50,330 --> 00:06:52,430
‫equals zero point four seconds.

67
00:06:53,480 --> 00:07:02,330
‫Again, you will have an outer loop, so the feedback legalization controller will do its job and give

68
00:07:02,330 --> 00:07:10,010
‫this data to the embassy controller, which will be your FY Sub R three.

69
00:07:10,220 --> 00:07:13,400
‫And of course, the same thing for SETA.

70
00:07:14,510 --> 00:07:24,770
‫And again, your embassy controller will work its magic to get the real drone to this position in terms

71
00:07:24,770 --> 00:07:26,710
‫of its fi angle.

72
00:07:27,710 --> 00:07:35,000
‫And so when your inner loop runs at the higher frequency than your outer loop, which means that your

73
00:07:35,000 --> 00:07:44,150
‫attitude controller your NPC runs at the higher rate than your position or feedback minimization controller.

74
00:07:45,200 --> 00:07:48,650
‫Then we say that the ads the controller has.

75
00:07:49,870 --> 00:07:50,680
‫Higher.

76
00:07:51,790 --> 00:07:56,470
‫Dynamics, or you can also see stronger dynamics.

77
00:07:57,430 --> 00:08:03,100
‫So the inner loop has stronger dynamics because it runs more often.

78
00:08:04,210 --> 00:08:06,670
‫It runs at the higher frequency.

79
00:08:07,670 --> 00:08:10,100
‫Compared to the outer loop.

80
00:08:11,400 --> 00:08:16,500
‫So you can also say that this outer loop has weaker dynamics.

81
00:08:16,770 --> 00:08:17,280
‫All right.

82
00:08:18,390 --> 00:08:25,290
‫And so in terms of programming, you can imagine that you have two loops, one inside another like this.

83
00:08:26,470 --> 00:08:30,670
‫You have a for loop here that ends here.

84
00:08:31,790 --> 00:08:40,850
‫And then inside it, you will have another for loop that will end here and then in between you have

85
00:08:40,850 --> 00:08:41,810
‫some kind of code.

86
00:08:42,500 --> 00:08:45,440
‫And you can also have some kind of code here as well, of course.

87
00:08:46,580 --> 00:08:49,250
‫And here it depends on how you program it.

88
00:08:50,540 --> 00:08:59,720
‫So essentially, you can read it like this for each outer loop that you have here, you have four inner

89
00:08:59,720 --> 00:09:00,260
‫loops.

90
00:09:00,830 --> 00:09:07,460
‫So every time you run this outer loop, you run this inner loop four times.

91
00:09:08,390 --> 00:09:16,130
‫And also remember that the embassy had something called the horizon period and the horizon period in

92
00:09:16,130 --> 00:09:21,470
‫embassy was how much into the future you predicted your states.

93
00:09:22,580 --> 00:09:30,410
‫Later, when we start with the embassy, you will see that the horizon period for the embassy will also

94
00:09:30,410 --> 00:09:33,770
‫be for samples.

95
00:09:34,370 --> 00:09:42,380
‫So for the samples at time now, plus zero point one seconds.

96
00:09:43,400 --> 00:09:46,550
‫Time now, plus zero point two seconds.

97
00:09:47,510 --> 00:09:49,870
‫Time now, plus 0.3 seconds.

98
00:09:50,950 --> 00:09:56,380
‫And time now, plus zero point four seconds.

99
00:09:57,540 --> 00:09:59,880
‫And this is your time now here.

100
00:10:01,170 --> 00:10:08,520
‫So from T and up until 10 plus zero point four seconds, that would be your entire outer loop.

101
00:10:08,970 --> 00:10:13,770
‫And so your horizon period would then be for so.

102
00:10:14,970 --> 00:10:24,830
‫Using the US vs mathematical model, it will try to predict the state values for Kate Plus one Kate

103
00:10:24,840 --> 00:10:30,450
‫Plus two, Kate Plus three and Kate plus four.

104
00:10:31,510 --> 00:10:34,750
‫And then your present state values would be at.

105
00:10:35,890 --> 00:10:41,740
‫But of course, you don't have to predict that because you already know that because it's a time now.

106
00:10:42,760 --> 00:10:50,080
‫And so that's why you see that your horizon period has four values year horizon period is for.

107
00:10:51,080 --> 00:11:00,500
‫And then after one inner loop, you are here, since the embassy controller only works during this period

108
00:11:00,500 --> 00:11:10,250
‫of 0.4 seconds until it's given a new target, because of that, the horizon period does not slide.

109
00:11:10,970 --> 00:11:20,390
‫So after the first inner loop, the horizon period becomes three K plus one, K plus two and K plus

110
00:11:20,390 --> 00:11:21,020
‫three.

111
00:11:22,270 --> 00:11:27,100
‫So the embassy predicts the state values three times steps ahead.

112
00:11:28,460 --> 00:11:35,790
‫Then the third inner loop happens and you are here, then Horizon period becomes too.

113
00:11:35,810 --> 00:11:41,000
‫So the embassy will predict the state values two steps into the future.

114
00:11:42,330 --> 00:11:43,380
‫Kate Plus one.

115
00:11:43,920 --> 00:11:45,600
‫And then Kate Plus two.

116
00:11:46,730 --> 00:11:52,250
‫Then the fourth inner loop happens in your Horizon period becomes one.

117
00:11:53,310 --> 00:12:01,170
‫So you only predict one sample time into the future and then in the next cycle, the outer loop happens

118
00:12:01,170 --> 00:12:03,780
‫and so you get yourself a new target.

119
00:12:04,830 --> 00:12:07,950
‫So the horizon period equals four here.

120
00:12:09,010 --> 00:12:12,070
‫It equals three here to here.

121
00:12:13,170 --> 00:12:13,980
‫One here.

122
00:12:14,670 --> 00:12:20,610
‫And when the new outer loop starts, you get yourself a new target and then the same thing will start

123
00:12:20,640 --> 00:12:21,570
‫all over again.

124
00:12:22,380 --> 00:12:27,150
‫And now in the next video, let's talk a little bit about this are.

