views:

1471

answers:

10

During the free fall the iphone is supposed to send acceleration values as 0 on all the three axis. So how to detect the distance covered by the iphone?

+1  A: 

Ignoring air drag:

float t; // time since drop
float distance = 9.81f * 0.5f * t * t;

For greater distance (drop from airplane) you also could use the location services. CLLocation contains an altitude.

Nikolai Ruhe
No, in free fall terminal velocity has been reached - acceleration is zero, not g.
David M
I read the question like: "How deep did my iPhone fell since i dropped it?"
Nikolai Ruhe
During free fall in air, when terminal velocity has been reached, acceleration is not zero but g.
Nikolai Ruhe
You're both right: the phone will moving at a constant velocity, so not accelerating, but the accelerometer will read g, as if it were lying on a table.
pjc50
If you calculate the magnitude of acceleration reported from the phone, and subtract it from g, that should give the actual acceleration. At rest, the accelerometer reads 9.8 m/s/s, in free-fall, 0.0. As you approach terminal velocity, the reported acceleration should increase slowly to 9.8 m/s/s, so integrating the difference between reported acceleration and g should give you proper acceleration. Of course your choice of filtering and integration formulas will be pretty important.
Mark Bessey
A: 

distance = 0.5 * gravityAcceleration * timeOfFall2

In the simplest form.

We can safely omit air friction and wind, given iPhone's form factor and weight as well as the distances which hardware will still be useful when falling from. ;)

However, if you're going with the phone into a free fall before opening a parachute, there are too many factors to count in to reliably calculate the distance, based on accelerometer itself. It is probably not suited for such applications anyway, as the readings are very unstable and its main purpose is to determine device's orientation or detect a potential free fall (in case of notebooks where similar accelerometer chips are used).

macbirdie
+2  A: 

If your accelerometers are reporting zero, then you have the problem of determining when your motion has completed.

So determine the deceleration upon impact, then determine the maximum speed at the beginning of deceleration, then work backwards from this. Assuming linear movement, the absence of terminal velocity and air resistance, linear deceleration (perhaps), and that your phone still works!

Brian Agnew
I think the maximum acceleration reported from UIAcceleration is way too low for this method to work. A drop of 1 meter will probably generate tens to hundreds of G's, depending on how hard of a surface the iPhone comes to rest against.
Mark Bessey
Max is just over 2 Gs. So this wont work at all.
Blankasaurus
+2  A: 

From a standing start

distance = 0.5 x acceleration x time2

Gravitational acceleration = 9.81 m/s2

I'm going to assume you're not dropping the phone far enough to reach terminal velocity. If you do, I doubt your app will be of much use when you recover the phone :)

Paul Dixon
If you install the acceleromoter test app which graphs the output, you can have fun throwing the phone around to test this :)
Paul Dixon
It doesn't have to reach terminal velocity for drag to become significant
finnw
For any distances that are likely "survivable" by the phone, this is a good first order approximation. Drag will be a factor, but given the difficulty of the calculation (relative freestream velocity, the orientation of the iphone relative to the incoming freestream, etc, etc) it is probably best left out.
semiuseless
How is drag a factor? Won't the acceleration due to drag be measured by the accelerometer?
Doug McClean
A: 

This is very simplistic, because you have to account for air friction. Air friction causes the device to reach "a" terminal velocity. Only at terminal velocity will the accellerometer indicate 0.

The formulas given here assume a free fall in a void (no friction).

In other words, it's pretty complicated to calculate the distance travelled (one problem is that terminal velocity depends on the orientation of the phone while falling).

Philippe Leybaert
The accellerometer will not indicate 0 at terminal velocity but the gravitational acceleration.
Nikolai Ruhe
I don't know how the iPhone's accelerometer works (or how it's calibrated). If it returns the gravitational acceleration when holding it perfectly still, then you're right).
Philippe Leybaert
+2  A: 

The most simple and naive implementation is to sample the accelerometerdata and use the following formula.

v+=a*dt;
d+=v*dt;

But this is can give drift over time, read this for explanation why and a better solution: http://gafferongames.com/game-physics/integration-basics/

+1  A: 

One solution that would take into account the issue of wind resistance is you could use the difference between acceleration from gravity and your actual norm of acceleration you're reading,

d2x / dt2 = g - |a|

Where g = 9.8 and |a| = sqrt(a12 + a22 + a32) where an are the readings from the accellerometer on each axis.

Then solve the differential equation numerically, with something like Euler's Method.

You could even be clever and lookup local value of g using GPS.

Jeff Mc
A: 

The accelerometer will read 0 (or g) on all 3 axis whether it is in freefall or sitting on a table. Therefore the question is moot, since there is no way to determine the distance without making the assumption of freefall.

Nick Coats
Wrong. The accelerometer measures 1 downwards when on the table, and zero when in freefall.
Rhythmic Fistman
+7  A: 

Do not trust Newton laws, they ignore air drag, Iphone rotation etc. Use empirical approach instead. Let the device fall from several heights like 1m, 2m, 5m, 10m, 30m... Repeat several times for each height. In each fall measure time. Approximate results by spline. Compute inverse function.

danatel
+1 I like this answer. Plot a point cloud using different heights and different angles when dropped, rotating slow, fast, and not rotating. Then come up with a nice approximation spline.
Neil N
And don't test this on my iPhone.
David Thornley
A: 

Also keep in mind that the phone is VERY likely to be tumbling in any sort of falling scenario. As the phone's profile changes, the drag will change, and the accelerometer will NOT be reading zero.

mmc