I have the following scenario: an iPhone is connected to a vertical rail (it's motion is restricted to the Y axis). Through mechanical means the phone is forced upwards and then allowed to return to rest. The distance varies (anywhere from 6" to 24"). The total time required for the full trip is roughly 1 - 2 seconds. The goal is to estimate the distance the device travels.
I have read through both:
Calculation of Distance from measured Acceleration vs Time
Getting position from an accelerometer on an Android phone
(although I must admit that it is been years since I've had to deal directly with these topics)
Currently I am collecting acceleration data (along the Y axis) and use the following to estimate the integral of acceleration and velocity (via Excel):
1 Time [A] Acceleration [B] Velocity [C] Distance [D]
2 0 a(z) 0 0
3 1 a(z) =C2+(A3-A2)*(B2+B3)/2 =D2+(A3-A2)*(C2+C3)/2
4 2 a(z) =C3+(A4-A3)*(B3+B4)/2 =D3+(A4-A3)*(C3+C4)/2
5 3 a(z) =C4+(A5-A4)*(B4+B5)/2 =D4+(A5-A4)*(C4+C5)/2
6 4 a(z) =C5+(A6-A5)*(B5+B6)/2 =D5+(A6-A5)*(C5+C6)/2
7 5 a(z) =C6+(A7-A6)*(B6+B7)/2 =D6+(A7-A6)*(C6+C7)/2
8 6 a(z) =C7+(A8-A7)*(B7+B8)/2 =D7+(A8-A7)*(C7+C8)/2
9 7 a(z) =C8+(A9-A8)*(B8+B9)/2 =D8+(A9-A8)*(C8+C9)/2
10 8 a(z) =C9+(A10-A9)*(B9+B10)/2 =D9+(A10-A9)*(C9+C10)/2
11 9 a(z) =C10+(A11-A10)*(B10+B11)/2 =D10+(A11-A100)*(C10+C11)/2
12 10 a(z) =C11+(A12-A11)*(B11+B12)/2 =D11+(A12-A11)*(C11+C12)/2
... ... ... ...
Here is a sample of my data: test_data_1.csv
If the units of acceleration are measured in G's (9.8 m/s^2) what are the resulting units of velocity and distance?
This is what a plot of my data looks like - it really doesn't make sense to me (which isn't surprising since I don't have much experience in these areas). Again, the goal is to come up with a distance estimate (it doesn't have to be perfect).
Any pointers/clarifications would be much appreciated.
CMAccelerometerData#acceleration
orCMDeviceMotion#userAcceleration
to get the acceleration value? Because the former is proper acceleration, a vector sum of G and the familiardv/dt
acceleration. $\endgroup$CMAccelerometerData#acceleration
- is that what you suggest I use? $\endgroup$startDeviceMotionUpdates
, andCMDeviceMotion#userAcceleration
- see the overview on this page. Basically the API filters out gravity and providesdv/dt
for you. $\endgroup$