I have read that one of the uses of the Kaman filter is to refine the noisy sensor measurements. I am using an accelerometer to get the position by integration and want to use Kaman filter to refine the readings. I know that the Kalman filter can be used in sensor fusion, but what are the steps when only one sensor is available and the physical model of the moving object is not available (the force or u vector is unpredictable).


but what are the steps when only one sensor is available and the physical model of the moving object is not available

Then it's not a Kalman filter.

A Kalman filter works because the system is observable. In hand-wavy terms, you need to have redundant information about your system states, either because you have actual redundant inputs, or because you have an adequate* model of the system dynamics, and you're watching the system output over time. If you can't do those two things somehow, then you don't have the prerequisites for a Kalman filter.

Taking GPS/IMU fusion as an example, your design process can be completely naive about the actual plant dynamics because you can model the plant as a rigid lump of stuff that takes rotation rates and accelerations as inputs, and gives geolocation as outputs. Your model has states for position, velocity, and orientation, and because you're constantly correcting these against the GPS readings, you can get a pretty darned accurate estimate** of the states.

As another example -- and possibly as an inspiration for you -- I'm very slowly developing a Kalman filter for the motion of an object that's constrained to a 2-sphere (in less hoity-toity mathematics, that's the surface of a sphere in 3-dimensional space). Because we have gravity, it'll know "down"; as soon as the object turns on the sphere it'll know its altitude -- but it'll never know the compass direction***.

So -- if you can somehow come up with redundant information, then you can possibly come up with a true Kalman filter. This redundancy can be as tenuous as the one I'm using in my second example, where the fact that the object is always a fixed distance from a point tells me a lot. It could be something like a button on an app that says "ok, Phone, I promise that I'm holding you still" -- I'm pretty sure that with a 6-degree of freedom IMU you could measure horizontal and vertical distances that way (i.e., you could make a tape measure app), but I doubt you could do more.

* What is adequate? Enough to make the system observable. Which is a circular definition within the context of this answer, because it would take too much space to explain. It's a concept that you'll find about two weeks into a senior/graduate class in state-space control systems. The bottom line for this answer is that it's a property of the system model -- and you don't have one of those.

** Assuming you have a rich enough motion profile -- in order to get good orientation information, the system needs to see varying acceleration, and the corresponding changes in position. Such a system, if it was bolted to a rock, would be able to estimate position, velocity, and "down" very well, but unless it had gyros with errors significantly smaller than the Earth's rotation speed it wouldn't be able to tell you North and East.

*** Unless I use magnetometers, or get that really good gyro I mention above.

  • $\begingroup$ I think this is the case when Kaman filters are used for fusion. Other than fusion aren't there any applications where Kalman is used for obtaining better sensor results assuming noisy sensors and known error covariance?. if you read (core.ac.uk/download/pdf/20641186.pdf) they mention that they model the sensor offset and error to obtain a filtered signal but it's not quite clear how they did it. $\endgroup$ – M.Saeed Dec 24 '19 at 22:47
  • $\begingroup$ I didn't go over the whole paper, but certainly for section 3.2.1 and 3.2.2, the properties of the signal are known, and are used to make a state-space model that can then be used in a Kalman filter. $\endgroup$ – TimWescott Dec 24 '19 at 23:22
  • $\begingroup$ Kalman filters do not require redundant/multiple sensors to work, the only requirement is that the sensor(s) that is/are used make the system observable. However, more sensors do make the Kalman filter better (assuming that the model also includes the noises acting on the system and that those noises are approximately zero mean Gaussian white noise). $\endgroup$ – fibonatic Dec 25 '19 at 10:44
  • 1
    $\begingroup$ @fibonatic True. You inspired me to change an "and" to an "or" and to give a hand-wavy definition of observability. Frankly, I don't hold out much hope for someone to make a Kalman filter work until they've learned state-space control, but it certainly seems to be a popular thing to try. $\endgroup$ – TimWescott Dec 25 '19 at 20:20

I have found how to filter a signal using kalman filter in this repo : SimpleKalmanFilter!.

That is the perfect library for 1D kalman filter that I was looking for. One can also get valuable info. in this article https://www.kalmanfilter.net/kalman1d.html


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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