1
00:00:04,160 --> 00:00:09,080
So in the previous exercise, you had to go through and implement the prediction step of the common

2
00:00:09,080 --> 00:00:09,510
Philidor.

3
00:00:10,040 --> 00:00:14,660
It's always good practice that if you have a simulation of the model that you're trying to estimate,

4
00:00:15,260 --> 00:00:20,600
then run the simulation without any noise from a known initial condition and then run the common field

5
00:00:20,600 --> 00:00:25,010
of prediction, step from the same initial condition and see that the two are consistent.

6
00:00:25,850 --> 00:00:28,260
Now, this is an important validation step.

7
00:00:28,280 --> 00:00:32,660
It shows that the common field of model that you're using is appropriate for the system dynamics that

8
00:00:32,660 --> 00:00:33,610
you're trying to estimate.

9
00:00:34,280 --> 00:00:37,330
And we want to run this without the update step from the common filter.

10
00:00:37,700 --> 00:00:43,070
This is because if we run it with the update step, sometimes the correction step can hide any errors

11
00:00:43,070 --> 00:00:43,630
in the model.

12
00:00:44,240 --> 00:00:49,100
So it's always good to make sure that the underlying prediction is as best as possible for the model

13
00:00:49,100 --> 00:00:53,270
that we want to try to estimate so we can have a look at this when we look at the code.

14
00:00:53,750 --> 00:00:55,610
So now let's switch to the code.

15
00:00:55,970 --> 00:01:02,840
So to start off this, let's first start running the simulation with a zero initial state and zero covariance

16
00:01:02,840 --> 00:01:03,560
and noise.

17
00:01:03,950 --> 00:01:06,110
So now let's set our initial state.

18
00:01:06,530 --> 00:01:12,400
So let's set our state just to be four zero zero zero zero zero.

19
00:01:12,800 --> 00:01:19,070
So this is zero for the exposition, for the Y position, for the V, X and VI.

20
00:01:19,070 --> 00:01:22,370
So the effect has being defined in this form here.

21
00:01:22,910 --> 00:01:28,990
We're also going to use zero for the position, standard deviation and for the velocity standard deviation.

22
00:01:29,420 --> 00:01:32,180
We're also going to use zero for the noise standard deviation.

23
00:01:32,190 --> 00:01:35,660
So our random variable for the acceleration is going to be zero.

24
00:01:36,470 --> 00:01:43,790
So now let's build this and then run the simulation and we should be able to see what the simulation

25
00:01:43,790 --> 00:01:44,270
does.

26
00:01:45,180 --> 00:01:49,910
So we can see as we start running the simulation, you can see that this is where the Red Cross is,

27
00:01:49,910 --> 00:01:55,190
the estimated state of the system, and it starts and stays at zero because we have zero input into

28
00:01:55,190 --> 00:01:55,780
the system.

29
00:01:56,330 --> 00:01:58,760
You can see up here is our vehicle state.

30
00:01:58,760 --> 00:02:03,140
So we're traveling at five meters per second at a 45 degree angle.

31
00:02:04,220 --> 00:02:06,300
And you can see the field of state say zero.

32
00:02:06,350 --> 00:02:11,400
And as we run, we are increasing X and Y and velocity error.

33
00:02:12,620 --> 00:02:14,010
So this is to be expected.

34
00:02:14,030 --> 00:02:16,400
So this shows that.

35
00:02:16,910 --> 00:02:18,050
So this shows us that.

36
00:02:18,050 --> 00:02:19,010
We've profiled one.

37
00:02:19,760 --> 00:02:23,210
The contest drives 45 degrees at five meters a second.

38
00:02:23,780 --> 00:02:29,870
So now let's actually put in the true side of the system so we know the origin that the so we know that

39
00:02:29,870 --> 00:02:31,130
the car starts at the origin.

40
00:02:31,130 --> 00:02:32,090
So zero zero.

41
00:02:32,360 --> 00:02:35,860
And we know we're traveling at five meters a second at 45 degrees.

42
00:02:36,170 --> 00:02:42,680
So let's change our velocity here to be five meters a second and at a 45 degree angle.

43
00:02:42,710 --> 00:02:44,900
So now let's make this again.

