0
$\begingroup$

I am trying to use Kalman Filter in my project to eliminate outliers that go beyond certain limit.

I am use 1D lidar to get the distance between the robot and an object. I get pretty accurate values in mm. The output from 3 such lidars looks as follows:

enter image description here

Now, I know that the outlier can be removed using Kalman Filter + Maholobonis distance. It is efficient in doing so. But I too can do that by passing all the values through a limiter (that rejects all values above a threshold). (e.g., `if(val > threshold): continue).

Another inherent feature of this Kalman filter is that it smoothes the values, as shown in this demo.

(enter image description here

Do I really need a Kalman Filter ?

$\endgroup$
2
  • $\begingroup$ How accurate is your model? Because if your model does not match your actual system well then you can get the smoothing as shown by the demo. $\endgroup$ – fibonatic Oct 5 '20 at 11:45
  • $\begingroup$ I think the smoothening will implicitly reduce the accuracy of the sensor values. I don't think that would be great. $\endgroup$ – Pe Dro Oct 5 '20 at 12:13
1
$\begingroup$

TL;DR

Nope! You don't really need Kalman filtering in this context!

To perform outliers rejection, there are other techniques that you can apply successfully and more easily without the bother of dealing with the Kalman filter's requirements.


Kalman filtering can be demonstrated to be the optimal stochastic filter when we have:

  1. a linear model of our process.
  2. Gaussian noise affecting the measurements.

In reality, neither condition 1 nor condition 2 are ever verified, as the model cannot encapsulate the whole knowledge of our physical system and the noise is never perfectly Gaussian. Anyway, engineers do not tend to get scared about that and keep applying Kalman filtering and its variants everywhere regardless of the extent to which those conditions are true.

If we think about it, the same applies to PID controllers, which are linear systems and as such can be used only paired with linear processes. There exists no single linear process in nature. What the heck? Well, who cares, we keep on using both PID and Kalman estimator, which do work really great!

In this digression, I have purposely exaggerated the context, as engineers are pretty much careful to gauge the limits of applicability of these useful linear tools (the extent I mentioned earlier). To this end, they study the model of the process at hand together with its relevant properties, which is often the very first step of the analysis.

Do you have a model for your process and a rough estimate of the noise statistics? If the answer is yes, you could continue to have a deeper look and make attempts to characterize this model (identification) and work out a good first guess for the noise and process variance to then run some tests to verify your hypotheses. However, this would entail that you sit down and put in a non-negligible effort.

Want to try out something simpler, where resorting to heuristics is – so to speak – more reasonable and sound than betting with Kalman parameters? Well, make use of Median Filtering!

Median filtering is a very simple nonlinear technique that does its best with outliers removal without introducing significant lag in the response.

You can appreciate the 1D median filter at work here: https://www.mathworks.com/help/signal/ref/medfilt1.html

$\endgroup$
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.