# Help with understanding kalman filter

1. Jun 8, 2010

### rp181

I am trying to implement a kalman for use in sensor data fusion, for 3 axis accelerometers, 3 axis gyros, and 3 axis magnetometers for a helicopter UAV project.
The roll, pitch, and yaw need to be known. Gyros do a great job of doing this, but the problem is that they drift of the zero value. Accelerometers are used to correct the roll and pitch values as they don't drift, and a magnetometer corrects yaw based on the magnetic north reference point.
Kalman filters are the most effective way to combine these. There are simpler ways such as a PID loop, but helicopters are very complex, and I do not want to take a chance.
My math is not nearly good enough to go and code a kalman filter, but I found kfilter:
http://kalman.sourceforge.net/doc/example.html
I have some questions in using this.
1) What is the difference between the state vector and measure vector? Is measure what the sensor data shows and state the current position?
2) What does the subscript 'k' represent?
3)what does 'x' with the two dots over it mean? What about the single dot?
4) In the link I posted, in this equation:

where does the part before the parenthesis come from? Why are there two for x and two for y?

Any advice on how to use this in this application/ broken down steps is welcome.

2. Jun 8, 2010

### Staff: Mentor

Welcome to the PF.

It looks like there are a number of fundamental math subjects that you would have to learn before attempting this project. Is there a simpler project that you could do, that is more in line with your math abilities at the moment?

I'm not that familiar with Kalman filters, but it looks to be for discrete time systems (the "k" values are the sample numbers, I would think), and the dot notation refers to differentiation in Calculus. Have you had Calculus yet? How about digital filters? Those would seem to be prerequisite courses for tackling this UAV control project....

3. Jun 8, 2010

### rp181

Hey,
The filter is models a continuous time model, but yes, it is discrete to enable coding for it.

Calculus next year. I was hoping the libraries would eliminate some of the math clearly out of my understanding.

Right now, I am going to take a look at Directional Cosine Matrices, I am able to understand the math for that, so I am going to put a hold on the kalman filter.

BTW, if you are interested, project progress is here:
http://rp181.fortscribe.com [Broken]

Last edited by a moderator: May 4, 2017
4. Jun 8, 2010

### D H

Staff Emeritus
To be brutally honest, a Kalman filter is well beyond what someone who has yet to take calculus. You need to know calculus plus real analysis, probability theory, signal processing, and control theory to understand how Kalman filters work. You need to learn to walk before you learn to run.

5. Jun 8, 2010

### thrillhouse86

I certainly agree with DH - that Kalman filters are far too complex for someone who has not taken a calculus course. Out of interest though - whats the real analysis needed for Kalman filters ?

6. Aug 9, 2011

### Bryan790

i agree. without a special course,you cannot get a basic understanding of Kalman Filtering and assumptions. tutorials do not always work.

7. Aug 9, 2011

### Stephen Tashi

Yes
The material treats the process as having discrete steps. 'k' refers to the k th step.
The acceleration in the x coordinate
The velocity in the x coordinate
I think the 'T' is the elapsed time between two consecutive steps. The expressions in the matrix look like truncated Taylor expansions that give the coordinates of the k th step in terms of data for the previous step. A Taylor expansion (in this case) would be a power series in the variable 'T' so it it weren't truncated, it would have all the integer powers of T in it.

The other posters are correct about that fact that it would take considerable study to understand the Kalman filter. I've looked at the so-called simple tutorials about it on the web and never had the patience to slog my way through them, so I can't recommend any. However, you seem to have an unreasonable amount of ambition. Don't give up yet.