3

I did search but I could not find an answer; When interpreting android accelerometer values, how can one translate these values into real world phone translation along X/Y/Z axes?

I hope it makes sense - I just can't get a grip on exactly how do we get rid of gravity? Do we need to?

I was thinking if we take the magnitude of the 3D vector that is returned by accelerometer - it would be 9.8 or greater, and then we subtract gravity to get the actual acceleration magnitude. But then would the vector returned by the accelerometer event be inaccurate due to motion of the phone + direction of gravity distributed across all 3 axes...

Please help!

Thanks

Kaa
  • 677
  • 6
  • 17

1 Answers1

4

Disclaimer: I do not know any Android specifics, it's likely also handset specific. I merely speaking from a physics background.

You will need to integrate acceleration to velocity, and integrate velocity to displacement (position).

You will suffer from integrational drift. Each time you integrate, an integration constant will be introduced. Multiple integrations compound this error.

You will also need to worry about angular acceleration. ie. What happens when the handset is rotated, but remains in the same physical location?

There are ways to help reduce these sources of error.

If there are multiple accelerometers you can compare them, to try and determine any angular components.

If there are gyro's, you can use the gyro's to help cancel out the angular components.

If the compass is accurate enough, you can try to cancel at least the components in the horizontal plane.

GPS can be used to try and remove displacement integration errors. When the GPS says you are stopped, zero out the integration constants.

You will need to start looking at numerical integration and filtering algorithms. Without hardware acceleration, this could be computationally expensive.

At which point you really need to start asking yourself, does your problem really need precise displacement measurements? Will GPS displacement suffice? Can you achieve the same result with only acceleration?

You should try reading up on:

http://en.wikipedia.org/wiki/Inertial_navigation_system

Dan
  • 552
  • 2
  • 6
  • Thanks! Well, GPS is too broad, I was looking to capture movement within about 1 meter (and that is maximum), probably within enclosed area. Question - if there are 2 forces acting on an accelerometer: my hand moving it, and gravity - how do I interpret the acceleration vector? I can subtract gravity from the magnitude, but I guess I will need to know which way is "down"? Can I do that without additional sensors? P.S. I think I can get away with just the velocity (one integration less), and the accumulated errors aren't a problem at all; I just need rough velocities for movement directions... – Kaa Feb 15 '11 at 16:11
  • Why do you even need to subtract gravity at all? Is your device in free fall when you are trying to measure displacement? If it's not, whatever body it is attached to (your hand, table, pocket) exerts an equal and opposite force; Newton's third law. Edit your original question, and be more specific with what you are trying to accomplish, so we know what you actually need. Accumulated integration errors are the **entire** problem, as soon as you try to derive velocity and displacement. An accelerometer cannot even tell you that you are stopped, only that you are not accelerating. – Dan Feb 16 '11 at 05:43
  • Dan, the acceleration forces acting on the device are distributed across X, Y and Z axes. If it is only gravity acting on the device and it sits on the table - the Z axis reports the pull of gravity. If I slide the phone to the side - the X, Y, and Z vector representing acceleration will have a higher magnitude, but the direction vector for the forces will be interpolated between gravity and the force of my hand. That makes it difficult to get the direction of acceleration, especially that gravity can act on any axis (depending on phone's orientation). Hence, I want gravity gone from equation. – Kaa Feb 16 '11 at 15:12
  • Frankly, Dan, I think I am asking something that is impossible. There is no way to distinguish gravity from other forces acting on the device given just the vector of acceleration. I think I may need to look for alternative methods of accomplishing what I want to do.. Thanks for help! – Kaa Feb 16 '11 at 15:17
  • The best you can do without other sensors to help, is make the assumption that the device will remain in a relatively fixed orientation while moving. When you determine the device is 'not moving', you zero-out the accelerometer data. Simply record the XYZ components, and continue subtracting them from all subsequent readings, until you decide you are 'not-moving' again, and repeat. You will need to determine what 'not-moving' is, because it's not clear how you plan to use velocity/displacement. (ie moving car, moving earth, moving solar system, moving galaxy, expanding space/universe) ...contd – Dan Feb 17 '11 at 05:56
  • contd... Assuming you will never need velocity/displacement the most common way of determining 'not-moving' is combining two factors: 1) when the accelerometer data remains constant for a period of time. 2) the magnitude of the un-zeroed accelerometer data remains at 1g for a period of time. You will need to account for noise margins in accelerometer data. Both factors need to be satisfied, to try and narrow out the device orientation rotation scenario. – Dan Feb 17 '11 at 06:08
  • I would guess that most android devices also have a gyroscope sensor, I know mine does. You can use this sensor to determine the directional component of the gravity vector and use the constant magnitude of GRAVITY_EARTH to convert the accelerometer's 'proper acceleration' vector into a 'coordinate acceleration' vector. I'm surprised the SDK doesn't offer a function to do this for you as this is what nearly everyone using that sensor would want. – Charlie Mar 03 '11 at 07:11
  • This might be of interest: http://www.instructables.com/id/Accelerometer-Gyro-Tutorial/ – Charlie Mar 03 '11 at 07:18