﻿1
00:00:00,640 --> 00:00:01,420
‫Welcome back.

2
00:00:02,290 --> 00:00:10,540
‫So these are your complete states based equations here and now we are going to use wrongly Akutan method

3
00:00:10,540 --> 00:00:15,340
‫to integrate the states and by integrating the states.

4
00:00:15,340 --> 00:00:22,180
‫I mean, I want to know the evolution of states as a function of time.

5
00:00:23,350 --> 00:00:30,910
‫For example, let's take the state party, which is the angular velocity about the body frame, X-axis.

6
00:00:32,270 --> 00:00:42,200
‫You want to know what happens with P. radians per second as you move along the timeline?

7
00:00:43,560 --> 00:00:49,050
‫With steps of peace, which in our case is zero point one seconds.

8
00:00:50,340 --> 00:00:56,310
‫In order to start with the integration process, you first need to define the initial states for your

9
00:00:56,310 --> 00:00:56,910
‫system.

10
00:00:58,140 --> 00:01:06,720
‫That's the very beginning of your evolution at time, equals zero seconds, and then from this beginning,

11
00:01:07,200 --> 00:01:09,960
‫you will have the evolution of your state.

12
00:01:10,990 --> 00:01:18,610
‫So at each sample time, you want to know how many radians per second you have for your state.

13
00:01:19,870 --> 00:01:27,460
‫But of course, the initial state doesn't have to happen, starting from time equals zero seconds.

14
00:01:28,790 --> 00:01:35,720
‫You can define your initial states, for example, at time equals zero point two seconds right over

15
00:01:35,720 --> 00:01:40,910
‫here, so with a delay and then your evolution will start from here.

16
00:01:41,930 --> 00:01:49,160
‫But what matters is that at the very beginning, you have concrete values for all your states.

17
00:01:50,460 --> 00:01:56,700
‫So at the very beginning, when you start your simulation or your maneuver, you have to have some kind

18
00:01:56,700 --> 00:02:05,460
‫of value for all these states here, sticks in the body frame and then six in the inertial frame.

19
00:02:06,510 --> 00:02:15,240
‫And so your initial states would be your ex up, Kay, and then you use either Runga, Kouta or Oilor

20
00:02:15,240 --> 00:02:26,730
‫method to get your ex up K plus one, then in the next loop, this ex up K plus one will become your

21
00:02:26,820 --> 00:02:33,840
‫ex up K and then you compute your new ex of K plus one.

22
00:02:34,930 --> 00:02:38,530
‫And you do that until you finish your simulation or your maneuver.

23
00:02:39,560 --> 00:02:47,780
‫And, of course, integrating accurately so that your predicted state evolution.

24
00:02:49,350 --> 00:02:55,440
‫Would match the true state evolution as closely as possible.

25
00:02:57,030 --> 00:03:06,570
‫Or I would say as closely as necessary, because you always can go more precise with your models, however,

26
00:03:06,570 --> 00:03:13,200
‫at some point you have to ask yourself, is making the model more complicated?

27
00:03:13,380 --> 00:03:21,720
‫Worth it or not, if your model already gives you satisfactory results with small errors that you can

28
00:03:21,720 --> 00:03:28,680
‫tolerate, then there is no point of making your models more complicated in order to gain a little bit

29
00:03:28,680 --> 00:03:35,220
‫of more precision, because that would just make your problem harder and it will probably increase your

30
00:03:35,220 --> 00:03:36,720
‫computational cost.

31
00:03:37,750 --> 00:03:44,110
‫Meaning that your computer will have to make more computations, which means more time, which in many

32
00:03:44,110 --> 00:03:46,330
‫cases is a big factor.

33
00:03:47,460 --> 00:03:55,470
‫But still, you want your predicted evolution from your oilor or wrong Akutan method to match the true

34
00:03:55,470 --> 00:03:58,830
‫state evolution very closely.

35
00:04:00,120 --> 00:04:05,570
‫Because you're going to use your plant to tune your controllers, right?

36
00:04:06,720 --> 00:04:15,990
‫Remember, controllers, they need to be tuned, for example, in pide, you had your Cape Cod and Kaixi

37
00:04:16,380 --> 00:04:23,340
‫constants, and then in NPC you had your weights and so you had to tune your controllers.

38
00:04:24,240 --> 00:04:29,040
‫And so you would tune your controllers based on your plan model.

