‫Welcome back.
‫So now that we have been able to load all these initial constants from our init function which happened
‫here, then now we can continue with our main file.
‫So remember all these initial constants, they are stored in this constant vector here in this main
‫file.
‫And then if I need some kind of constant, I will simply extracted from this vector.
‫So, for example, I need the sample time interval and I will extracted from this vector like this.
‫So you have six here and it means that it's the seventh element because you start counting from zero.
‫Then I also extract this controlled states variable.
‫Then the inner down length, so that just tells you that there are four inner loops per one outer loop,
‫and this variable, if you remember it, would make the drones positive body frame X and Y axis longer.
‫If you choose it to be one, if you choose it to be zero, then it's not going to happen.
‫So that's why you have this if statement here, then this is for the animation purposes sub underscore
‫loop.
‫Then you also had to simulation versions and then the statement that will execute based on what you
‫had chosen in the Init function, and then you have to generate a time vector.
‫And I do it here.
‫As mentioned before, the length of the entire simulation is one hundred seconds.
‫So you go from zero to one hundred plus two times in a dynamic length.
‫So essentially you have here one hundred plus zero point four and then the interval of this vector is
‫zero point four seconds.
‫So you go from zero, then you go to zero point four, then it's zero point eight up until you reach
‫one hundred.
‫But of course here you have to put one hundred point four because in Python, the last element that
‫you put here is not counted.
‫And then I have this tangles vector, and the difference with the other time vector is that this one
‫goes like this zero, then zero point one, then zero point two up until one hundred seconds.
‫And you can imagine where I need that because.
‫My states get updated every year on one second because every time that I go through an inner loop,
‫I will have new UTU, U3 and EUFOR values and they will influence my states every year upon one second.
‫And then I have another time vector, but that is for the animation purposes.
‫Essentially, if I run my simulation with a zero point one second interval, then the animation wouldn't
‫be so smooth.
‫And so in the animation, I'm going to cut the.
‫Interval to zero point zero two seconds.
‫So like this zero, then zero point zero two, then zero point zero four and etc. up until one hundred
‫seconds.
‫And so, for example, if my state let's take a random state, if that state, let's say at ten seconds,
‫if that state is 50 meters and then at ten point one seconds the state is fifty one meters.
‫And then in order to make the animation smoother, I'm going to animated like this at ten seconds.
‫My state is 50 meters.
‫Then at ten point zero two seconds, my state is fifty point two meters.
‫Then at ten point all four seconds my state will be fifty point four meters.
‫So you see, I cut this difference in the states from fifty to fifty one meters.
‫So the difference is one meter during zero point one second, I cut it into smaller pieces in a linear
‫way.
‫And so if I animated like this 50, then fifty point two and then fifty point four with a zero point
‫zero two second interval, then my animations will be smoother.
‫But it has nothing to do with control engineering itself.
‫It's just to make the movie smoother.
‫And then we have reached our trajectory generator, so we have a function in our support file, which
‫is trajectory generator.
‫So now we are here and we're going to call this function trajectory generator function.