What is the correct understanding of Kalman process noise with respect to ground truth?

205 Views Asked by At

I'm confused between two different ways of looking at what Kalman filtering does exactly. I'm trying to simulate a particle going from (-3,0) to (3,0) with a constant velocity and some noise (e.g. the particle is a quadcopter trying to fly at constant velocity, but may be pushed by gusts of air). The model I have come up with is:

$s_{n+1}=A s_n+B u_n+G w_n$

$\left[\begin{array}{l}x_{n+1} \\ y_{n+1} \\ \dot{x}_{n+1} \\ \dot{y}_{n+1}\end{array}\right]=\left[\begin{array}{cccc}1 & 0 & \Delta t & 0 \\ 0 & 1 & 0 & \Delta t \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1\end{array}\right]\left[\begin{array}{l}x_n \\ y_n \\ \dot{x}_n \\ \dot{y}_n\end{array}\right]+0 u_n+\left[\begin{array}{cc}\frac{\Delta t^2}{2} & 0 \\ 0 & \frac{\Delta t^2}{2} \\ \Delta t & 0 \\ 0 & \Delta t\end{array}\right] w_n$

Where I don't have a control input (because it is constant velocity), and $w_n \sim N_2(0, Q)$ is the two dimensional velocity noise (so essentially a random acceleration) with $Q=\left[\begin{array}{cc}\sigma_{x x}^2 & 0 \\ 0 & \sigma_{y y}^2\end{array}\right]$ And I'm adding this into the state covariance matrix: $P_{n+1}=A P_n A_{T}+GQG_{T}$

I think this is correct so far(?), but I'm having a bit of confusion about generating the data for my simulation. In MATLAB I'm generating the position vector in the following way:

wi=[-3;0];wl=[3;0];v_gnd=(wl-wi)./ts;
for i=1:ts;w_gnd(:,i)=w_gnd(:,i)+v_gnd+[normrnd(0,Qx);normrnd(0,Qy)];end

That is I choose an initial and last point, find the constant velocity needed between the two points by dividing by a time I want (ts), and adding 0-mean and Qx/Qy variance normal random noise to the position vector. However, two of my professors have told me that this is wrong. They say that the ground truth should be noiseless (i.e. just the straight line path from -3,0 to 3,0 with constant velocity), and that the process noise variance is only our belief of what the noise should be, but that the particle doesn't actually follow a random path.

I've thought long about what they've said and I have the following two perspectives. I don't know which is the correct way to look at what the KF is actually doing:

  1. If we consider the example of the quadcopter, it WILL be moved around by wind - wouldn't it's erratic path BE the ground truth as I'm trying to code?

  2. The only way I can think of in which they are correct is the following: The measurement is the only information we receive about the system. We need a way to decide what portion of the noise in these measurements is due to measurement noise and what portion is due to a process noise, so we allocate a covariance for each: one Q covariance, and one (typically named) R measurement covariance. And the Kalman gain gives us the optimal value to use for our Q & R. That is to say: even if we have a constant velocity ground truth, Q need not be zero because we believe there is noise in the process and wish to account for that from the noisy measurements we are obtaining. Is that the correct understanding of the KF?

But, if it is the second, how do we ever implement KF's that track targets which are actually being pushed around due to environmental factors?