‫Welcome back.
‫And so let's go back to our cost function.
‫This was the initial version for the vehicle.
‫This was the cost function that we had in the previous course.
‫The initial version and of course, now in our case, instead of these deltas here, we're going to
‫have the you control input vectors like this, right?
‫And obviously because of that and because of the different dimensions of the error vectors, we will
‫have different dimensions in the weight matrix here.
‫So the S Q and our weight matrices, these three, you will have different dimensions.
‫However, since we started treating the input increments as our control inputs, we replace the use
‫of Cape Plus I vectors here with.
‫Delta use up, Kate, plus I vectors like this next.
‫Just like in the previous course, we start manipulating the cost function.
‫We can replace the error variables like this.
‫So this is our error at K Plus End, which is this vector here.
‫And that would be the reference value vector at K plus and minus C till they're times X tilde vector
‫at K plus end.
‫And so if we also take this vector here, then we can rewrite it like this.
‫The reference value vector at K plus ie minus C till that times x till the vector at K plus i.
‫The reference vector simply contain your reference values.
‫So the reference factor at Cape Plus RN equals Phi are at Cape Plus N Seta are at Cape Plus NW and PSI
‫are at Cape Plus and.
‫And then right, Kate, plus eye equals fire at Capas Eye Theatre are at Kate plus I as well and I are
‫at Kate.
‫Plus I now remember since your input increments the deltas, since they are your control inputs, now
‫you need to have your augmented matrices and vectors, so you need to have your seat still there and
‫then your ex there.
‫Not C.
‫And X.
‫So now this would be wrong, because now you have delta use in your cost function.
‫And so now you take the cost function that you have here and then you will very simply replace the error
‫vectors with these expressions here.
‫And if you do that, then this is how your cost function will look like this one here in the parentheses.
‫That's your e sub K plus n, and then this one here is the same thing, but transposed.
‫And then this expression here, that's this vector.
‫And then here, it's just the same thing, but transposed as well.
‫And here you have your control input increments.
‫Here you have the column vector.
‫And then here you have the roll vector because you have this transposed here and then you have to open
‫up the parentheses in the exact same way, like we did it in the previous course.
‫In fact, now I would like to challenge you.
‫I would like to give you a big exercise, and if you do then exercise, then you will for sure, solidify
‫your knowledge about the controller.
‫In the previous course, I showed you how you can go from this original form, this original cost function
‫that you had until this final form of the cost function.
‫In this final cost function form, you had huge matrices like H Double Bar and then F Double Bar transposed.
‫That was the final cost function form here.
‫And you can see that you have a constant value here, which is your present state.
‫It's not a variable because you know this value already, it's a specific number, your present state
‫now and then also your reference vectors.
‫They are also known, so they are constant values.
‫They are not variables.
‫So in this final cost function form, the only independent variables that you had was the delta deltas.
‫And then you took the gradient of it.
‫And then once you had your gradient, you were able to use this linear algebra technique where you just
‫take the inverse of your h double bar matrix and then you compute your control inputs sequence like
‫this.
‫So then was the stuff from the previous course.
‫So my exercise for you is this I've already done the first step.
‫I have replaced the deltas with the two vectors, and then I've also made them increment you vectors.
‫So I've put deltas here and I've also rewritten the cost function like this where I have replaced the
‫error variables.
‫So from this point on trying to achieve this form only for the UAV.
‫So instead of Delta Delta equals something you would have Delta, you equals something.
‫But don't just write this expression, go through.
‫The entire derivation that we had in the previous course used the material from the previous course
‫as much as needed and go through the entire derivation process until you reach this form only for the
‫US case now.
‫So you would start by opening up the parentheses and you do it exactly like you did it in the previous
‫course.
‫And again, you don't have to have it all memorized if you don't remember it.
‫Then just look it up from the previous course and go through the exact same steps like you went through
‫in the previous course and then try to get this final form for the UAV.
‫And then in the next two videos, I will show you how it should be done.
‫It really will be like a recap of the previous course when it comes to the embassy controller derivation.
‫So thank you very much and see you in the next video.