So in the previous exercise, you had to go through and implement the prediction step of the common
Philidor.
It's always good practice that if you have a simulation of the model that you're trying to estimate,
then run the simulation without any noise from a known initial condition and then run the common field
of prediction, step from the same initial condition and see that the two are consistent.
Now, this is an important validation step.
It shows that the common field of model that you're using is appropriate for the system dynamics that
you're trying to estimate.
And we want to run this without the update step from the common filter.
This is because if we run it with the update step, sometimes the correction step can hide any errors
in the model.
So it's always good to make sure that the underlying prediction is as best as possible for the model
that we want to try to estimate so we can have a look at this when we look at the code.
So now let's switch to the code.
So to start off this, let's first start running the simulation with a zero initial state and zero covariance
and noise.
So now let's set our initial state.
So let's set our state just to be four zero zero zero zero zero.
So this is zero for the exposition, for the Y position, for the V, X and VI.
So the effect has being defined in this form here.
We're also going to use zero for the position, standard deviation and for the velocity standard deviation.
We're also going to use zero for the noise standard deviation.
So our random variable for the acceleration is going to be zero.
So now let's build this and then run the simulation and we should be able to see what the simulation
does.
So we can see as we start running the simulation, you can see that this is where the Red Cross is,
the estimated state of the system, and it starts and stays at zero because we have zero input into
the system.
You can see up here is our vehicle state.
So we're traveling at five meters per second at a 45 degree angle.
And you can see the field of state say zero.
And as we run, we are increasing X and Y and velocity error.
So this is to be expected.
So this shows that.
So this shows us that.
We've profiled one.
The contest drives 45 degrees at five meters a second.
So now let's actually put in the true side of the system so we know the origin that the so we know that
the car starts at the origin.
So zero zero.
And we know we're traveling at five meters a second at 45 degrees.
So let's change our velocity here to be five meters a second and at a 45 degree angle.
So now let's make this again.
So let's build it and then let's run it.
OK, so now we can see that the common field estimate.
So the red line here with the Red Cross being the estimated position for the current frame, you can
see that it's tracking the truth.
So it's moving along at the correct speed and velocity.
And you can see down here, we have very small we have zero any Armus error.
So this is because we put in the true state for the initial condition.
We are not adding any noise into the system.
And the system itself is just going on.
It's just undergoing a constant velocity at five miles per second at heading 45 degrees.
So this just proves that the prediction model that we're using is working correctly.
If we had any errors in the model, we can we will start to see errors creeping up here.
So the variance in the filter must always represent the approximate level of the uncertainty inside
the field or estimates, and this needs to be done through a correct model and correct tuning.
What this means is that the true state of the system is within the uncertainty bounds around the estimated
state.
If this is not the case, then the field is called inconsistent.
And if the filter is inconsistent, this leads to bad and incorrect estimates and it degrades the whole
estimation process.
In some cases, it pretty much means that the estimated state from the filter is worthless.
It's useless if you're trying to use it for anything, it will just cause problems.
So we've checked that the state transition model is working correctly, it can correctly predict from
a known initial condition the true state response.
We also want to check that the prediction model correctly transforms the uncertainty.
The uncertainty in the system should not be increasing.
If our key metrics process model noise is equal to zero.
Rather, it should be transformed, appropriate with the system model.
So on the slide here, we can see the common field, our prediction set for the uncertainty.
So this is the current uncertainty.
This is the predicted uncertainty.
These are the state transition matrixes.
And this is the process model noise.
So this step here takes the process model.
So this step here takes the uncertainty at the time came on minus one, transforms it through the process
model to get the new uncertainty at the current time.
So this transforms the uncertainty from the time set.
It does not actually inflate the uncertainty, does not increase the uncertainty in the system.
It just transforms what's appropriate with the system dynamics.
Whereas this key metrics here, this actually increases or inflates the uncertainty inside the system.
So if cuz equal to zero, we're just transforming the uncertainty based on the process model.
If CU is non-zero then we're actually increasing the uncertainty in the system.
So what we can do is that we can check the position uncertainty is operating as expected, and to do
this, we set the initial position uncertainty to be a non-zero value.
We set the initial velocity, uncertainty to be zero, and then we can run the filter and see that the
position uncertainty stays the same.
So let's do that with the code that we have developed.
So now let's set up the initial covariance to be a non-zero value for the position, but for the velocity,
uncertainty will keep it at zero.
So let's set our position on Sunday to be five metres.
So now we can build this and we can run it.
And in this situation, we should see that the position uncertainty stays constant.
So you can see as we run the simulation, we have a the three sigma uncertainty for position.
This red circle here stays at a constant value.
So in terms of the position, uncertainty, prediction for the covariance update, it is working correctly.
This is what we expect to see.
So the invariants prediction for the position and certainly seems to be operating as expected, so now
let's check that the velocity uncertainty is operating as expected.
And to do this, we're going to set the initial position on the any to zero, but we're going to set
the velocity uncertainty to a non-zero value.
And when we do this and run the field, we should see that the velocity uncertainty stays at the same
value.
But the position uncertainty in this case should grow linearly with time.
And this is just due to the dynamics of the system.
So if we integrate diversity, we should get a change in position.
We can also change the velocity uncertainty to be a non-zero value.
So let's change the velocity, uncertainty to be one and would change our position and certainly back
to being zero.
So let's make this and run it.
So now we should see the effect of the Awasthi uncertainty inside the simulation, inside the covariance
prediction.
So we can see as we run the simulation, the uncertainty for position starts off very small and then
it grows at a constant rate in accordance to the velocity uncertainty.
So this is what is to be expected.
So we've looked at the uncertainty due to the process model.
Now we want to let you have a look at the process model noise.
So this is the key metrics, part of the uncertainty equation.
So we want to check that the process model noise, the acceleration uncertainty is operating as expected
to do this, we're going to set the initial position and the uncertainties to zero.
And we want to set a non-zero acceleration stand deviation.
So we want the key metrics, the process model noise matrix to be non-zero.
So when you run the filter, we should say that the total level of uncertainty in the system should
be growing with time.
Now, this means that the velocity uncertainty should be increasing linearly and the position uncertainty
should be increasing quite radically as expected due to the system dynamics, because we know that position
is a second integral of acceleration.
So let's carry out this experiment, Velcade.
And then lastly, we can change our initial velocity and position uncertainty back to being zero and
we'll start off with a non-zero acceleration noise value.
So we're going to assume that the random variable modeling the acceleration as a non-zero value.
So let's build this and see what what happens.
So in this case, we should see that the error or the uncertainty grows exponentially.
So let's run this so we can say that the initial position, uncertainty starts off at zero and we can
say we get this increasing uncertainty in position as time goes on and we can actually see that our
position uncertainty.
So the three sigma balance here is actually growing quite radically with time.
This is because we get a first order integration from acceleration, diversity and then from velocity
to position.
So it is a quadratic exponential response for the covariance.
So the process model noise increases the uncertainty in the system to capture the stochastic nature
of the system dynamics.
Now, in this simple case where we have an object that starts at a known origin and moves at a constant
velocity and there's no randomness, randomness inside the system then is not really all that important.
This is why we the.
So this is why we can set a key matrix to be zero, because there's no uncertainty in the system.
The only uncertainty at the moment is around our initial guess of the position and velocity.
So in general, when we're running a common field, the key metrics or the process of noise can compensate
for a common Philidor process model that does not correctly or accurately model the true system dynamics.
And this works by increasing the uncertainty inside the system, which helps to cause a filter to stay
consistent so that it helps to make the uncertainty around the estimates to actually include where the
true state actually is.
The presence of noise ties closely and with the measurement of the noise and the performance of the
filter, so we only cover this in a lot more detail later on.
So hopefully now you have a better understanding of why we went about the different exercises in the
way that we did, a key takeaway point from all this is that whenever the designing or implementing
a common filter, if we have a simulation of what the true system is going to do, we should run that
and run the company through the prediction step to make sure the two are consistent or as consistent
as possible.
If we do this, then there's a good chance that the model we have selected for the common filter should
be appropriate for the system in that mix that we're trying to estimate.