12-25-2013 11:14 PM - edited 12-25-2013 11:37 PM
I am starting initial experimentation for a new app, and this one will use several sensors, including the accelerometer. This sensor has significant jitter, even at perfect rest. so I am looking at ways to minimize this.
The accelerometer class has a skipDuplicates property, that when set to true not only doesn't report subsequent identical readings, but also similar readings, providing a measure of jitter reduction. The problem is this setting is too heavy-handed for my needs. Enabling it means that you have to change the device orientation in fairly large steps before the sensor reports any change.
I am considering using a sliding window average to smooth out the jitter. This way every reading is obtained from the sensor and inserted into a queue, then a fixed number of previous readings (say 10 or 100) are averaged with the new one, and the average value is used rather than the latest. This way instantaneous jitter is swamped out by the weight of the previous 10 or 100 readings.
Alternately the raw readings could be fed to a digital low-pass filter to achieve a similar effect. My question is, has anyone else wrestled with this question and come up with a better solution?
EDIT: I referred to this problem as "jitter" because I found several posts and articles online that described it thus, but it occurred to me that calling this jitter is not really correct, the artifact that needs cleaning is more correctly described as "noise" so this is really a case of noise reduction.
12-26-2013 04:14 AM - edited 12-26-2013 04:24 AM
Try holding your hand steadier.
Sorry, couldn't resist, not my area of expertise however your 2nd approach looks good as long as you can accept the small loss in reaction time and accuracy that obviously comes from this approach.
... and if you can accept the above then have you experimented with just slowing down the reading anyway, say 1 out of 10 or 100.
12-26-2013 11:24 AM
@BBSJdev...I know your first line was a joke, but I do want to point out to other readers that the accelerometer turns out to be very noisy, and even sitting it stationary on a hard surface will produce readings that look like it is jumping slightly in all dimensions. (well, maybe not temporal.)
Regarding your final suggestion, the problem with just sampling less often is that the values will still jump all over the place even when stationary, you'll just get less frequent updates. Intuitively I'm leaning to the "sliding window average" approach since the fluctuations are all centred around the "correct" value and averaging should smooth them out. I'm going to test it and report back on the result, but I was hoping somebody might have done this before and save me from going down a blind alley (or two).
Hope you had a great Christmas.