Hi everybody on stackoverflow.
SHORT VERSION :)
I need to use (x,y,z) acceleration values related only to the movement of the iPhone. Just to be clear, think an environment like a car. The iPhone's accelerometer is very sensitive. If I log acceleration values with a frequency of 100Hz, there are so many values related to noise, car vibrations and other acceleration vectors which are not directed like the iPhone motion (for example, dampers oscillations cause acceleration vectors directed along z-axis).
In other words, I need to filter accelerations detection in a way capable to isolate accelerations whose direction is the same (within a certain offset) of the motion direction.
DEEPER CONSIDERATIONS :'(
Obviously, I could fix the iphone position so that its y axis overlaps the movement direction (in the previous car environment, this means fixing the iphone y axis parallel to the front direction). The problem is that I need to allow iphone's relative moments. I can't fix the iphone position.
First of all I analyzed values produced by noise and oscillations, and I figured out that their magnitude is often very higher than normal car accelerations. Filtering the magnitude is a good idea to ease the problem but it's not a solution: on one side many unwanted noise accelerations are not filtered because their magnitude falls within the range, on the other side many wanted motion accelerations are filtered because they falls outside the range.
On the iPhone 3GS I can use the magnetometer to measure degrees heading relative to magnetic North. I could use this to find the direction of motion but the problem is still there: magneticHeading value is always measured relative to the top of the device. So the iPhone should be fixed along the front direction.
I can't think any other solution. Ideas? Tank you!