7

I am working on accelerometer from an android phone. I wish to filter the horrible noise the accelerometer is returning recording the phone's moves.

I was reading around on Kalman filter, because low pass are just not enough.

But I don't have a model of the transition from ACCELERATION(k-1) to ACCELERATION(k) because it is the movements of the user. So I have no state transition matrix (H or F in different papers, the one that multiply Xk-1 in the equation Xk = HXk-1 + Bcommand+noise)

I saw some people taking the identity matrix in simple examples. How can it work for dynamic acceleration?

I know Kalman Filters, people always produce some H matrix, I just don't know how in my case.

Eric Leschinski
  • 146,994
  • 96
  • 417
  • 335
Poutrathor
  • 1,990
  • 2
  • 20
  • 44
  • Why are you doing it yourself? Why don't you use `LINEAR_ACCELERATION` for the SensorManager? – Ali Jan 22 '13 at 19:16
  • The idea is to filter again. I know that google used a kalman filter to create linear_acceleration (they called that the sensors fusion). But the results of linear acceleration are really noisy – Poutrathor Jan 22 '13 at 20:14
  • Really, the `LINEAR_ACCELERATION` is noisy? And where is this noise causing any problem in your application? In other words, what would you like to do with the acceleration? – Ali Jan 22 '13 at 20:16
  • I can upload some graphics if you want but the simple linear movements I am doing ( one meter translation more or less) is barely recognizeable on the graph. But that s not even my question ;) I want to know if I can do a kalman filter without knowing a transition matrix & how? – Poutrathor Jan 22 '13 at 20:21
  • I think you cannot do anything without the transition matrix. I also think that filtering an already filtered signal is not a good idea. That's why I am asking questions, to figure out what you actually need. – Ali Jan 22 '13 at 20:41
  • Yes yes, I understand. But even they know there is a very important amount of noise in their current sensors. It has been say in different occasions and by many persons. I just need a clean signal to double integrate and I know it will nnot work because of the double integration. But it is a project and i have to done it :( It is a lost war but I have to produce something. :((((( – Poutrathor Jan 22 '13 at 20:58
  • No matter what you do, you cannot do the double integral see [my answer](http://stackoverflow.com/a/7835988/341970). – Ali Jan 22 '13 at 21:22
  • Hi, sorry for the delay. Of course, I have already read your answer, do you know it's one of the first aggregation of information one encounters searching for this theme on Google? ;) Thank you by the way to have provide it, I am sure it has helped lot of people. Edit: did not realize that you were _the_ Ali untill you provide the link ^^ – Poutrathor Jan 26 '13 at 11:07
  • Oh, it is such an honour to be *the* Ali :) – Ali Jan 26 '13 at 11:12

4 Answers4

5

Kalman Filter is often thought of as a linear filter where you have all model matrices but the idea of filter and its first applications come from non-linear models. In that case you use functions instead of matrices.

If the functions for prediction and update are highly non-linear you can use statistical methods to estimate your parameters on-line. The first look what you can take is unscented kalman filter which recovers mean and covariance from deterministic sampling technique - unscented transformation. I think in your case this could be the best to start with.

There are other variants of Kalman Filter. You can start from wikipedia but if you google "adaptive kalman filter" you can see the variety of the subject.

If you want to get deeper into the subject but not necessary start with all maths I recommend very good book: Kalman Filter for Beginners to start with by Phil Kim . There are also other possibility as sensor fusion, but it is another broad subject.

tomasz74
  • 16,031
  • 10
  • 37
  • 51
4

You can use the identity matrix.

The state transition matrix is used to predict the future state based on current state, in the absence of any new measurements. In your case, as you say, you do not have any way of predicting future state (acceleration) - so your best guess is that future state (acceleration) is the same as current state. This is exactly what identity matrix does.

In many Kalman filters, there is some way of predicting the future state based on current state, and that's where a non-identity state transition matrix would step in. For example, suppose your Kalman filter estimates vehicle position and speed based on GPS and speedometer; then you could predict future position by changing position based on speed, even without new measurements. Dave's answer shows how to do it using state transition matrix.

Ahti
  • 136
  • 4
2

Given a state vector [x, v_x, a_x], i.e. the position, speed and acceleration of the object in one direction (the same logic applies for the other two degrees of freedom). You usually define the state transition matrix as

1   dt   0.5*dt*dt
0   1    dt
0   0    1

If you write this out you get:

xnew = x+v_x*dt + 0.5*a_x*dt*dt
vnew = v_x + a_x*dt
anew = a_x

These are the equations of motion for an object moving with a constant acceleration.

The way that the unknown user caused motions are handled in the Kalman framework is through the plant noise term. You assume that, instead of continuing on with the exact same acceleration, there are unknown random perturbations to acceleration (and thus to the other components of the state).

Dave
  • 7,555
  • 8
  • 46
  • 88
-1

The thing with kalman filter is that it does prediction and then corrects your prediction based on your observation. If your model is not very dynamic although your model assumes constant position but based on your observation you will get something in between.So Identity could work.