39
00:04:30,090 --> 00:04:35,850
‫And then you take your tuned controller and you apply it to the real system.

40
00:04:36,660 --> 00:04:41,490
‫And the real system has sensors that measure it states.

41
00:04:42,540 --> 00:04:50,280
‫And if your plan model predicts the behavior of the real drone, well, meaning if the sensors in the

42
00:04:50,280 --> 00:04:53,670
‫drone receive values for states.

43
00:04:54,810 --> 00:05:03,000
‫That are very close to what you get when you try to predict them using your state's base equations and

44
00:05:03,000 --> 00:05:04,440
‫wrong Akutan integration.

45
00:05:05,670 --> 00:05:08,520
‫Then your controller will control the real drone.

46
00:05:08,550 --> 00:05:09,000
‫Well.

47
00:05:10,200 --> 00:05:17,670
‫But of course, if your plan model is too imprecise, so then what will happen is that you're going

48
00:05:17,690 --> 00:05:22,400
‫to tune your controller based on that imprecise model.

49
00:05:22,830 --> 00:05:31,410
‫So when you apply that controller to the real drone and then if what happens in real life differs from

50
00:05:31,590 --> 00:05:34,590
‫what happens in the plan model by a lot.

51
00:05:35,940 --> 00:05:40,230
‫Then the controller will be badly tuned for the real drone.

52
00:05:41,410 --> 00:05:48,940
‫Because it was tuned for the planned model, but the plan was very different from the real drone.

53
00:05:50,270 --> 00:05:56,900
‫And of course, like we talked in the previous course when working with real drones, you also have

54
00:05:56,900 --> 00:06:06,040
‫to take into account the signal noise that is produced by sensors and the uncertainty of the mall itself.

55
00:06:06,740 --> 00:06:13,550
‫And one method to smooth these noise and uncertainties is to put them through a common filter.

56
00:06:14,770 --> 00:06:20,680
‫So that's additional information for you, things to watch out for when you start working with a real

57
00:06:20,680 --> 00:06:21,070
‫drone.

58
00:06:21,790 --> 00:06:27,190
‫Oh, and you will probably need to program the real drone in C++.

59
00:06:28,000 --> 00:06:36,520
‫Usually hardware like drones, robots, etc, are programmed in C++ because it is faster than Python.

60
00:06:36,880 --> 00:06:40,510
‫Python is more user friendly and good for simulations.

61
00:06:41,570 --> 00:06:47,810
‫But either way, the fundamental concepts and modeling that I am teaching you here is the same.

62
00:06:48,650 --> 00:06:54,080
‫The laws of physics don't change based on what programming language you are using.

63
00:06:55,580 --> 00:07:06,410
‫And one more remark that I want to make, when you use your drone and you use it sensors to measure

64
00:07:06,440 --> 00:07:18,110
‫the status of the drone in real time, then if you use an NPC controller, then remember and NPC controller

65
00:07:18,140 --> 00:07:28,880
‫was a model based controller, meaning that your NPC controller would take the mathematical model of

66
00:07:28,880 --> 00:07:36,910
‫your drone and it would use it to compute the future status of your drone.

67
00:07:38,180 --> 00:07:46,640
‫If you remember then NPC had Horizon period and then when Horizon period equals, for example, 10,

68
00:07:46,910 --> 00:07:57,350
‫that means that starting from now NPC would use the mathematical model of the drone to try to predict

69
00:07:58,070 --> 00:08:02,570
‫state's 10 sample times ahead.

70
00:08:03,490 --> 00:08:08,730
‫But it's not going to use sensors for that because sensors just tell you what is happening now.

71
00:08:09,070 --> 00:08:17,860
‫So NBC will need to have a good mathematical model in order to predict how your system will behave in

72
00:08:17,860 --> 00:08:21,580
‫the next ten sample times from now.

73
00:08:22,540 --> 00:08:28,630
‫And so if your mathematical model is not good enough, then that means that your NPC will make poor

74
00:08:28,630 --> 00:08:29,430
‫predictions.

75
00:08:29,980 --> 00:08:39,100
‫And then since NPC uses those predictions to give you the best control inputs, then if the models are

76
00:08:39,100 --> 00:08:47,050
‫not good enough, then that means that the NPC will give you control inputs that are not very good for

77
00:08:47,050 --> 00:08:47,860
‫the real system.

