‫Welcome back.
‫This is an extra section in which I also want to go over the topic of NPC constraints in order to make
‫this course more complete.
‫The topic of NPC constraints was extensively covered in the course applied control systems to autonomous
‫cars 360 tracking.
‫I will give you a brief overview on what we did in that course, but it is recommended that you covered
‫the NPC constraints in that car course as well.
‫In fact, this is the only section that suggests you two cover the 360 tracking course first.
‫In my explanation, I will be constantly referring back to the car, of course.
‫Also in this section, additional Python libraries are needed, the installation instructions and the
‫Python files are in the second half of this section where I also explained the code to you.
‫And so let's get started in the second autonomous car course.
‫We had a system with six states and two control inputs.
‫Our state vector, there was this one here.
‫Our control input.
‫There was this one here.
‫The state small x dot was the car's longitudinal velocity small y dot.
‫That was its lateral velocity.
‫CI was its Yongle side.
‫That was its angular velocity.
‫And then X and Y, they were the course inertial x and Y positions, respectively.
‫The input delta was the car's steering wheel angle and then a was the course applied longitudinal acceleration
‫that was responsible for controlling the car longitudinally.
‫It would either speed the car up or slow it down, just like with the drone.
‫We started modelling the car from the first principles of physics using the equations of motion.
‫We then reformulated these equations of motion and put them in the states based equations, just like
‫we did here with our drone.
‫These continuous stay space equations were then used in the planned box together with Euler integration
‫in order to calculate new states.
‫We did not use wrong acuta there.
‫We used the easier method to obtain new states.
‫We used the Euler method, and we also computed new states many times per one tsp interval.
‫In order to increase precision of new state calculations.
‫And then, just like in this course, we took those continuous states space equations and we reformulated
‫them.
‫We put them in the LP V format so that we could use our linear MVC to control our car.
‫This was our LP V model.
‫You had your continues a, b and C matrices there.
‫These elements A1 one and B one one and all the other ones.
‫These were matrix elements that contained different vehicle parameters.
‫And then, of course, we took our continuous LP v ABC matrices with discrete ties them and then we
‫augmented them just like we did in this course.
‫And just like we had Delta Q2, Delta Q3 and Delta U.
‫Four control inputs in the eyes of NPC.
‫In this course, the changes or the increments of Q2, U3 and Q4 in that car course in the eyes of NPC.
‫The control inputs where Delta Delta and Delta A..
‫In other words, we augmented the system there.
‫And then just like here what we did, we formulated our cost function using the matrices c double bar,
‫a double circle and Flex H double bar and F double bar transposed.
‫Remember that in that concourse, the C double bar and the eight double circum flex matrices were derived
‫using the non simplified LP v approach.
‫Ultimately, we computed our solution with this formula.
‫Delta U Global equals minus h double bar inverse times, f double bar.
‫And then this vector here where?
‫Still, that key that was your present argument, that state vector and then this are global, that
‫was your reference value vector and its length depended on the horizon period.
‫Remember that the vector delta you.
‫It contains the Delta Delta and Delta A. and the Vector you.
‫It contains Delta and A..
‫And so once you had your delta, you global, you could calculate your new you.
‫So you at K equals you at K minus one plus delta, you at K.
‫More specifically, you would use this formula here with this role vector here in which each element
‫is a two by two matrix.
‫And then the first one is the identity matrix, and the other ones are zero matrices.
‫And this is your preview state vector here.
‫You add K minus one.
‫So with this term here, you would only extract the first delta you and you would discard the rest.
‫And then you would take your new you and you would apply it to the plant.
‫The plant will then give you new states and you start with a new loop.
‫This process will then continue until the end of the simulation.
‫So all that that we have talked about so far, it's called unconstrained NPC.
‫Let's now see how we apply constraints there.
‫Thank you very much.