Page 1 of 1

Kalman Filter

PostPosted: Sat Nov 12, 2011 10:19 am
by RichardW
Hello,

I´m interested in Learning all about Kalman Filters. So I have had a look at your C-Code. I think I understood the basics about Kalman.

In your code you set the covariance matrix like this
static float P[2][2] = {
{ 1, 0 },
{ 0, 1 },
};


also the measurement noise and the process noise
/*
* R represents the measurement covariance noise. In this case,
* it is a 1x1 matrix that says that we expect 0.3 rad jitter
* from the accelerometer.
*/
static const float R_angle = 0.3;


/*
* Q is a 2x2 matrix that represents the process covariance noise.
* In this case, it indicates how much we trust the acceleromter
* relative to the gyros.
*/
static const float Q_angle = 0.001;
static const float Q_gyro = 0.003;


I have some problems with understanding that. Why these values? How did you get them?
My problem is not understanding the code. I don´t know how to determine these values in my system. Also the state vector and the covariance matrix.

Is there any good tutorial where I get the knowledge of that.

Hope I could tell my problemm clearly.

Thanks

Richard

Re: Kalman Filter

PostPosted: Sun Nov 13, 2011 5:55 pm
by Tom
Hi Richard,

Unfortunately I don't have a magic solution. Calculating those values was never a success. I determined them by trial and error.
What is important to know is that in this case only the proportion between both variables is important. I would propose to change it by a factor of 10 until your result is satifying.

Re: Kalman Filter

PostPosted: Sun Nov 13, 2011 7:02 pm
by RichardW
Hello Tom,

thanks for your answer. I thought they were calculated. So I will play a little bit with my values.

I read in several communities that you have written a very goot tutorial for understanding Kalman Filters.
Where is it possible to get?

Thanks

Richard

Re: Kalman Filter

PostPosted: Tue Nov 15, 2011 9:56 pm
by RedSun
RichardW wrote:I´m interested in Learning all about Kalman Filters.

I have some problems with understanding that. Why these values? How did you get them?
My problem is not understanding the code. I don´t know how to determine these values in my system. Also the state vector and the covariance matrix.


Hi, Richard !

What is Kalman filtering ? Very-very simple explanation of it is the mathematical simulation of studied object. We measure the input (with some possible errors), we measure the output (with errors too), we know the dynamics of the object (math model of this object with estimated coefficients). We calculate future behavior of the object looking at its current state and measured input. We compare our forecast with measured output. We estimate real object state. We clarify the next step of our simulation.
There are two Kalman-linked tasks: simple Kalman Filtering and full Kalman system estimation. Simple filtering is an estimation of system state coordinates using previously tuned filter (i.e. apriori estimated object coefficients). Full Kalman system estimation adds to a simple filtering another task - an estimation of object coefficients. Kalman estimation is a very computing-consuming task, it grows as a power of 5 of object's complexity. Microcontroller-based autopilot usually cannot solve full Kalman task...

Sorry for bad English, my native language is C++ :-)

Re: Kalman Filter

PostPosted: Fri Feb 10, 2012 6:50 am
by PabloMajid
The Kalman filtering technique rapidly developed in recent decades.