ΣSigmaStudio Ask AI Русский Log in

Kalman Filter for Laser Rangefinder

Processors & DSP jimctr Jan 22, 2010 00:00 9 replies Original on forum ↗
Subscribe
jimctr Question
Jan 22, 2010 00:00

I must be missing something. I passed 128 records of 1300 samples each (1300x128) through a Kalman Filter (This is basically a laser return signal - often times quite small- buried in solar noise generated by an APD - Avalanche Photo Diode) and the output appears as noisy as any one of the record inputs. Simple Averaging of these 128 records yields a signal from the noise, but I was under the impression that Kalman Filter is superior to simple averaging for lifting signal from noise. I can only conclude that I am doing something wrong. I had set my State Transition Matrix (A) and Observation Matrix (H) to an Identity Matrix, and I played around with process noise covariance(Q) and measurement noise covariance (R) values but to no avail. This is a stationary process so I employed a Simple Discrete Kalman Filter. Are there any limitations to the use of Kalman filters? Sampling Rates? Any suggestions why a filter may fail you? Thanks.

gpan Reply
Feb 9, 2010 00:00

Hi,

I am not entirely sure what you are doing. Do you use 128 states, i.e., the matrix A is 128x128? Assume that is

what you are doing. I think the "problem" stems from an over-expectation for Kalman Filter (KF). KF is only as good as

its model (A,H,Q,R) can provide. It is optimal within the linear estimation methods, assuming the matrics A,H,Q,R do properly

desribe the underline physical phenomenon. Intuitively, assuming A=I (the identical matrix) expects that the next

state x(k+1) is the same as the current x(k) when there is no noise. This means that any difference x(k+1)-x(k) between

those 2 states come from the process noise (Q). This kind of model does not seem to be much helpful, unless

you are convenced that the data you are analysing should obey such a simple model.

When the process model and observation model are assumed to be such simple (but physically very restrictive model in

the sense that x(k+1) has to be the same as x(k)), one way to see why KF may not be better than a simple average

(a low pass filter) is to look at the Riccati equation.

The steady-state covariance maxtix of KF is the solution of the (algebraic) Riccati equation:

P=A(P-PH'(HPH'+R)^-1HP]A'+Q

In our case, A=H=I, so the above equation is simplified into

P=P-P(P+R)^-1P+Q

0=-P(P+R)^-1P+Q

P^-1QP^-1= -(P+R)^-1

PQ^-1P= -(P+R)

To get some intuition, assume Q=qI, R=rI, where q,r are positive scalar (not a vector), we have

qP^2+P+rI=0

This is a matrix quardratic equation. In the extreme case, when P is a scalar, i.e., when demention of x is only 1

(this is not our case, but we just want to get some intuition), the equation has solution

P=(-1 +/- sqrt(1-4qr))/2

Since sqrt(1-4qr)<1, this solution P<=0, which is not a valid solution. This means that KF will not converge to any steady-state,

i.e., the covariant matrix P(k|k) obtained at each time instance k will vary even when time goes to infinity.

jimctr Reply
Feb 9, 2010 00:00

Thanks for responding. I am taking 256 records of 2048 samples each for a laser rangefinder. That is to say, a laser is fired 256 times and for each laser fire 2048 samples are recorded. With 1 meter resolution, this corresponds to 2048 meters, but with our current set of optics, there is no hope to range out that far. We are using an 8-bit AD converter. One would think the noise (which is basically solar noise generated by an APD) is uncorrelated. One would expect that a given target at a given distance from one record to the next would provide a relatively constant amplitude (this is not exactly true as there are a number of atmospheric variables and electronic variables to consider) but in any case it is a non-random value (unlike the noise which should tend to cancel itself out with a number of iterative computations). Examples I have seen (eg., at Mathworks made the assumption that both A and H = I) and this appeared to work as random noise was added to signal and effectively filtered out. I basically saw a complete failure of the Kalman Filter from eliminating this random noise. Possibilities: 1) I implemented the Kalman filter incorrectly, 2) the noise is not actually all that random (though it does disappear with averaging which implies that it is, 3) that the model is overly simplified, A = I, H = I (but I would have no idea how to come up with a more realistic matrices). I would think for this example A (state matrix) would have to be identity as there really should be no difference between say the laser fired the first time and the second. I would also have thought the measurement matrix is identity as well but I could very well be wrong about that.

In the meantime I have been playing with Wavelet Transforms and have had a little more success with these. Sometimes they seem to work very well. At other times they don't work at all.

gpan Reply
Feb 9, 2010 00:00

Hi,

Thank you for the details. I now better understand what you are doing. Among the possibilities, I would think that

the most probable problem comes from the process model (state model) A=I. Consider 2 laser firing at 2 diff times.

Most likely their phases are different. When their phases diff by pi (180 degree), the two laser signal will cancel

out completely if adding them up. So simple average may not work so well. In the context of KF for this case,

we should have x(k+1)=x(k)*e^(i*pi), not x(k+1)=x(k). This may also explain why wavelet may work sometimes,

but not all the time.

jimctr Reply
Feb 9, 2010 00:00

So how do you approach this problem if sometimes you get good results and sometimes not, i.e., if the state model is not consistent?

gpan Reply
Feb 9, 2010 00:00

KF relies on the model heavely, i.e., if the model has some error, the result can be quite different from

so calle optimal. Are there some methods which relies on less on phase?

jimctr Reply
Feb 9, 2010 00:00

Still, this does not seem to be a phase issue since the signal averages out ok

jimctr Reply
Feb 18, 2010 00:00

Just wanted to field one other thought. Let's ignore the signal for now. Let's say I just have random noise I want to pass through a Kalman filter, and I use the identity for state transition matrix and observation matrix. I would expect passing random noise through a Kalman filter would result in some baseline value at the output, similar to me averaging the noise over several iterations. However, this is not what I get. The noise output reflects noise input, though there is some difference in quality when I modify the process and measurement noise covariance. In an example I came across on the mathworks site, a person adds random noise to a battery voltage, 12V. Both State and Observation Values were set to identity. After several iterations, the kalman filter rejected the noise and 12V remained.

gpan Reply
Feb 18, 2010 00:00

The thingking experiment you posted is helpful as for what may go wrong. The case posted on

mathworks site is understandable because KF is the optimal linear estimation based on

the observation (it is called conditional mean with condition being the observation up to the

time instance k). In particular, if the observation noise is near 0, KF should "track" the 12V

quite well. Likewise, if initial state is 0 (0 V in the case), the KF output should be less noisy

than the process noise (with covariance Q). I agree that something may not be quite right

with your implementation, if the KF you implemented does not exhibit such a property.

EZAdministrator Reply
Aug 2, 2018 00:00

This question has been assumed as answered either offline via email or with a multi-part answer. This question has now been closed out. If you have an inquiry related to this topic please post a new question in the applicable product forum.

Thank you,
EZ Admin