- Modify the source code for question 2.32 like in this image:
That is, add a couple of lines for printing x and P value after the measurement phase as well.
- Press the run button without submitting your code again which, hopeful, has already been valued as correct.
Now you get new values. So let's dive into it.
Both the position and velocity are 0.
The uncertainty about them is very high, 1000.
This corresponds to a wide gaussian centred in the origin.
After the first measurement your new values for x are close to 1 for the position (as you have just gotten a measure of 1 for it), and 0 for the velocity.
The new gaussian is just like the one prof. Thrun drew. It reflects the fact that we have gained some knowledwe of the position, while are still extremely unsure about the velocity.
So now we are in the same situation as in prof. Thrun's video, but only shifted on the right by 1 on the x axis.
Why is x just a little lower that 1? Because the uncertainty of the measurement is much lower than the one of the initial position. If you change the first value of P matrix to be 1., you will get a position of 0.5, which is just in the middle.
After this step, your average estimated position is 1 and velocity 0.
Your position, on the average, doesn't change because average velocity is 0.
But there is one thing that does improve: P matrix.
It now considers a relationship between x and velocity (correlation).
This is the only thing that avoids being stuck always in the same position.
The following figure shows it is just like the one drawn by prof. Thrun.
Now you have a new measurement for x, and it updates the estimated position, just the way Thrun showed in his video.
I want to remark just a difference to what drawn by the prof.
The measurement, as he correctly stated, doesn't say anything about the velocity.
So it cannot correspond to an elongated gaussian, as would say not much, but still something about velocity.
As a matter of a fact the information we now get is one dimensional and I drew it as a little gaussian on the x axis.
The matrix who stores measurement uncertainty is R, which is 1x1.
It manages to modify P, the way represented in the image, just by mean of all complex matrix operations.
Now for x and velocity, everything gets easier.
We can predict a value of about 3 for x and 1 for the velocity.
As to P matrix, prediction just stretches the gaussian a little bit like before.
I want to show you the modification of the P matrix with the help of this webpage which calculates eigenvalues.
For the P matrix after the measurement we get:
Eigenvector of eigenvalue 0.2192053908802083:
Eigenvector of eigenvalue 2.27754947681803:
For P after the prediction:
Eigenvector of eigenvalue 0.08451864279326937:
Eigenvector of eigenvalue 5.906994088109875:
Please notice how the prediction phase doesn't modify the discriminant of P.