44
00:02:44,910 --> 00:02:47,960
So let's build it and then let's run it.

45
00:02:50,360 --> 00:02:53,560
OK, so now we can see that the common field estimate.

46
00:02:53,570 --> 00:02:58,190
So the red line here with the Red Cross being the estimated position for the current frame, you can

47
00:02:58,190 --> 00:03:00,050
see that it's tracking the truth.

48
00:03:00,050 --> 00:03:03,770
So it's moving along at the correct speed and velocity.

49
00:03:03,770 --> 00:03:09,030
And you can see down here, we have very small we have zero any Armus error.

50
00:03:09,050 --> 00:03:12,950
So this is because we put in the true state for the initial condition.

51
00:03:13,610 --> 00:03:15,800
We are not adding any noise into the system.

52
00:03:16,040 --> 00:03:18,710
And the system itself is just going on.

53
00:03:18,830 --> 00:03:23,420
It's just undergoing a constant velocity at five miles per second at heading 45 degrees.

54
00:03:23,750 --> 00:03:28,670
So this just proves that the prediction model that we're using is working correctly.

55
00:03:28,670 --> 00:03:33,830
If we had any errors in the model, we can we will start to see errors creeping up here.

56
00:03:35,310 --> 00:03:40,800
So the variance in the filter must always represent the approximate level of the uncertainty inside

57
00:03:40,800 --> 00:03:45,410
the field or estimates, and this needs to be done through a correct model and correct tuning.

58
00:03:45,960 --> 00:03:51,300
What this means is that the true state of the system is within the uncertainty bounds around the estimated

59
00:03:51,300 --> 00:03:51,710
state.

60
00:03:52,260 --> 00:03:55,500
If this is not the case, then the field is called inconsistent.

61
00:03:55,740 --> 00:04:01,260
And if the filter is inconsistent, this leads to bad and incorrect estimates and it degrades the whole

62
00:04:01,260 --> 00:04:02,340
estimation process.

63
00:04:02,820 --> 00:04:07,220
In some cases, it pretty much means that the estimated state from the filter is worthless.

64
00:04:07,220 --> 00:04:11,300
It's useless if you're trying to use it for anything, it will just cause problems.

65
00:04:13,190 --> 00:04:18,020
So we've checked that the state transition model is working correctly, it can correctly predict from

66
00:04:18,020 --> 00:04:20,810
a known initial condition the true state response.

67
00:04:21,440 --> 00:04:25,280
We also want to check that the prediction model correctly transforms the uncertainty.

68
00:04:26,090 --> 00:04:29,000
The uncertainty in the system should not be increasing.

69
00:04:29,000 --> 00:04:32,780
If our key metrics process model noise is equal to zero.

70
00:04:33,320 --> 00:04:36,790
Rather, it should be transformed, appropriate with the system model.

71
00:04:37,400 --> 00:04:41,730
So on the slide here, we can see the common field, our prediction set for the uncertainty.

72
00:04:41,750 --> 00:04:43,540
So this is the current uncertainty.

73
00:04:43,820 --> 00:04:45,470
This is the predicted uncertainty.

74
00:04:46,160 --> 00:04:48,770
These are the state transition matrixes.

75
00:04:48,800 --> 00:04:51,860
And this is the process model noise.

76
00:04:53,150 --> 00:04:55,450
So this step here takes the process model.

77
00:04:55,880 --> 00:05:01,970
So this step here takes the uncertainty at the time came on minus one, transforms it through the process

78
00:05:01,970 --> 00:05:04,970
model to get the new uncertainty at the current time.

79
00:05:05,500 --> 00:05:08,080
So this transforms the uncertainty from the time set.

80
00:05:08,270 --> 00:05:12,650
It does not actually inflate the uncertainty, does not increase the uncertainty in the system.

81
00:05:12,890 --> 00:05:16,490
It just transforms what's appropriate with the system dynamics.

82
00:05:17,240 --> 00:05:22,490
Whereas this key metrics here, this actually increases or inflates the uncertainty inside the system.

83
00:05:23,150 --> 00:05:28,270
So if cuz equal to zero, we're just transforming the uncertainty based on the process model.

