﻿1
00:00:00,740 --> 00:00:01,580
‫Welcome back.

2
00:00:02,120 --> 00:00:08,570
‫So let's now shift our attention to the drone and let's see how to apply constraints to it.

3
00:00:09,140 --> 00:00:16,200
‫I mentioned that the drone rotors have a minimum and the maximum rotational speed.

4
00:00:16,730 --> 00:00:23,660
‫So the Omegas of your rotors had to stay between these minimum and maximum values.

5
00:00:24,260 --> 00:00:30,500
‫You now know that when you want to apply constraints to your embassy controller, then you have to use

6
00:00:30,560 --> 00:00:34,610
‫solvers for that in order to properly use solvers.

7
00:00:35,000 --> 00:00:43,400
‫You have to give it your bull bar matrix and small if transposed vector, which come from your cost

8
00:00:43,400 --> 00:00:50,340
‫function and also your matrix and each vector that come from your constraints.

9
00:00:50,990 --> 00:00:56,090
‫That way, the solver knows what kind of cost, function and constraints you have.

10
00:00:56,660 --> 00:01:03,890
‫The key for knowing exactly what constraints we are talking about is that the solver assumed that your

11
00:01:03,890 --> 00:01:05,840
‫constraints are in this form.

12
00:01:06,590 --> 00:01:11,750
‫G times delta, you global less than or equal to.

13
00:01:12,200 --> 00:01:13,640
‫And then this h vector.

14
00:01:14,300 --> 00:01:19,580
‫It's extremely important that your inequality sign points to the left.

15
00:01:20,330 --> 00:01:23,330
‫Now what is Delta you global in our case?

16
00:01:23,960 --> 00:01:32,090
‫Well, if Horizon period equals four, then your delta you global equals all that.

17
00:01:32,570 --> 00:01:37,430
‫First of all, you have Delta use at K, then you have them at K plus one.

18
00:01:38,030 --> 00:01:40,130
‫Then you have them as K plus two.

19
00:01:40,730 --> 00:01:46,400
‫And then you have them at K Plus three, you have 12 elements in this vector.

20
00:01:46,970 --> 00:01:52,790
‫Now, if we wanted to constrain our delta use directly, then it would have been quite easy.

21
00:01:53,390 --> 00:01:59,660
‫Let's say that you have something like this your delta, your global vector, which is this one here.

22
00:02:00,290 --> 00:02:02,030
‫And remember, it's transposed.

23
00:02:02,150 --> 00:02:09,350
‫So actually as a vector, it's between these minimum values and these maximum values here.

24
00:02:09,890 --> 00:02:16,070
‫So you simply give some kind of meaning values to all these elements and then some kind of maximum values

25
00:02:16,310 --> 00:02:17,750
‫to all these elements.

26
00:02:18,380 --> 00:02:23,870
‫And they will be in this vector here and this vector here, respectively.

27
00:02:24,470 --> 00:02:26,510
‫And now you can separate them like this.

28
00:02:26,870 --> 00:02:28,290
‫You can take this part.

29
00:02:28,850 --> 00:02:30,050
‫Let's call one.

30
00:02:30,680 --> 00:02:35,000
‫And then you can take this part here, and let's call it two.

31
00:02:35,600 --> 00:02:40,670
‫And so this would be the first part, and this would be the second part.

32
00:02:41,210 --> 00:02:48,770
‫Now, remember, in order to use the solver, all your inequality signs must point to the left.

33
00:02:49,280 --> 00:02:54,710
‫And so in the second part, you have to multiply this one by minus one.

34
00:02:55,310 --> 00:03:02,090
‫And this one by minus one and then your inequality sine changes its direction like this.

35
00:03:02,660 --> 00:03:04,280
‫But I can also rewrite them.

36
00:03:04,280 --> 00:03:12,530
‫Like this, I can have here an identity matrix, which is twelve by twelve times Delta U.

37
00:03:12,530 --> 00:03:17,000
‫Global, less than or equal to Delta U.

38
00:03:17,000 --> 00:03:21,290
‫Global Max and then minus an identity matrix.

39
00:03:21,950 --> 00:03:32,870
‫Twelve by twelve times Delta you global less than or equal to minus Delta you global mean or I can rewrite

40
00:03:32,870 --> 00:03:33,980
‫all that like this.

41
00:03:34,610 --> 00:03:42,830
‫I have a twelve by twelve identity matrix here and then minus and then the same identity matrix times

42
00:03:42,830 --> 00:03:46,280
‫delta you global less than or equal to.

43
00:03:46,910 --> 00:03:48,020
‫And then I have Delta U.

44
00:03:48,020 --> 00:03:50,960
‫Global Max here and minus Delta U.

