﻿1
00:00:00,700 --> 00:00:01,540
‫Welcome back.

2
00:00:02,140 --> 00:00:05,110
‫I think it's good now to look at the big picture.

3
00:00:06,000 --> 00:00:09,100
‫You have your plant and you have your controller.

4
00:00:10,070 --> 00:00:13,880
‫The controller takes in the reference values.

5
00:00:14,880 --> 00:00:15,850
‫X, Y, Z.

6
00:00:15,900 --> 00:00:24,120
‫Which are the position, reference values and Fifita and BPCI, which are the attitude, reference values.

7
00:00:25,160 --> 00:00:30,290
‫Right now, we don't care about the controller, we only care about the plant, the controller right

8
00:00:30,290 --> 00:00:31,730
‫now is a black box.

9
00:00:31,730 --> 00:00:33,170
‫We don't know what's inside there.

10
00:00:34,180 --> 00:00:40,780
‫We're almost done with the plant so soon, very soon, we're going to go and start unpacking the controller.

11
00:00:41,840 --> 00:00:46,550
‫The thing is that our controller will, in fact, need a lot of stuff.

12
00:00:47,770 --> 00:01:00,760
‫It will need the state values in the body frame, so you, the W, P, Q and R and you get it from the

13
00:01:00,760 --> 00:01:01,310
‫plant.

14
00:01:02,380 --> 00:01:10,720
‫So in this plant, you have a box, a mini box inside the big box where you have you that weeda w dot

15
00:01:11,080 --> 00:01:20,170
‫p q that an r that this mini box consists of all these six states based equations.

16
00:01:21,220 --> 00:01:29,260
‫Because this is where you get your due date with the W dot and then that Cuidad and R dot from these

17
00:01:29,260 --> 00:01:40,270
‫equations, so that many boxes for these equations here and then you put it through an integration box

18
00:01:41,260 --> 00:01:53,410
‫and that integration box, it will give you U, V, W, P, Q and R, and this integration box is for

19
00:01:53,410 --> 00:02:01,210
‫these equations here where you take your state now, the time derivative of your state, your sample

20
00:02:01,210 --> 00:02:05,760
‫time interval and then your end value and then you compute your new state.

21
00:02:06,580 --> 00:02:09,500
‫So that's the integration box over there.

22
00:02:10,480 --> 00:02:17,650
‫And so these new states then go into the controller, but not only.

23
00:02:18,660 --> 00:02:25,560
‫If you look at this set of state base equations, then you see that in order to compute the time derivatives

24
00:02:25,560 --> 00:02:30,110
‫of your states, you need the states themselves.

25
00:02:30,480 --> 00:02:40,800
‫You see, you have the here you have WQ are because remember, the states based equations mean that

26
00:02:40,800 --> 00:02:47,640
‫your state time derivatives, they are a function of your states and inputs.

27
00:02:48,750 --> 00:02:52,210
‫So you need the actual states in these equations as well.

28
00:02:53,190 --> 00:03:00,520
‫That means that these body frame states, they have to go back into this box as well.

29
00:03:01,560 --> 00:03:12,720
‫So the states that leave the plant, they leave the plant as states at K plus one, but then the same

30
00:03:12,990 --> 00:03:23,610
‫states the same numbers that leave the plant when they go back into this box here, then they go into

31
00:03:23,610 --> 00:03:33,360
‫this box as states at K, then you compute the new derivatives, you perform the integration again,

32
00:03:34,200 --> 00:03:39,570
‫and then you compute the new states that will be states at K plus one.

33
00:03:40,290 --> 00:03:50,880
‫And then these new states, they will go back into the plant and into this state's basic equation box.

34
00:03:51,810 --> 00:03:57,900
‫And when they do again, they will enter this box as states at K.

35
00:03:58,170 --> 00:04:06,770
‫And then again you perform the integration new states at Kapos one, and that's how the loop goes.

36
00:04:07,410 --> 00:04:14,580
‫And in the meantime, of course, these states enter the controller because as you will see in the future,

37
00:04:15,270 --> 00:04:16,860
‫the controller will need them to.

38
00:04:18,370 --> 00:04:27,010
‫One additional remark, this integration method here, this is called an oilor integration method.

39
00:04:27,990 --> 00:04:36,390
‫In this oilor integration method is the simplest one, however, it is also the most imprecise one,

40
00:04:37,260 --> 00:04:46,650
‫which is why often times you need some kind of end value here in order to integrate it with smaller

