﻿1
00:00:00,450 --> 00:00:01,200
‫Welcome back.

2
00:00:01,950 --> 00:00:09,240
‫So hopefully you have found the time derivatives for these equations and the second time derivatives

3
00:00:09,240 --> 00:00:17,790
‫as well, I simply followed the calculus rules, the trigonometric rules, the chain rule, and these

4
00:00:17,790 --> 00:00:19,040
‫are the answers here.

5
00:00:19,530 --> 00:00:26,730
‫So in Orange, you have the first time derivative of these equations and then here in purple, you have

6
00:00:26,730 --> 00:00:29,480
‫the second time derivatives of them.

7
00:00:30,120 --> 00:00:38,850
‫And so what the planner does, it essentially creates a table where you have your time, your X are,

8
00:00:38,850 --> 00:00:48,300
‫Y are and NCAR, X or Y that are, and Z that are and their second derivatives.

9
00:00:49,050 --> 00:00:58,140
‫And so you have this table here and then here you have time equals zero seconds, then zero point four

10
00:00:58,140 --> 00:01:06,450
‫seconds, because remember the outer loop lasted for zero point four seconds and then during that time

11
00:01:06,720 --> 00:01:13,080
‫you had four inner loops, then zero point eight seconds here and so on.

12
00:01:13,770 --> 00:01:22,200
‫And for each time value you had a value for the reference values, their first time derivatives and

13
00:01:22,200 --> 00:01:24,160
‫second time derivatives.

14
00:01:24,720 --> 00:01:32,270
‫So for each time value, you would have all these nine values here like this.

15
00:01:33,360 --> 00:01:42,630
‫And so to get these values here, for example, if you want to know the values for time equals zero

16
00:01:42,630 --> 00:01:52,380
‫point eight seconds, then you just take this zero point eight seconds and then you put it here, here,

17
00:01:52,830 --> 00:01:55,500
‫then here, here as well.

18
00:01:55,770 --> 00:01:56,730
‫Also here.

19
00:01:57,150 --> 00:02:04,020
‫Well, here you will have a constant so you don't have a time variable here, but then you put it here

20
00:02:04,230 --> 00:02:05,130
‫and then here.

21
00:02:05,400 --> 00:02:10,440
‫And then the second derivative of the reference Z value is zero.

22
00:02:10,890 --> 00:02:14,510
‫And that's how you compute these values here.

23
00:02:15,540 --> 00:02:22,950
‫And then once this table is ready, then the planner gives it to the feedback lionization controller.

24
00:02:24,060 --> 00:02:32,910
‫And now due to the fact that the two controllers run at different frequencies, then that means that

25
00:02:33,120 --> 00:02:42,840
‫the new one control force that was produced by the position controller will have the same value throughout

26
00:02:43,440 --> 00:02:46,370
‫all the internal loop iterations.

27
00:02:47,130 --> 00:02:54,150
‫However, you two, you three and you four will have different values in every inner loop iteration

28
00:02:54,480 --> 00:03:02,940
‫because they are found by the attitude controller in each inner loop iteration in each in a loop cycle.

29
00:03:04,030 --> 00:03:05,200
‫So, for example.

30
00:03:06,180 --> 00:03:13,800
‫You have your you want you to use three and you four and then you one was, of course, in Newtons and

31
00:03:13,800 --> 00:03:18,240
‫then you two, you three and you four, they were Newton meters.

32
00:03:19,290 --> 00:03:31,680
‫So this would be your time sample, now K, then K plus one K plus two, K plus three and K plus four.

33
00:03:32,600 --> 00:03:37,880
‫And let's say that you one is one point three Newtons.

34
00:03:38,970 --> 00:03:47,370
‫So one outer loop will produce these values here, and you can see that they are all the same because

35
00:03:47,910 --> 00:03:50,280
‫they were produced by one outer loop.

36
00:03:51,210 --> 00:03:56,550
‫At the same time, you have had four inner loops.

37
00:03:57,150 --> 00:04:04,380
‫And so in each inner loop, the controller is going to produce some kind of value for you to Q3 and

38
00:04:04,380 --> 00:04:04,950
‫Q4.

39
00:04:05,460 --> 00:04:16,500
‫And let's say that during the first inner loop, the NPC controller will produce these values for you

40
00:04:16,500 --> 00:04:21,210
‫to use three and you you've had one inner loop.

41
00:04:21,690 --> 00:04:29,010
‫And so the NPC controller will give you the first batch of your values, you two, three and four.

42
00:04:29,820 --> 00:04:31,800
‫Then another in a loop happens.

43
00:04:31,800 --> 00:04:39,870
‫And again, you have new Q2, Q3 and Q4 values in Newton meters, another in a loop and another you

44
00:04:39,870 --> 00:04:42,390
‫two use three and you four values.

45
00:04:43,260 --> 00:04:49,100
‫And then the final fourth inner loop will produce these values for the control moments.

46
00:04:49,980 --> 00:04:52,290
‫These are all random numbers, of course.

