On 18.06.2008 00:44, Andy Green wrote: > So if the "selfselection" of samples from the firehose don't make it a > nonsense to look at it this way, it means we get excursions in the first > coordinate of up to +/- 20% at about 10% probability. > > What we could do is refuse to accept samples too far outside a running > average into the average reported back to userspace....
Beware of that approach. While it would be doable, it is certainly not always obvious how to do it correctly. If the stylus is moved too fast, all new samples will be outside the cleaned running average. So if you compare against the cleaned running average, fast movements will result in a hang of the fast-moving axis. If you compare against the uncleaned running average, similar stuff can happen and some really strong measurement errors will hang the axis with the errors. Having a log at high speed without discarded values would help finding a pattern. The results you posted look like using the median every 5 samples with 5 times the normal sample rate should give you pretty good input for your averaging function. That depends on the following error characteristic, though: There may be no more than 2 too-high and no more than 2 too-low samples in any given 5 subsequent samples. Best case of that function is giving correct output in the presence of up to 80% jittered samples, worst case is correct output up to 40% jittered samples. Added benefit is instant answer to sudden movements of the stylus. Finding the median of n samples is more expensive than averaging, though. Regards, Carl-Daniel
