‫Welcome back.
‫So I hope that you have tried the exercise and now I will show you how it is done.
‫So to derive a mathematical model for a system from the first principles of physics, you should start
‫from the Newton's second law, which is the net force vector equals the time derivative of the translational
‫momentum and times the velocity vector.
‫And so from calculus, you know that you first take the derivative of the mass with respect to time
‫and you leave the velocity vector alone and then you leave the mass alone and you take the time derivative
‫of the velocity vector like this, since the change of mass with respect to time equals the zero kilograms
‫per second, which means that the mass is constant.
‫It doesn't change with time.
‫It means that this term here becomes a zero and that means that F net equals mass times acceleration,
‫which is DVD t.
‫Next, we have to find the second time derivative of our position vector Gummo in the inertial frame,
‫which was X, Y and then Z transposed because it was a column vector.
‫And the reason for why we need to find the second time derivative of this position vector is because
‫Gunma doubled that in the inertia frame as a vector.
‫It is our divi deti.
‫All right, so let's do that.
‫We can rewrite Gummo in the inertia frame like this X then the unit vector ie plus why the unit vector
‫J and plus Z, the unit vector K and remember the unit vectors I, J and K are now along the inertial
‫frame axis, not the body frame axis, but the inertia frame axis.
‫And so gamma dot in the inertia frame equals x dot and then you have this unit vector and then you have
‫X and then the derivative of the unit vector, the same for Y.
‫So first of all you have Y daytime's J and then plus Y times Jadot and then plus the Z dot times the
‫unit vector K and then plus the Z times the time derivative of the unit vector K.
‫So like this since now we are in the initial frame, then that means that I dot j dot and k dot they
‫are all zero.
‫All right.
‫Zero units per second.
‫That means that this term here becomes zero, this term here becomes zero and also this term here becomes
‫zero.
‫And that means that your final gamma dot vector looks like this.
‫And now we'll take another time derivative of this vector here.
‫So gamma double dot in the initial frame equals these two terms.
‫First of all, you have X double dot times I plus X dot times.
‫I dot the same thing for the Y dimension and for the Z dimension.
‫Again, this term here becomes zero, then this term here becomes zero and this term here becomes zero
‫y because we are in the inertia frame.
‫So that means that the axis of an inertial frame, they are fixed.
‫All right.
‫They don't rotate, they don't move anywhere.
‫They are fixed.
‫And if they are fixed, then that means that these unit vectors here, they cannot move.
‫So their time derivatives must be zero.
‫And so you can rewrite this vector like this gunman double dot in the initial frame equals.
‫And then you have here X double dot, y double dot and then Z double dot like this.
‫And then of course E.
‫Your D.V. deti, all right, and that also means that in the inertia frame, the equations of motion
‫look like this.
‫This is the net force vector and it equals mass times, X, Y and Z double dot.
‫And now we need to express our F net vector in terms of the individual relevant forces that the drone
‫is exposed to.
‫If you remember, then we have three force moment vectors for that.
‫We had Londa in the body frame for the gravity, then also lambda in the body frame for the gyroscopic
‫effect and lambda in the body frame for the inputs, control inputs.
‫You want you to use three and you four.
‫So that was the gravity here in the body frame and you had this inverse rotation matrix here that was
‫Lunda in the body frame for the gyroscopic effect and that was Lunda in the body frame for the control
‫inputs.
‫In our case, though, we only need the first three elements from these vectors so we can forget about
‫this one and then we can forget about this one and then also this one, because we only need the force
‫elements and we can neglect the moment elements.
‫And in addition, our force vectors have to be in the initial frame, not in the body frame.
‫Here they are in the body frame, but we need them in the initial frame.
‫So this one here, that was our force of gravity, but in the body frame then we had no gyroscopic force.
‫We only had gyroscopic moments.
‫That gyroscopic effect had to do with moments, not with force.
‫So that's even irrelevant here.
‫So we don't have to worry about this entire vector at all, not even in the initial frame.
‫But you could say that this is your gyroscopic force in the body frame, which is a zero zero zero.
‫So it's a zero vector.
‫And then this one here.
‫Well, that was your input vector in the body frame, this one here.
‫But in the initial frame, those vectors, those force vectors here, they would look like this.
‫The force of gravity in the initial frame looks like this.
‫The gyroscopic force in the initial frame is like this, so zero zero zero, meaning that it doesn't
‫exist.
‫And now remember that this force vector here is in the body frame.
‫This is zero zero and you one that's in the body frame.
‫So if you want to put it in the initial frame, well, then.
‫You have to take your rotation matrix and multiplied by this vector here, which is your force vector
‫in the body frame.
‫So if you multiply the rotation matrix by this body frame, input force vector, then you will get the
‫input force vector in the inertia frame.
‫So this element here, you one that was in the body frame Z direction.
‫So I guess you need the rotation matrix after all.
‫And so this is your rotation matrix here.
‫And if you multiply this rotation matrix by this vector zero zero, you one.
‫Then you can extract this element here for the X dimension, this element here for the Y dimension and
‫this element here for the Z dimension, it makes sense, right?
‫So if you take this vector here, F input and in the inertial frame and then you say that this is your
‫rotation matrix times this vector zero zero, you one, then remember this rotation matrix is a three
‫by three matrix with those huge elements there.
‫And since the first two elements here are zeros, that means that when you multiply this rotation matrix
‫by this vector, then.
‫This one gets multiplied by this one for the X dimension.
‫Then this one gets multiplied by this one for the Y dimension and this one gets multiplied by this one
‫for the Z dimension, and that's why you extract these elements here.
‫So in the end, the input force vector in the initial frame looks like this.
‫You see, these are the elements from this rotation matrix and then you multiply them by you one.
‫And now let's put it all together.
‫Mass Times, Gunma, double dot in the inertia frame equals and then your net force vector in the inertia
‫frame and then you rewrite this net force vector in terms of the three individual force vectors like
‫this.
‫Or you can rewrite it like this where you show what those individual force vectors are and then instead
‫of Gummo double that, you rewrite it like this equals and if you rewrite your input vector in the initial
‫frame, then the entire thing looks like this.
‫And now what you can do, you can simply cancel out the masses.
‫So if I cancel out the mass here, then that means that I will have a mass here you want divided by
‫mass.
‫And also here you one divided by mass and also here you one divided by mass.
‫And I will have it here in the denominator as well.
‫But then I can cancel them out.
‫And that's your final answer.
‫And there you go.
‫That's how you get the equations of motion for position control in the inertial frame.
‫Not that they are not states based equations.
‫You simply relate the accelerations x double date.
‫Why double date and Z double that.
‫And now these accelerations are in the inertial X, Y and Z direction.
‫You simply relate them with Phi Theta and Passi angles and you want control input.
‫And in this section you don't need to put them in the state's space form.
‫We're going to use these equations directly for position control and we will start with that in the
‫next video.
‫Thank you.