41
00:04:46,650 --> 00:04:47,430
‫intervals.

42
00:04:48,500 --> 00:04:57,410
‫In the previous course in this series, I used this method, however, in this course, I'm going to

43
00:04:57,410 --> 00:05:02,760
‫teach you a more advanced method to perform this kind of integration.

44
00:05:03,470 --> 00:05:05,300
‫So this is the Euler method.

45
00:05:05,570 --> 00:05:08,270
‫It is the simplest, but also.

46
00:05:09,300 --> 00:05:18,540
‫It is not that much used anymore, especially in advanced projects, because there are some issues associated

47
00:05:18,540 --> 00:05:19,030
‫with it.

48
00:05:19,710 --> 00:05:24,670
‫There are some problems with it and I'm going to talk about it very soon.

49
00:05:25,530 --> 00:05:32,250
‫So in this course, I'm going to teach you a method called Runga Kutta.

50
00:05:33,180 --> 00:05:39,720
‫More precisely, a fourth order wrong Akutan integrator.

51
00:05:40,720 --> 00:05:46,250
‫It's a very popular integration technique in order to compute new states.

52
00:05:47,130 --> 00:05:49,020
‫It is very widely used.

53
00:05:49,830 --> 00:05:59,430
‫For example, in Matlab, there is a very advanced, integrated function called Odie's forty five.

54
00:06:00,270 --> 00:06:06,090
‫And they created that function using the fourth order Runga Kouta method.

55
00:06:06,990 --> 00:06:09,030
‫And that's why you have four here.

56
00:06:09,390 --> 00:06:16,200
‫I'm not sure what the five stands for, but what I know is that four stands for the fourth order.

57
00:06:16,380 --> 00:06:18,300
‫Wrong Kutta integrated method.

58
00:06:19,310 --> 00:06:26,140
‫This is going to be a slightly more complicated than the Oilor method that we used in the previous course.

59
00:06:26,640 --> 00:06:27,360
‫However.

60
00:06:28,490 --> 00:06:35,990
‫Learning that would be very beneficial to you, because in the engineering community, it's very popular

61
00:06:36,590 --> 00:06:43,400
‫and very widely used, so we're going to talk about it very soon in this section, in fact.

62
00:06:44,630 --> 00:06:56,540
‫So in this integrated box, you can use either Oilor, which is this one here in yellow or.

63
00:06:57,820 --> 00:06:58,720
‫Runga Kouta.

64
00:06:59,650 --> 00:07:01,530
‫OK, so let's carry on now.

65
00:07:02,470 --> 00:07:04,840
‫Now, we also had another box here.

66
00:07:05,940 --> 00:07:07,980
‫We had an omega box.

67
00:07:09,080 --> 00:07:17,240
‫Which had to be as a function of the control inputs, the use, remember, the controller will give

68
00:07:17,240 --> 00:07:19,430
‫you four system inputs.

69
00:07:20,590 --> 00:07:32,110
‫It will give you you one, you two, you three and you four, and we needed that box because the state's

70
00:07:32,110 --> 00:07:36,430
‫basic equation box also needs the Omega's, right.

71
00:07:37,390 --> 00:07:49,600
‫So from this box, you will get your omega one Omega to Omega three and Omega four like this, because

72
00:07:49,600 --> 00:07:55,780
‫if you look at the states basic equations here, then you see you need an Omega.

73
00:07:56,350 --> 00:08:02,540
‫And this total Omega is composed of four Omega's from each model.

74
00:08:03,400 --> 00:08:09,810
‫So to be precise, this box will actually give the total sum of all the omega three.

75
00:08:10,910 --> 00:08:17,240
‫Because inside this box, once you have your four or Mangahas from your four mortars, you will add

76
00:08:17,240 --> 00:08:26,740
‫them all up and then you will send that total Omega into this state base equation box.

77
00:08:27,590 --> 00:08:33,260
‫But to be honest with you, that even our controller will need that Omega.

78
00:08:34,160 --> 00:08:36,560
‫So what will really happen is that.

79
00:08:37,800 --> 00:08:46,500
‫This Omega will not only go to that box, but it also needs to go into the controller, so this Omega

80
00:08:46,500 --> 00:08:50,360
‫will go into the controller, then the controller will compute.

81
00:08:50,370 --> 00:08:57,540
‫You want you to use 3U for it will go into this omega box and then a new Omega will come out.

82
00:08:58,050 --> 00:09:00,130
‫And of course, we're going to treat that box as well.