45
00:03:50,960 --> 00:03:51,680
‫Global mean.

46
00:03:52,280 --> 00:03:54,410
‫And this i twelve by twelve.

47
00:03:55,040 --> 00:03:57,380
‫That's simply your identity matrix.

48
00:03:58,100 --> 00:04:01,970
‫It's simply your twelve by twelve identity matrix.

49
00:04:02,600 --> 00:04:11,240
‫When you multiply by Delta, you global, then it's like multiplying something by one in one dimension.

50
00:04:11,810 --> 00:04:18,890
‫And so that means that this matrix here, it has 24 rows and 12 columns.

51
00:04:19,580 --> 00:04:29,360
‫Then Delta You Global has twelve rows and one column, and then this vector here it has 24 rows and

52
00:04:29,360 --> 00:04:30,050
‫one column.

53
00:04:30,680 --> 00:04:32,390
‫So the dimensions work out.

54
00:04:32,870 --> 00:04:42,800
‫And then this matrix that your g matrix, this vector, that's your h vector, your inequality sine

55
00:04:42,800 --> 00:04:44,480
‫points in the right direction.

56
00:04:44,900 --> 00:04:47,450
‫And so that's what you would give to your solver.

57
00:04:47,570 --> 00:04:55,370
‫This matrix and h vector, together with your h double bar matrix and small f transpose to vector.

58
00:04:55,940 --> 00:04:59,720
‫And so you would simply write Delta your global.

59
00:05:00,490 --> 00:05:05,350
‫See, which means that you take constraints into account.

60
00:05:06,040 --> 00:05:13,030
‫It equals soul, underscore kewpie age, double bar small.

61
00:05:13,030 --> 00:05:23,530
‫I've transposed G h vector transposed and then you would right here solver equals CV x orbit.

62
00:05:24,190 --> 00:05:28,930
‫Or if you work in MATLAB, then you would write Delta you global.

63
00:05:29,590 --> 00:05:33,100
‫Considering the constraints equals what?

64
00:05:33,100 --> 00:05:33,550
‫Prog?

65
00:05:34,150 --> 00:05:43,120
‫And then again, the same each double bar matrix small if transposed the G matrix and the H vector transposed.

66
00:05:43,690 --> 00:05:50,620
‫And of course, in MATLAB, this one here and this one here, they can also be column vectors.

67
00:05:51,280 --> 00:05:55,390
‫And that's how you find a solution that minimizes your cost function.

68
00:05:55,750 --> 00:06:05,470
‫But make sure that you stay between your delta, your global men and delta, you global max, whatever

69
00:06:05,470 --> 00:06:06,700
‫those values are.

70
00:06:07,360 --> 00:06:10,750
‫However, that's not what we want in reality.

71
00:06:11,350 --> 00:06:14,440
‫In reality, we want to constrain our Omegas.

72
00:06:15,070 --> 00:06:16,840
‫So let's see how we are going to do it.

73
00:06:17,440 --> 00:06:24,190
‫Well, first of all, we have to define what our omega men and omega max values are.

74
00:06:24,700 --> 00:06:32,260
‫From what I've seen in other research papers for the UAV that we are considering, the reasonable values

75
00:06:32,260 --> 00:06:44,980
‫are omega men equals 110 times pi over three radians per second and omega max eight hundred and sixty

76
00:06:44,980 --> 00:06:48,640
‫pi over three radians per second.

77
00:06:49,240 --> 00:07:00,520
‫So approximately this one is 115 radians per second, and this one, it's 900 radians per second.

78
00:07:01,090 --> 00:07:01,840
‫That's great.

79
00:07:02,440 --> 00:07:10,270
‫So we have our omega minimum and omega maximum, but now we have to find a way to take that information

80
00:07:10,900 --> 00:07:13,240
‫and convert it into this form.

81
00:07:13,870 --> 00:07:19,060
‫Our familiar G times delta your global less than or equal to.

82
00:07:19,630 --> 00:07:21,010
‫And then the H vector.

83
00:07:21,610 --> 00:07:22,870
‫So how would we do it?

84
00:07:23,470 --> 00:07:29,080
‫Well, let me give you a thought exercise here before watching the next video.

85
00:07:29,740 --> 00:07:34,000
‫Give it a thought only maybe for five or ten minutes or so.

86
00:07:34,630 --> 00:07:43,120
‫And just think about all the possible ways you could go from your Omegas to your delta use and then

87
00:07:43,150 --> 00:07:46,810
‫how to eventually reach this form here.

88
00:07:47,410 --> 00:07:51,220
‫Just give it a thought, and let's continue in the next video.

89
00:07:51,430 --> 00:07:52,360
‫Thank you very much.

