Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kalman Filter for iOS

I am trying to get smooth rssi value from Bluetooth low energy beacons deployed at ceiling of my lab. I used Weighted-mean filter and moving average filter but couldn't get good result. Through various journal papers I got to know that Kalman filter can be used for this purpose. But I couldn't get a proper mathematical equation to code with objective-c. Can somebody provide any hint regarding mathematical equation or Kalman filter implementation?Thanks a lot.

like image 298
santobedi Avatar asked Mar 05 '15 06:03

santobedi


Video Answer


2 Answers

A one-dimensional case like this means that all of the matrices are actually just scalar values. You need to know two things:

  1. R, the measurement variance. You can directly measure this by recording a series of RSSI values (in a fixed location) exactly how you would normally and then measuring their variance. You can do this easily with Excel, or python, or even write your own code from scratch.
  2. Q, the process variance. This is how much you expect RSSI to actually change in the same amount of time (between measurements). You can also measure this, or you can reason about it.

If you look at the Kalman Filter equations you'll notice that P is not dependent on your actual measurements, only the two values above. As a result, since they are constant, P will converge to a fixed value. And since K (the Kalman gain) only relies on those values, it will also converge. For an application like yours, it is usually sufficient to find the steady-state K and use it all the time.

This is now just a complicated (but optimal in a least-squares sense) way of creating a simple moving average filter.

like image 76
Ben Jackson Avatar answered Oct 02 '22 06:10

Ben Jackson


If you are looking for a swift implementation of Kalman Filter, then it is worth looking at this framework. It is a generic implementation of conventional filter algorithm and it also provides a Matrix struct and all the necessary operations on Matrices that are used in Kalman filter

like image 30
Noobass Avatar answered Oct 02 '22 08:10

Noobass