Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Speed based on accelerometer values

Tags:

java

android

I need to obtain the velocity of an android device, based on the accelerometer values. I made a code that allows me to get the accelerometer values, and then I calculate the velocity, using the formula: v = v0 + at. (vector calculation)

My problem is that my velocity only increases and never decreases. I think the problem is that the device never gets an negative acceleration.

Can you help me with this?

like image 783
nunolourenco Avatar asked Apr 19 '10 23:04

nunolourenco


People also ask

Can you calculate speed from accelerometer?

No, accelerometer can sense only the change of the speed. It can't physically detect absolute speed. The most you can do it is to integrate the acceleration from a point where the speed was known. Some time after the speed was known you will have updated speed value.

What do XY and Z mean on an accelerometer?

The X axis is parallel with the device's screen, aligned with the top and bottom edges, in the left-right direction. The Y axis is parallel with the device's screen, aligned with the left and right edges, in the top-bottom direction. The Z axis is perpendicular to the device's screen, pointing up.

What is accelerometer G value?

For example, an accelerometer at rest on the surface of the Earth will measure an acceleration due to Earth's gravity, straight upwards (by definition) of g ≈ 9.81 m/s2. By contrast, accelerometers in free fall (falling toward the center of the Earth at a rate of about 9.81 m/s2) will measure zero.


1 Answers

Obtaining velocity from the accelerometers might not be possible (forget reliable) because at constant speed there will be no acceleration (other than gravity). You might be better off obtaining GPS location data and their associated time samples and computing velocity by distance over time.

like image 183
maerics Avatar answered Sep 22 '22 00:09

maerics