Ok, so suppose I've got a phone with gyroscope, compass and 3-d accelerometer. I wanted to track position of the moving phone for about 1 minute with let's say 50 mm accuracy. Actually let's say that I wan't to create some sort of pedometer. Is this possible?

I already know that the signal from accelerometer is too noisy to calculate position through double integration after really small amounts of time because of the giant drift.

But I want to know if it's possible with some domain knowledge using Kalman filter? So in my case I know that the phone would be in the users hand and it wouldn't accelerate more than some amount X m/s^2 and that velocity wouldn't be more than some V m/s and so on. Would that be possible in that case?

Also how to create covariation matrix for the accelerometer, gyroscope and compass?


2 Answers 2


The quick answer is that its not really possible to get the position information from a phone IMU with gyroscope, compass and accelerometer. Even with a Kalman filter its too unreliable to get any linear acceleration signal that can be integrated to give position. I have looked at a lot of Kalman filter papers for IMUs and at best, the linear acceleration is treated as a nuisance term. The three sensor IMU with Kalman filter does however give pretty solid 3D rotation estimates.

  • $\begingroup$ Perhaps you right. What I don't understand is how the pedometer in my android wear watch works then? $\endgroup$ Jul 19, 2014 at 11:55
  • $\begingroup$ @user1685095 a pedometer does not measure distance traveled (at least not in mm accuracy). It tries to relieably detect a step motion; and then it counts those steps, and multiplies that with the average step length... A smart phone can also use GPS data to predict the actual displacement during the overall motion... $\endgroup$
    – Fat32
    Feb 1, 2021 at 18:29

As you stated, bayesian filtering won't yield good results because of the noise's double integration.

It is perfectly possible to include an a priori within you bayesian filter, e.g. says that it is very unlikely that acceleration goes beyond a given thresold.

Implementation would be a bit more tedious because if you want to stick with a kalman filter, which is much more simple than a more general bayesian filter (particles fitlers etc...) you'll have to state your a priori with guassian pdf's.

To create your sensors covariance matrix you'll have to know their precision. This is trivial for the practioner but I don't go any further into details becuase this isn't the point I want to make :

The pedometer use a different framework, it doesn't estimate your position using bayesian filtering, but try to detect each step you make using accelerometer data, and just say "x steps has been made" and doesn't know your position.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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