84
00:05:28,610 --> 00:05:32,600
If CU is non-zero then we're actually increasing the uncertainty in the system.

85
00:05:35,660 --> 00:05:41,330
So what we can do is that we can check the position uncertainty is operating as expected, and to do

86
00:05:41,330 --> 00:05:44,980
this, we set the initial position uncertainty to be a non-zero value.

87
00:05:45,410 --> 00:05:51,170
We set the initial velocity, uncertainty to be zero, and then we can run the filter and see that the

88
00:05:51,170 --> 00:05:52,890
position uncertainty stays the same.

89
00:05:53,660 --> 00:05:56,210
So let's do that with the code that we have developed.

90
00:05:56,360 --> 00:06:03,770
So now let's set up the initial covariance to be a non-zero value for the position, but for the velocity,

91
00:06:03,770 --> 00:06:05,280
uncertainty will keep it at zero.

92
00:06:05,300 --> 00:06:09,080
So let's set our position on Sunday to be five metres.

93
00:06:09,410 --> 00:06:12,520
So now we can build this and we can run it.

94
00:06:12,980 --> 00:06:17,170
And in this situation, we should see that the position uncertainty stays constant.

95
00:06:17,600 --> 00:06:23,270
So you can see as we run the simulation, we have a the three sigma uncertainty for position.

96
00:06:23,270 --> 00:06:26,960
This red circle here stays at a constant value.

97
00:06:26,990 --> 00:06:34,610
So in terms of the position, uncertainty, prediction for the covariance update, it is working correctly.

98
00:06:34,610 --> 00:06:36,500
This is what we expect to see.

99
00:06:38,360 --> 00:06:44,210
So the invariants prediction for the position and certainly seems to be operating as expected, so now

100
00:06:44,210 --> 00:06:48,220
let's check that the velocity uncertainty is operating as expected.

101
00:06:48,230 --> 00:06:53,360
And to do this, we're going to set the initial position on the any to zero, but we're going to set

102
00:06:53,360 --> 00:06:56,050
the velocity uncertainty to a non-zero value.

103
00:06:56,870 --> 00:07:02,210
And when we do this and run the field, we should see that the velocity uncertainty stays at the same

104
00:07:02,210 --> 00:07:02,650
value.

105
00:07:03,140 --> 00:07:06,980
But the position uncertainty in this case should grow linearly with time.

106
00:07:07,790 --> 00:07:11,160
And this is just due to the dynamics of the system.

107
00:07:11,510 --> 00:07:15,370
So if we integrate diversity, we should get a change in position.

108
00:07:16,040 --> 00:07:20,050
We can also change the velocity uncertainty to be a non-zero value.

109
00:07:20,060 --> 00:07:24,980
So let's change the velocity, uncertainty to be one and would change our position and certainly back

110
00:07:24,980 --> 00:07:25,940
to being zero.

111
00:07:26,480 --> 00:07:28,170
So let's make this and run it.

112
00:07:28,700 --> 00:07:35,240
So now we should see the effect of the Awasthi uncertainty inside the simulation, inside the covariance

113
00:07:35,240 --> 00:07:35,720
prediction.

114
00:07:36,410 --> 00:07:41,420
So we can see as we run the simulation, the uncertainty for position starts off very small and then

115
00:07:41,420 --> 00:07:46,670
it grows at a constant rate in accordance to the velocity uncertainty.

116
00:07:46,790 --> 00:07:49,080
So this is what is to be expected.

117
00:07:49,820 --> 00:07:52,910
So we've looked at the uncertainty due to the process model.

118
00:07:53,060 --> 00:07:56,110
Now we want to let you have a look at the process model noise.

119
00:07:56,120 --> 00:08:00,130
So this is the key metrics, part of the uncertainty equation.

120
00:08:00,770 --> 00:08:06,080
So we want to check that the process model noise, the acceleration uncertainty is operating as expected

121
00:08:06,950 --> 00:08:11,110
to do this, we're going to set the initial position and the uncertainties to zero.

122
00:08:11,630 --> 00:08:14,810
And we want to set a non-zero acceleration stand deviation.

123
00:08:14,810 --> 00:08:18,980
So we want the key metrics, the process model noise matrix to be non-zero.

