﻿1
00:00:00,780 --> 00:00:01,650
‫Welcome back.

2
00:00:02,430 --> 00:00:10,680
‫So now that we have been able to load all these initial constants from our init function which happened

3
00:00:10,680 --> 00:00:14,890
‫here, then now we can continue with our main file.

4
00:00:15,720 --> 00:00:21,690
‫So remember all these initial constants, they are stored in this constant vector here in this main

5
00:00:21,690 --> 00:00:22,200
‫file.

6
00:00:22,890 --> 00:00:29,280
‫And then if I need some kind of constant, I will simply extracted from this vector.

7
00:00:29,310 --> 00:00:35,210
‫So, for example, I need the sample time interval and I will extracted from this vector like this.

8
00:00:36,090 --> 00:00:42,640
‫So you have six here and it means that it's the seventh element because you start counting from zero.

9
00:00:43,500 --> 00:00:47,700
‫Then I also extract this controlled states variable.

10
00:00:48,740 --> 00:00:58,160
‫Then the inner down length, so that just tells you that there are four inner loops per one outer loop,

11
00:00:59,030 --> 00:01:09,230
‫and this variable, if you remember it, would make the drones positive body frame X and Y axis longer.

12
00:01:10,100 --> 00:01:16,480
‫If you choose it to be one, if you choose it to be zero, then it's not going to happen.

13
00:01:17,150 --> 00:01:24,140
‫So that's why you have this if statement here, then this is for the animation purposes sub underscore

14
00:01:24,140 --> 00:01:24,590
‫loop.

15
00:01:25,340 --> 00:01:35,120
‫Then you also had to simulation versions and then the statement that will execute based on what you

16
00:01:35,120 --> 00:01:43,070
‫had chosen in the Init function, and then you have to generate a time vector.

17
00:01:44,030 --> 00:01:45,260
‫And I do it here.

18
00:01:46,250 --> 00:01:51,440
‫As mentioned before, the length of the entire simulation is one hundred seconds.

19
00:01:52,250 --> 00:01:58,580
‫So you go from zero to one hundred plus two times in a dynamic length.

20
00:01:59,000 --> 00:02:07,610
‫So essentially you have here one hundred plus zero point four and then the interval of this vector is

21
00:02:07,610 --> 00:02:09,410
‫zero point four seconds.

22
00:02:10,640 --> 00:02:19,910
‫So you go from zero, then you go to zero point four, then it's zero point eight up until you reach

23
00:02:19,910 --> 00:02:20,780
‫one hundred.

24
00:02:21,480 --> 00:02:30,260
‫But of course here you have to put one hundred point four because in Python, the last element that

25
00:02:30,260 --> 00:02:32,420
‫you put here is not counted.

26
00:02:33,820 --> 00:02:42,190
‫And then I have this tangles vector, and the difference with the other time vector is that this one

27
00:02:42,190 --> 00:02:52,990
‫goes like this zero, then zero point one, then zero point two up until one hundred seconds.

28
00:02:54,060 --> 00:02:56,970
‫And you can imagine where I need that because.

29
00:02:57,990 --> 00:03:07,890
‫My states get updated every year on one second because every time that I go through an inner loop,

30
00:03:08,850 --> 00:03:17,820
‫I will have new UTU, U3 and EUFOR values and they will influence my states every year upon one second.

31
00:03:18,690 --> 00:03:23,550
‫And then I have another time vector, but that is for the animation purposes.

32
00:03:24,670 --> 00:03:33,250
‫Essentially, if I run my simulation with a zero point one second interval, then the animation wouldn't

33
00:03:33,250 --> 00:03:34,620
‫be so smooth.

34
00:03:35,850 --> 00:03:39,450
‫And so in the animation, I'm going to cut the.

35
00:03:40,710 --> 00:03:43,620
‫Interval to zero point zero two seconds.

36
00:03:44,490 --> 00:03:54,300
‫So like this zero, then zero point zero two, then zero point zero four and etc. up until one hundred

37
00:03:54,300 --> 00:03:54,870
‫seconds.

38
00:03:55,530 --> 00:04:05,070
‫And so, for example, if my state let's take a random state, if that state, let's say at ten seconds,

39
00:04:05,970 --> 00:04:18,900
‫if that state is 50 meters and then at ten point one seconds the state is fifty one meters.

40
00:04:19,650 --> 00:04:28,670
‫And then in order to make the animation smoother, I'm going to animated like this at ten seconds.

41
00:04:28,950 --> 00:04:32,040
‫My state is 50 meters.

42
00:04:32,880 --> 00:04:43,680
‫Then at ten point zero two seconds, my state is fifty point two meters.

43
00:04:44,700 --> 00:04:51,800
‫Then at ten point all four seconds my state will be fifty point four meters.

44
00:04:52,680 --> 00:05:00,230
‫So you see, I cut this difference in the states from fifty to fifty one meters.

45
00:05:00,240 --> 00:05:08,670
‫So the difference is one meter during zero point one second, I cut it into smaller pieces in a linear

46
00:05:08,670 --> 00:05:09,120
‫way.

47
00:05:10,080 --> 00:05:18,000
‫And so if I animated like this 50, then fifty point two and then fifty point four with a zero point

48
00:05:18,000 --> 00:05:22,950
‫zero two second interval, then my animations will be smoother.

49
00:05:23,940 --> 00:05:27,690
‫But it has nothing to do with control engineering itself.

50
00:05:27,690 --> 00:05:30,030
‫It's just to make the movie smoother.

51
00:05:30,990 --> 00:05:40,350
‫And then we have reached our trajectory generator, so we have a function in our support file, which

52
00:05:40,350 --> 00:05:42,040
‫is trajectory generator.

53
00:05:42,930 --> 00:05:48,030
‫So now we are here and we're going to call this function trajectory generator function.

