1
00:00:03,680 --> 00:00:08,180
Now that we've gone over how the common thread update updates, works and the equations behind it,

2
00:00:08,690 --> 00:00:14,570
we're going to look at implementing it in the third, try to come and filter example, the update measurement

3
00:00:14,570 --> 00:00:18,980
model that we're going to use in our tutee track a filter is going to be a very simple model.

4
00:00:19,430 --> 00:00:24,740
All it's going to be is just a measurement of the position in the X and Y axes with a bit of noise added

5
00:00:24,740 --> 00:00:25,100
to it.

6
00:00:25,800 --> 00:00:29,570
So we can represent this using the common field of measurement model equation.

7
00:00:30,230 --> 00:00:35,790
So the measurement is just going to be a linear combination of the state with some additive noise.

8
00:00:35,990 --> 00:00:41,180
So this matrix, the measurement model is just going to be a simple identity matrix with a one and one

9
00:00:41,180 --> 00:00:43,890
in the X and Y columns.

10
00:00:44,660 --> 00:00:49,730
So this model here just gives us the measurement model, which is just the X and Y position measurements,

11
00:00:50,240 --> 00:00:52,600
and then we're going to have a bit of additive noise to it.

12
00:00:53,030 --> 00:00:59,060
And this additive noise this week is just going to be of a normal distribution with a zero mean and

13
00:00:59,060 --> 00:00:59,720
covariance.

14
00:00:59,720 --> 00:01:06,830
Uh, where are is just a diagonal matrix so that the X and Y noises aren't correlated and the X and

15
00:01:06,830 --> 00:01:11,930
Y noise is just going to have a standard deviation of the Sigma X squared and Sigma Y squared.

16
00:01:12,410 --> 00:01:17,290
And we're actually just going to assume that these two components here are just going to be the same.

17
00:01:17,300 --> 00:01:18,740
So it's just going to be a sigma measurement.

18
00:01:19,190 --> 00:01:24,020
So we're going to have equal noise on the X and Y axes, so we're not going to be biased towards one

19
00:01:24,020 --> 00:01:24,710
or the other.

20
00:01:26,770 --> 00:01:32,740
Now, the actual exercise step for the update process is to implement the common or update equations

21
00:01:32,740 --> 00:01:35,510
and the 2D tracking measurement model, which we discovered.

22
00:01:36,070 --> 00:01:39,950
So the first step is to open the Python file assignment, one update.

23
00:01:40,840 --> 00:01:44,470
Now, when we run it, as is, we see the object starts moving from the origin.

24
00:01:44,470 --> 00:01:49,950
So X and Y equals zero zero, but it moves in a random direction and speed.

25
00:01:50,200 --> 00:01:53,770
So every time you run it, the direction and speed are going to be slightly different.

26
00:01:54,190 --> 00:01:56,740
So the V, X and the Y are unknown.

27
00:01:56,950 --> 00:02:01,810
So we want to implement the update step to help estimate these parameters.

28
00:02:04,140 --> 00:02:09,770
So we want to go down to the initialization part and implement the Haganah matrixes as shown here,

29
00:02:11,040 --> 00:02:16,010
and all we want to do is fill in the and Matrix's as written on the right here.

30
00:02:16,530 --> 00:02:20,530
And we also want to assume that the precision measurements have a standard deviation of 10.

31
00:02:20,970 --> 00:02:24,240
So basically here we have 10 squared, 10 squared for the R matrix.

32
00:02:24,240 --> 00:02:28,310
So it's probably best just to use a variable so we can quickly change it later.

33
00:02:29,600 --> 00:02:34,430
So once we have set up the original matrix, the next step in the process is to implement the common

34
00:02:34,430 --> 00:02:36,040
filter updates to the equations.

35
00:02:36,620 --> 00:02:41,660
So inside the code, we have a function called Update Step and we want to go through and implement a

36
00:02:41,660 --> 00:02:44,390
different common for update equations that are required.

37
00:02:44,870 --> 00:02:49,850
So you can see here these equations on the right are the commentor update equations, which we're going

38
00:02:49,850 --> 00:02:50,150
through.

39
00:02:50,510 --> 00:02:55,760
So we want to mathematically write them in code under the update and you'll find the different positions

40
00:02:55,760 --> 00:02:56,510
inside the code.

41
00:02:56,510 --> 00:02:58,100
So you can see here we have Z ahat.

42
00:02:58,400 --> 00:03:03,170
So in this line of code here would work at al-Said Hat, which is our predictive measurements, which

43
00:03:03,170 --> 00:03:05,870
is Hech times X, which is also written here.

44
00:03:06,710 --> 00:03:10,010
So we'll go through and implement the common filter equations in this part of the code.

45
00:03:10,490 --> 00:03:13,020
And then the last step is to run the simulation.

46
00:03:13,700 --> 00:03:19,180
So if we run the simulation, as is, we'll say that the Kamasutra estimate does not change or is updated.

47
00:03:19,580 --> 00:03:22,680
This is because the initial uncertainty is set to zero.

48
00:03:22,700 --> 00:03:26,760
So we're basically taking the field that we know exactly where it is at the initial time.

49
00:03:27,080 --> 00:03:31,790
Therefore, any other information that we try to use to tell it otherwise is just going to be ignored.

50
00:03:32,670 --> 00:03:38,030
So what we do is then change initial velocity sanitisation to 10 and rerun the simulation.

51
00:03:38,630 --> 00:03:43,700
And then when we do that, we should be seeing that the common filter updates, the state estimates.

52
00:03:43,700 --> 00:03:50,270
As time goes on and we start tracking the object and the covariance around the object starts to decrease

53
00:03:50,270 --> 00:03:52,710
and shrink down and converge to the true position.

54
00:03:53,360 --> 00:03:58,880
And when we do this, we should also see that the main position and main velocity square there should

55
00:03:58,880 --> 00:03:59,980
be fairly small as well.

56
00:03:59,990 --> 00:04:02,030
So it should be tracking the object fairly well.

57
00:04:04,850 --> 00:04:10,630
So I'll let you go away and implement those equations inside the Python files and run the exercise.

58
00:04:11,090 --> 00:04:15,560
So after you've done that in the next video, we'll go through an explanation of what's happening behind

59
00:04:15,560 --> 00:04:18,470
the scenes and what we are actually seeing in the responses.