47
00:04:52,290 --> 00:04:54,450
‫I'm just taking them from the top of my head.

48
00:04:55,290 --> 00:05:00,000
‫And so in one outer loop, you have four identical U.

49
00:05:00,000 --> 00:05:09,450
‫One values, but you two use three and you four, they're different every time an inner loop happens.

50
00:05:10,520 --> 00:05:19,600
‫And now you might ask yourself why I didn't put these numbers from Kate plus one to Kate plus four.

51
00:05:20,150 --> 00:05:29,390
‫Well, remember, from the previous course, if you remember then we used this kind of notation when

52
00:05:29,390 --> 00:05:41,870
‫we dealt with the NPC controller where a control input at K would influence the states and therefore

53
00:05:41,900 --> 00:05:46,260
‫it would produce the states at K plus one.

54
00:05:47,240 --> 00:05:54,620
‫So let's say that here you have states, whatever they are, and so you have states one.

55
00:05:55,590 --> 00:06:09,780
‫States to states three and states four, and so these inputs here that you have at K will produce these

56
00:06:09,780 --> 00:06:12,810
‫states here at K plus one.

57
00:06:14,020 --> 00:06:25,420
‫Then the inputs at K plus one will produce the states at K plus two inputs at K plus two will produce

58
00:06:25,600 --> 00:06:37,720
‫the States and K plus three and then inputs at K plus three will produce the states at K plus four and

59
00:06:37,720 --> 00:06:46,360
‫then a new outer loop happens and then the old K plus four will become the new K.

60
00:06:47,480 --> 00:06:52,900
‫And then from here, it goes to Kate plus one, Kate plus two and et cetera.

61
00:06:53,980 --> 00:06:59,390
‫Because remember how it was with this graph, for example, when we had our fly, right?

62
00:06:59,770 --> 00:07:03,190
‫This was our first fly, our.

63
00:07:04,360 --> 00:07:12,760
‫Then a new alternative happens and then we start from here, and that would be our second fire, our.

64
00:07:13,750 --> 00:07:23,170
‫And then that, for example, would be our third are so for this point, it would be our Kate plus four,

65
00:07:23,410 --> 00:07:26,370
‫but then for this point it would be our OK.

66
00:07:27,330 --> 00:07:35,220
‫And then it would be Kate plus four here, and then again, you would start from K here and then end

67
00:07:35,220 --> 00:07:37,230
‫up here at K plus four.

68
00:07:38,300 --> 00:07:41,190
‫So that's the logic behind our notation here.

69
00:07:41,990 --> 00:07:51,470
‫And finally, let's close up these loops like this from the plant, you get all these 12 states, six

70
00:07:51,470 --> 00:07:54,320
‫in the body frame and six in the frame.

71
00:07:55,490 --> 00:08:05,210
‫This inner loop happens every two seconds and the outer loop at every four times two seconds, and then

72
00:08:05,210 --> 00:08:16,370
‫the state's P, Q, R, Phi Theta and PSI will enter into the NPC controller.

73
00:08:17,330 --> 00:08:24,350
‫Because after all, for the attitude control, you need the angle of the losses of the drone, and then

74
00:08:24,350 --> 00:08:31,570
‫you will also need the orientation angles in the inertia frame, and then you will also need the omega

75
00:08:31,590 --> 00:08:33,620
‫value from the plant.

76
00:08:34,640 --> 00:08:36,560
‫That will go into the controller.

77
00:08:37,600 --> 00:08:52,420
‫And then the states that enter into feedback lionization are this X, Y and Z, then Phi Theta and Passi

78
00:08:53,080 --> 00:09:01,540
‫and then you V and W, after all, it's a position controller.

79
00:09:02,050 --> 00:09:11,110
‫So you might think that you need information about X, Y, Z, and also about you, the W, but also

80
00:09:11,500 --> 00:09:13,660
‫you have a rotation matrix there.

81
00:09:13,660 --> 00:09:18,430
‫So you need these five three time BPCI values as well.

82
00:09:19,300 --> 00:09:21,220
‫And that's it for this section.

83
00:09:21,640 --> 00:09:29,890
‫In the next section we will focus on the NPC controller and we treat the feedback lionization controller

84
00:09:29,890 --> 00:09:31,090
‫as a black box.

85
00:09:31,720 --> 00:09:33,610
‫We won't care how it works.

86
00:09:33,940 --> 00:09:38,950
‫We will simply assume that it magically gives you fire.

87
00:09:39,100 --> 00:09:45,190
‫And Sittar that NPC sees as reference values.

88
00:09:45,910 --> 00:09:53,080
‫And then in the section after that, we will see what's inside the feedback patronization box.

89
00:09:54,120 --> 00:10:01,470
‫And then in the final section, we will look at the code just like we did in the previous course in

90
00:10:01,470 --> 00:10:02,380
‫this series.

91
00:10:03,060 --> 00:10:06,180
‫Thank you very much and see you in the next section.

