AndersMalmgren/FreePIE — pull request #24 by svofski (2014-05-25 10:20:40+00:00)
Title: Support for gyroscope-less Android phones

Hi - thank you for awesome project and for making it open source!

I played around with an old HTC Desire phone and found out that Android IMU is not compatible with it because it's lacking a gyroscope. I started to make minute changes to accomodate for that but in the end I decided to do some refactoring to enable various data producers for various sets of sensors.

Specifically for HTC Desire I implemented a producer that obtains orientation from magnetometer and accelerometer alone. Because those two sensors are extremely noisy, I changed the approach from what was used in the original. I sample data at regular frequency regardless of sensor updates, which may come at completely random intervals, and pass data through a set of low-pass filters.

This can be taxing on the network and battery life, but the results can be very smooth. For example, when setting cutoff frequency to 0.5..1 Hz, the reaction time is not for an action shooter, but excellent for scenic views. I've been mostly debugging with X3: Albion Prelude which has builtin FreeTrack support.

This is probably not the best way to implement filtering. I realize that the host side is probably the more appropriate location for data processing. I'm just more familiar with Android development so it was easier for me to fix things on that side. Anyway, here's a patch for your consideration ;)