124
00:08:19,790 --> 00:08:24,500
So when you run the filter, we should say that the total level of uncertainty in the system should

125
00:08:24,500 --> 00:08:25,730
be growing with time.

126
00:08:26,180 --> 00:08:31,940
Now, this means that the velocity uncertainty should be increasing linearly and the position uncertainty

127
00:08:31,940 --> 00:08:37,550
should be increasing quite radically as expected due to the system dynamics, because we know that position

128
00:08:37,550 --> 00:08:40,280
is a second integral of acceleration.

129
00:08:40,890 --> 00:08:43,190
So let's carry out this experiment, Velcade.

130
00:08:43,760 --> 00:08:50,630
And then lastly, we can change our initial velocity and position uncertainty back to being zero and

131
00:08:50,630 --> 00:08:54,550
we'll start off with a non-zero acceleration noise value.

132
00:08:54,560 --> 00:09:00,250
So we're going to assume that the random variable modeling the acceleration as a non-zero value.

133
00:09:00,650 --> 00:09:03,740
So let's build this and see what what happens.

134
00:09:04,340 --> 00:09:09,520
So in this case, we should see that the error or the uncertainty grows exponentially.

135
00:09:09,530 --> 00:09:14,720
So let's run this so we can say that the initial position, uncertainty starts off at zero and we can

136
00:09:14,720 --> 00:09:21,470
say we get this increasing uncertainty in position as time goes on and we can actually see that our

137
00:09:21,470 --> 00:09:22,510
position uncertainty.

138
00:09:22,550 --> 00:09:26,700
So the three sigma balance here is actually growing quite radically with time.

139
00:09:27,020 --> 00:09:32,300
This is because we get a first order integration from acceleration, diversity and then from velocity

140
00:09:32,300 --> 00:09:33,050
to position.

141
00:09:33,050 --> 00:09:37,390
So it is a quadratic exponential response for the covariance.

142
00:09:38,570 --> 00:09:44,660
So the process model noise increases the uncertainty in the system to capture the stochastic nature

143
00:09:44,660 --> 00:09:45,980
of the system dynamics.

144
00:09:46,580 --> 00:09:52,040
Now, in this simple case where we have an object that starts at a known origin and moves at a constant

145
00:09:52,040 --> 00:09:58,550
velocity and there's no randomness, randomness inside the system then is not really all that important.

146
00:09:58,610 --> 00:10:00,150
This is why we the.

147
00:10:00,500 --> 00:10:05,110
So this is why we can set a key matrix to be zero, because there's no uncertainty in the system.

148
00:10:05,330 --> 00:10:12,020
The only uncertainty at the moment is around our initial guess of the position and velocity.

149
00:10:13,510 --> 00:10:18,820
So in general, when we're running a common field, the key metrics or the process of noise can compensate

150
00:10:18,820 --> 00:10:25,000
for a common Philidor process model that does not correctly or accurately model the true system dynamics.

151
00:10:26,290 --> 00:10:31,750
And this works by increasing the uncertainty inside the system, which helps to cause a filter to stay

152
00:10:31,750 --> 00:10:38,200
consistent so that it helps to make the uncertainty around the estimates to actually include where the

153
00:10:38,200 --> 00:10:39,640
true state actually is.

154
00:10:40,600 --> 00:10:45,640
The presence of noise ties closely and with the measurement of the noise and the performance of the

155
00:10:45,640 --> 00:10:48,790
filter, so we only cover this in a lot more detail later on.

156
00:10:50,420 --> 00:10:55,190
So hopefully now you have a better understanding of why we went about the different exercises in the

157
00:10:55,190 --> 00:11:00,800
way that we did, a key takeaway point from all this is that whenever the designing or implementing

158
00:11:00,800 --> 00:11:05,840
a common filter, if we have a simulation of what the true system is going to do, we should run that

159
00:11:05,840 --> 00:11:10,550
and run the company through the prediction step to make sure the two are consistent or as consistent

160
00:11:10,550 --> 00:11:11,270
as possible.

161
00:11:12,200 --> 00:11:16,820
If we do this, then there's a good chance that the model we have selected for the common filter should

162
00:11:16,820 --> 00:11:19,640
be appropriate for the system in that mix that we're trying to estimate.
