I am trying to write a simple app that calculates velocity based on the
current acceleration (between sampling times).

I have no problem obtaining the device's acceleration from the
accelerometer, nor calculating the velocity based on the reading.

My question has to do with how to compensate for the fact that gravity (or
the normal to gravity) is always part of the force exerted on the device.

In other words if we were in space (or in microgravity), the device would
have 0 acceleration on each axis when at rest. Moving the device, would show
the corresponding acceleration and thus a simple calculation would derive
the velocity.

I read something about a Kalman filter to either low-pass or high-pass
filter the change of acceleration.

The only conclusion from that information was to use a high-pass filter to
recognize the gravity vector then subtract that vector from the total
acceleration vector.

Does anyone have any sample code that shows how to account for gravity to
obtain the net acceleration vector (once gravity is removed)?

Maybe I am looking at this from the wrong reference frame.

Should I instead use the GPS to obtain locations and calculate an average
velocity based on distance over time?

Maybe a combination of both?

TIA


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to