83
00:09:01,110 --> 00:09:08,400
‫And now if you look at your state base equations, then you see that you also have you want you to use

84
00:09:08,400 --> 00:09:09,710
‫three and you four here.

85
00:09:10,320 --> 00:09:15,330
‫So that means that they use that go into this omega box.

86
00:09:15,750 --> 00:09:22,170
‫The same use need to go into the state's basic equation box.

87
00:09:23,070 --> 00:09:32,080
‫So the same you want you to use three and you four will go into this box as well.

88
00:09:33,090 --> 00:09:41,790
‫Then if you look at your integrator, in this case, Oilor and later Runga Kutta, which by the way,

89
00:09:42,420 --> 00:09:44,910
‫will also be used in the code.

90
00:09:45,100 --> 00:09:53,220
‫So this time in the code, I will use Runga Kutta, but in either case, in order to compute a new state,

91
00:09:53,610 --> 00:09:55,890
‫you need a present state.

92
00:09:56,760 --> 00:10:06,900
‫You see you have your EUC, V.K., W.K., etc. It means that these body frame state values, they also

93
00:10:06,900 --> 00:10:10,690
‫have to find their way into this integrated box.

94
00:10:11,910 --> 00:10:12,900
‫So there you go.

95
00:10:13,710 --> 00:10:18,420
‫The same body frame states go also into this integrated box.

96
00:10:19,260 --> 00:10:28,800
‫And now due to the fact that the reference values these ones here they are all in the inertia frame.

97
00:10:29,490 --> 00:10:36,190
‫Your states that come out of the planned model must also be in the inertia frame.

98
00:10:36,510 --> 00:10:44,040
‫So not only in the body frame, but you also have to convert them into the inertia frame and then they

99
00:10:44,040 --> 00:10:48,800
‫also have to get out of the plant and into the controller.

100
00:10:49,860 --> 00:10:58,530
‫Otherwise, if you don't do the conversion, then you compare the inertia frame reference values to

101
00:10:58,530 --> 00:11:05,400
‫the body frame states and that would be like comparing apples with oranges.

102
00:11:06,240 --> 00:11:11,430
‫You shouldn't compare measurements that are made in different reference frames.

103
00:11:12,360 --> 00:11:14,120
‫It would simply not make sense.

104
00:11:15,230 --> 00:11:21,320
‫It's like comparing two distances and one is in kilometers and the other one is in miles.

105
00:11:22,320 --> 00:11:30,740
‫So in addition to the body frame states, the controller will also need the states in the initial frame.

106
00:11:31,680 --> 00:11:36,860
‫So it will need X, Y, Z and Fifita and BPCI.

107
00:11:37,860 --> 00:11:45,660
‫However, thanks to the massive previous chapter that you had, you now have tools in your tool bag

108
00:11:46,110 --> 00:11:48,930
‫to perform this conversion in an easy way.

109
00:11:49,970 --> 00:11:57,980
‫So let it be your exercise now you have your states which are translational and angular velocities in

110
00:11:57,980 --> 00:12:07,310
‫the body frame, you BWP, you are they are in the body frame and your job now is to convert them into

111
00:12:07,310 --> 00:12:08,300
‫the inertia frame.

112
00:12:09,320 --> 00:12:16,220
‫So knowing your body frame states, what do you need to do in order to.

113
00:12:17,230 --> 00:12:20,060
‫Get your states in the inertia frame.

114
00:12:20,740 --> 00:12:24,750
‫What do you need to do to get them in this state?

115
00:12:25,660 --> 00:12:33,800
‫So how do you get your X, Y, Z position values and then Fifita and BPCI attitude values?

116
00:12:34,820 --> 00:12:37,460
‫Again, no calculations are necessary.

117
00:12:37,690 --> 00:12:41,780
‫It's a concept testing one or two minute exercise.

118
00:12:42,640 --> 00:12:48,580
‫I want you to think in terms of general steps of what you would do in order to get that.

119
00:12:49,450 --> 00:12:51,670
‫What would be your blueprint for that?

120
00:12:52,360 --> 00:12:55,470
‫So I'll tell you that in the next video.

121
00:12:55,570 --> 00:12:57,250
‫But first, try yourself as well.

122
00:12:57,280 --> 00:12:57,660
‫All right.

123
00:12:58,330 --> 00:13:00,100
‫So see you in the next video.

124
00:13:00,340 --> 00:13:01,210
‫Thank you very much.

