﻿1
00:00:00,730 --> 00:00:01,570
‫Welcome back.

2
00:00:02,230 --> 00:00:11,620
‫This is an extra section in which I also want to go over the topic of NPC constraints in order to make

3
00:00:11,620 --> 00:00:13,360
‫this course more complete.

4
00:00:13,990 --> 00:00:22,240
‫The topic of NPC constraints was extensively covered in the course applied control systems to autonomous

5
00:00:22,240 --> 00:00:24,280
‫cars 360 tracking.

6
00:00:24,880 --> 00:00:32,500
‫I will give you a brief overview on what we did in that course, but it is recommended that you covered

7
00:00:32,500 --> 00:00:35,620
‫the NPC constraints in that car course as well.

8
00:00:36,220 --> 00:00:43,660
‫In fact, this is the only section that suggests you two cover the 360 tracking course first.

9
00:00:44,230 --> 00:00:48,970
‫In my explanation, I will be constantly referring back to the car, of course.

10
00:00:49,660 --> 00:00:57,100
‫Also in this section, additional Python libraries are needed, the installation instructions and the

11
00:00:57,100 --> 00:01:02,620
‫Python files are in the second half of this section where I also explained the code to you.

12
00:01:03,220 --> 00:01:07,570
‫And so let's get started in the second autonomous car course.

13
00:01:08,200 --> 00:01:13,280
‫We had a system with six states and two control inputs.

14
00:01:13,960 --> 00:01:17,770
‫Our state vector, there was this one here.

15
00:01:18,400 --> 00:01:19,630
‫Our control input.

16
00:01:19,630 --> 00:01:22,360
‫There was this one here.

17
00:01:23,020 --> 00:01:29,490
‫The state small x dot was the car's longitudinal velocity small y dot.

18
00:01:30,190 --> 00:01:32,290
‫That was its lateral velocity.

19
00:01:32,950 --> 00:01:35,950
‫CI was its Yongle side.

20
00:01:35,950 --> 00:01:38,260
‫That was its angular velocity.

21
00:01:38,860 --> 00:01:45,100
‫And then X and Y, they were the course inertial x and Y positions, respectively.

22
00:01:45,760 --> 00:01:54,760
‫The input delta was the car's steering wheel angle and then a was the course applied longitudinal acceleration

23
00:01:55,420 --> 00:01:58,870
‫that was responsible for controlling the car longitudinally.

24
00:01:59,470 --> 00:02:04,510
‫It would either speed the car up or slow it down, just like with the drone.

25
00:02:05,140 --> 00:02:11,830
‫We started modelling the car from the first principles of physics using the equations of motion.

26
00:02:12,430 --> 00:02:20,380
‫We then reformulated these equations of motion and put them in the states based equations, just like

27
00:02:20,380 --> 00:02:22,300
‫we did here with our drone.

28
00:02:22,960 --> 00:02:32,410
‫These continuous stay space equations were then used in the planned box together with Euler integration

29
00:02:33,070 --> 00:02:34,960
‫in order to calculate new states.

30
00:02:35,620 --> 00:02:38,020
‫We did not use wrong acuta there.

31
00:02:38,590 --> 00:02:41,590
‫We used the easier method to obtain new states.

32
00:02:42,250 --> 00:02:50,350
‫We used the Euler method, and we also computed new states many times per one tsp interval.

33
00:02:50,590 --> 00:02:54,190
‫In order to increase precision of new state calculations.

34
00:02:54,820 --> 00:03:02,650
‫And then, just like in this course, we took those continuous states space equations and we reformulated

35
00:03:02,650 --> 00:03:02,980
‫them.

36
00:03:03,280 --> 00:03:11,890
‫We put them in the LP V format so that we could use our linear MVC to control our car.

37
00:03:12,520 --> 00:03:15,220
‫This was our LP V model.

38
00:03:15,790 --> 00:03:20,500
‫You had your continues a, b and C matrices there.

39
00:03:21,160 --> 00:03:27,580
‫These elements A1 one and B one one and all the other ones.

40
00:03:28,210 --> 00:03:33,640
‫These were matrix elements that contained different vehicle parameters.

41
00:03:34,300 --> 00:03:43,870
‫And then, of course, we took our continuous LP v ABC matrices with discrete ties them and then we

42
00:03:43,870 --> 00:03:47,260
‫augmented them just like we did in this course.

43
00:03:47,920 --> 00:03:53,830
‫And just like we had Delta Q2, Delta Q3 and Delta U.

44
00:03:53,830 --> 00:03:56,800
‫Four control inputs in the eyes of NPC.

45
00:03:56,800 --> 00:04:06,910
‫In this course, the changes or the increments of Q2, U3 and Q4 in that car course in the eyes of NPC.

46
00:04:07,540 --> 00:04:12,040
‫The control inputs where Delta Delta and Delta A..

47
00:04:12,640 --> 00:04:15,880
‫In other words, we augmented the system there.

48
00:04:16,480 --> 00:04:25,780
‫And then just like here what we did, we formulated our cost function using the matrices c double bar,

49
00:04:26,410 --> 00:04:32,380
‫a double circle and Flex H double bar and F double bar transposed.

50
00:04:32,980 --> 00:04:42,220
‫Remember that in that concourse, the C double bar and the eight double circum flex matrices were derived

51
00:04:42,220 --> 00:04:45,760
‫using the non simplified LP v approach.

52
00:04:46,330 --> 00:04:49,450
‫Ultimately, we computed our solution with this formula.

53
00:04:50,200 --> 00:04:57,010
‫Delta U Global equals minus h double bar inverse times, f double bar.

54
00:04:57,640 --> 00:05:00,010
‫And then this vector here where?

55
00:05:00,270 --> 00:05:08,760
‫Still, that key that was your present argument, that state vector and then this are global, that

56
00:05:08,760 --> 00:05:14,020
‫was your reference value vector and its length depended on the horizon period.

57
00:05:14,640 --> 00:05:18,030
‫Remember that the vector delta you.

58
00:05:18,630 --> 00:05:22,890
‫It contains the Delta Delta and Delta A. and the Vector you.

59
00:05:23,520 --> 00:05:25,770
‫It contains Delta and A..

60
00:05:26,370 --> 00:05:31,560
‫And so once you had your delta, you global, you could calculate your new you.

61
00:05:32,130 --> 00:05:38,550
‫So you at K equals you at K minus one plus delta, you at K.

62
00:05:39,180 --> 00:05:47,940
‫More specifically, you would use this formula here with this role vector here in which each element

63
00:05:48,480 --> 00:05:50,040
‫is a two by two matrix.

64
00:05:50,640 --> 00:05:56,040
‫And then the first one is the identity matrix, and the other ones are zero matrices.

65
00:05:56,670 --> 00:05:59,070
‫And this is your preview state vector here.

66
00:05:59,310 --> 00:06:00,450
‫You add K minus one.

67
00:06:01,110 --> 00:06:09,750
‫So with this term here, you would only extract the first delta you and you would discard the rest.

68
00:06:10,260 --> 00:06:17,070
‫And then you would take your new you and you would apply it to the plant.

69
00:06:17,790 --> 00:06:23,280
‫The plant will then give you new states and you start with a new loop.

70
00:06:24,000 --> 00:06:28,530
‫This process will then continue until the end of the simulation.

71
00:06:29,160 --> 00:06:37,290
‫So all that that we have talked about so far, it's called unconstrained NPC.

72
00:06:37,920 --> 00:06:41,460
‫Let's now see how we apply constraints there.

73
00:06:41,730 --> 00:06:42,630
‫Thank you very much.

