Now, let's have a look at our first exercise for the 2D tracking filter that we're developing, and
this is going to be the prediction step.
So we have already derived in past the process model, which is shown in this equation.
Here we have the state transmission matrix.
If we have the noise since the Matrix L and we have the state and noise vectors here.
So we end up with this equation change here written out.
And for now we know the noise properties of the system.
We know that this random vector here is going to be a normal distribution with covariance.
Q Where covariance.
Q is just this Gaussian distribution here.
So basically we just have a diagonal matrix saying that the X and Y components are independent and they're
going to have these noise variance values, one for the X acceleration, one for Y acceleration.
So the process of noise prediction set for the common filter is shown here.
So since we have non additive noise up here, so since we're multiplying our noise backed up by this
el matrix, we have to transform our variance from the process model units into our state units.
So we do this using the EL transformation here.
So basically for our covariance matrix.
Q We have to multiply it by this transform that we've covered it in the past.
So looking at this equation is l l transpose.
If we expand it out, we'll get a matrix that looks like this.
So this would be the amount of noise we have to inflate the system by Jews to the noise of the acceleration.
Now we actually have a closer look at this.
We can actually find that this is not a valid Gaussian distribution, is not about probability distribution
and is not a valid probability density function because it is ranked deficient.
If you look at the determinant of this matrix is going to be determinant of zero.
So this matrix is not a valid distribution.
And if we use this distribution inside the common field of process model noise prediction up here,
eventually the field is going to become ill conditioned, is going to stop working.
This is actually feeding it bad information.
So unfortunately, we're going to have to do something about that.
So what we're going to do, we're going to slightly modify the problem, so instead of assuming that
we have an acceleration value for the X and Y separately, we're just going to first assume that it's
just a constant variance.
So the noise is going to change from a two dimensional Gaussian distribution just down to a one dimensional
Gaussian distribution.
And secondly, now, instead of having a modification of the noise, so having cell times all random
vector w, we're now going to modify this.
So we only have additive noise and we're going to use this el matrix as a scaling to the normal distribution.
So now we're going to have for the noise vector W is going to be a normal distribution of this standard
deviation, but it's going to be multiplied by or scaled by this el matrix.
So this basically gives us a new covariance.
This is now the covariance that we're going to get.
So now we're breaking up a single random variable into four different components using this matrix here.
So this key metrics now becomes the new covariance for our random vector W.
So these equations here are now going to be modified.
We're going to modify them.
So now we only have additive noise.
Therefore, we only have to add onto the covariance using this matrix and the matrix is shown here.
So this is a valid probability distribution because we know it is just by looking at it.
So we have a simple diagonal matrix.
So this is now going to be a better distribution for the noise into the system.
So we're going to use this version rather than the original version, because this one will cause the
system to work better and it won't be your condition the longer we run it.
So now for your first exercise, your first exercise is to implement the common for the prediction equations,
which we've covered in the previous videos and the 2D tracking filter process model, which also covered
in the previous videos.
So to do this, the first step is to open the Python file called Assignment One underscore prediction.
You if you run this example as is, you'll see that the object starts at the origin.
So P and P Y equals zero zero and it moves at a 45 degree angle at 10 meters a second or such that the
V, X and V Y a seven point seven seven point ninety seven.
The next step in the assignment is to set up the initial state and covariance to honor this initialize
function.
Here you have these placeholder places to set up the variables.
So you're going to have to go through and write the code to initialize the state and covariance.
And when we do this, you can assume that the initial position is zero zero and you can assume that
initial velocity is this seven point zero seven seven point zero seven, just like we've saved from
running example without making any code modifications.
We can also assume the initial uncertainty is just going to be zero matrix.
So basically for the state and covariance, we just want to set up a matrix X for the vector looking
at this and a matrix P for the covariance that looks like this.
Once we've done that, then we want to set up the model F and key matrixes, so the Matrix F we've seen
that looks like this, we've derived that just before and our new key matrix, what looks like this.
So we're going to use the time set that is given in the function and define the F process model.
We are also going to define the key metrics as a function of the variable acceleration, standard deviation.
So inside the code we say these placeholder variables.
We want to fill in the equations for these two equations.
We also are going to assume that the process model noise acceleration, this acceleration, standard
deviation or this one here squared is going to be zero initially.
Now that we've done the previous step, then four, step four, we want to implement the common field
of prediction step equations.
This includes the prediction and the covariance propagation.
So in the code on the prediction step function, we want to fill in this X predict and predict.
And basically we want to use these equations showing here, which are these equations shine on the slide
here.
Now, once we've done all that, we can actually run your updated simulation and we actually want to
check that the prediction now follows a true fairly closely.
So we should end up with a very small, mean error and a main force, the area main velocity error at
the end of the simulation.
This is just because we actually know the real starting position and real velocity.
So the prediction should follow it fairly closely.
If it doesn't, it means you've implemented something incorrectly.
So we've checked the state prediction is working.
So now we want to check that the precision covariance prediction is also working.
So now let's set the initial position, X and Y covariance to be five squared.
So now when we run the simulation again, we see a three sigma position.
Uncertainty stays at approximately plus or minus 15 metres as expected.
So from this, we can see that the position, covariance prediction is working correctly.
The next step is to check the velocity covariance prediction.
So what we can do is we can set the initial states ought to be zero.
So we have zero prediction.
We can set the initial position covariance to be zero, but we're going to set the initial velocity
X and Y covariance to be seven, divided by three squared.
So if we do this and we run the simulation, we see that the three error position sigma on the graph
grows at the same rate as the position changes of the truth.
So you can say here under this green line, here is the red line, and that is the rate at which the
object is moving.
So we can see that the velocity covariance prediction is consistent with the actual velocity or the
rate of change of the error inside the common field on.
The last step is going to be the check that the acceleration covariance prediction is working.
So to do this, we want to set the initial state back to the original value of the zero zero seven point
zero seven seven point zero seven.
We want to set the initial covariance all to be zero, but now we want to set the process.
What annoys noise, the acceleration, standard deviation to be point one.
Now, when we run the simulation, we should see that the three sigma velocity and grows quite radically
with time.
So you should see that sort of looks like this.
You should see that our velocity uncertainty starts at zero and it has a quarter and it has a quadratic
shape that Croz of time and ends up a value almost at three.
So now it's your turn is up to you to go through these steps that we've just explained in this video
inside the Python file for yourself and to get the same results in the next video after you complete
the assignment, one prediction step, we're going to go through the results and explain what I mean.