Pages

Thursday, February 23, 2012

Kalman Filtering for Dummies Part I

I find this topic quite interesting yet challenging. The application from this filter is vast and this filter itself is very useful in many data fusion application. As for the number of applications, the sky is the limit but from my background of study, I would like to discuss about this filter from robotics application point of view.

To start off, understanding this filter is not an easy task, due to the nature of the subject. Of course certain pre-requisites are required, for example linear system, control system engineering, state space control, discrete state space, etc. Note that this post is targeted to amateurs in robotics who wants to use this filter but have no strong backgrounds in the fields I have mentioned. As this post is targetted on the implementation of Kalman filter, there is no explanation on the proof or the underlying theory.

Before going further, I would like to share my experience in learning this filter. I find it hard to search for a decent Kalman filter tutorial, that is suitable for amateur roboticist. Most will just jump to the formula without explaining the theory behind, while some would just explain the theory with those rigorous mathematics. I will try my best to make this post comfortable for the "dummies". Hey, I used to be a dummy too.

Kalman filter is a very powerful filter in a sense that it can be used to fuse two related data to obtain a clean and more accurate data. For example in robotics application, I have a positional sensor (incremental encoder) and speed sensor (tachometer). Of course I can differentiate the position sensor to obtain the speed or integrate the speed sensor to obtain the position. But why do I need both sensors?

As a brief explanation, we could put that each sensors have their own variances. In other words, each sensor will not always give the correct reading but with error in a fashion that the error has a variance. Some sensors might have bigger variance than the other. Trusting only one sensor will put the measurement in a larger range of error. Kalman filter can be used to fuse these two sensors according to their variances, thus producing a smaller margin of error. It can be said that Kalman filter is a statistical filter or stochastic filter.

Besides that, Kalman filter can be used as observer in a system. An observer is a method or algorithm to predict the internal state of a system. For example in a positional - speed - acceleration system, we would need to have three separate sensors to get all three measurements. Trusting only positional sensors to get the speed and acceleration will puts the reading in large margin of error. Therefore Kalman filter can be used to fuse all three sensors according to the variances to obtain readings with smaller margin of error.

But more sensors means higher cost. Therefore, Kalman filter also can be used to observe the internal state that cannot be measured. For example, in the positional - speed - acceleration system, I would only need position and acceleration sensors to obtain the speed of the system, fused statistically. In other words, I can use one sensor to obtain reading of other internal state (that cannot be measured), in a manner that the reading is more accurate. You can Google for an observer called the Luenberger observer, and it can be observed that Kalman observer is more superior than the Luenberger observer.

I think this is too long a post. I will continue on Kalman filter in the next part. In the next part, I would explain on modeling and why it is important to have a model before applying Kalman filter. You might want to read this before hand.

Part I
Part II
Part III
Part IV
Part V
Part VI

1 comment:

Anonymous said...

I will start reading it now :) Hope it will help me.