‫Welcome back.
‫So these are your complete states based equations here and now we are going to use wrongly Akutan method
‫to integrate the states and by integrating the states.
‫I mean, I want to know the evolution of states as a function of time.
‫For example, let's take the state party, which is the angular velocity about the body frame, X-axis.
‫You want to know what happens with P. radians per second as you move along the timeline?
‫With steps of peace, which in our case is zero point one seconds.
‫In order to start with the integration process, you first need to define the initial states for your
‫system.
‫That's the very beginning of your evolution at time, equals zero seconds, and then from this beginning,
‫you will have the evolution of your state.
‫So at each sample time, you want to know how many radians per second you have for your state.
‫But of course, the initial state doesn't have to happen, starting from time equals zero seconds.
‫You can define your initial states, for example, at time equals zero point two seconds right over
‫here, so with a delay and then your evolution will start from here.
‫But what matters is that at the very beginning, you have concrete values for all your states.
‫So at the very beginning, when you start your simulation or your maneuver, you have to have some kind
‫of value for all these states here, sticks in the body frame and then six in the inertial frame.
‫And so your initial states would be your ex up, Kay, and then you use either Runga, Kouta or Oilor
‫method to get your ex up K plus one, then in the next loop, this ex up K plus one will become your
‫ex up K and then you compute your new ex of K plus one.
‫And you do that until you finish your simulation or your maneuver.
‫And, of course, integrating accurately so that your predicted state evolution.
‫Would match the true state evolution as closely as possible.
‫Or I would say as closely as necessary, because you always can go more precise with your models, however,
‫at some point you have to ask yourself, is making the model more complicated?
‫Worth it or not, if your model already gives you satisfactory results with small errors that you can
‫tolerate, then there is no point of making your models more complicated in order to gain a little bit
‫of more precision, because that would just make your problem harder and it will probably increase your
‫computational cost.
‫Meaning that your computer will have to make more computations, which means more time, which in many
‫cases is a big factor.
‫But still, you want your predicted evolution from your oilor or wrong Akutan method to match the true
‫state evolution very closely.
‫Because you're going to use your plant to tune your controllers, right?
‫Remember, controllers, they need to be tuned, for example, in pide, you had your Cape Cod and Kaixi
‫constants, and then in NPC you had your weights and so you had to tune your controllers.
‫And so you would tune your controllers based on your plan model.
‫And then you take your tuned controller and you apply it to the real system.
‫And the real system has sensors that measure it states.
‫And if your plan model predicts the behavior of the real drone, well, meaning if the sensors in the
‫drone receive values for states.
‫That are very close to what you get when you try to predict them using your state's base equations and
‫wrong Akutan integration.
‫Then your controller will control the real drone.
‫Well.
‫But of course, if your plan model is too imprecise, so then what will happen is that you're going
‫to tune your controller based on that imprecise model.
‫So when you apply that controller to the real drone and then if what happens in real life differs from
‫what happens in the plan model by a lot.
‫Then the controller will be badly tuned for the real drone.
‫Because it was tuned for the planned model, but the plan was very different from the real drone.
‫And of course, like we talked in the previous course when working with real drones, you also have
‫to take into account the signal noise that is produced by sensors and the uncertainty of the mall itself.
‫And one method to smooth these noise and uncertainties is to put them through a common filter.
‫So that's additional information for you, things to watch out for when you start working with a real
‫drone.
‫Oh, and you will probably need to program the real drone in C++.
‫Usually hardware like drones, robots, etc, are programmed in C++ because it is faster than Python.
‫Python is more user friendly and good for simulations.
‫But either way, the fundamental concepts and modeling that I am teaching you here is the same.
‫The laws of physics don't change based on what programming language you are using.
‫And one more remark that I want to make, when you use your drone and you use it sensors to measure
‫the status of the drone in real time, then if you use an NPC controller, then remember and NPC controller
‫was a model based controller, meaning that your NPC controller would take the mathematical model of
‫your drone and it would use it to compute the future status of your drone.
‫If you remember then NPC had Horizon period and then when Horizon period equals, for example, 10,
‫that means that starting from now NPC would use the mathematical model of the drone to try to predict
‫state's 10 sample times ahead.
‫But it's not going to use sensors for that because sensors just tell you what is happening now.
‫So NBC will need to have a good mathematical model in order to predict how your system will behave in
‫the next ten sample times from now.
‫And so if your mathematical model is not good enough, then that means that your NPC will make poor
‫predictions.
‫And then since NPC uses those predictions to give you the best control inputs, then if the models are
‫not good enough, then that means that the NPC will give you control inputs that are not very good for
‫the real system.