How to interpret iPhone accelerometer readings

I am trying to create an application based on Kinect and iPhone.

I am trying to calculate the acceleration of my hands over time on each XY and Z axis based on the path returned by kinect. Basically, I choose a standard time interval of 0.5 seconds or 15 frames ( dt ) and 3 points ( x0 , x1 and x2 ) with time, which are divided into 0.5 seconds. First, I must mention that the position of the three points is mentioned in meters. Using these points, I calculate two speeds ( v0 = (x1 - x0) / dt and v1 = (x2 - x1) / dt ). Finally, using these speeds, I calculate the acceleration between x1 and x2 as acc = (v1 - v0) / dt .

I repeat these calculations in each frame and get an array of accelerations.

As I said, I also have an iPhone, and I want to see in which hand I have my iPhone, left or right hand. I want to do this, trying to match the accelerations of my hand with the accelerations of the iPhone held in the right position so that I have the same axis system.

The only problem is that there is a huge difference between my speedups and the speedups of my phone.

The acceelaration of the phone is somewhere between -2 and 2 for each axis, while mine is between -10 and 10. How to interpret the acceleration of the iPhone to get similar measures for the mine in meters / seconds?

+6
source share
1 answer

Accelerometer data on the iPhone is presented in g-force units. The x axis is aligned with the top edge of the screen of your phone, the y axis is aligned with the left edge, and the z axis goes straight from the screen towards you if you look at it. Therefore, when your phone is standing on the table face up, you should get the values (0, 0, -1) for the x, y and z axes, respectively. If you drop your phone while it is in free fall, you should receive (0, 0, 0) .

Assuming you hold the phone the same as when moving to get three-dimensional acceleration in meters per second squared:

 - (void)accelerometer:(UIAccelerometer*)accelerometer didAccelerate:(UIAcceleration*)acceleration { float g = 9.80665f; float x = acceleration.x * g; float y = acceleration.y * g; float z = (acceleration.z + 1.0f) * g; // x, y, and z now hold the absolute acceleration in ms^-2 } 

Please note that you must subtract the effect of Earth's gravity to get acceleration relative to your living room, and not relative to 4-dimensional space-time.

Also keep in mind that the iPhone’s accelerometer is quite noisy and these values ​​tremble even when the phone is static, so you'll want to apply some anti-aliasing. However, if you use a similar technique for what you seem to be doing with the position data by placing the values ​​in an array every frame to get a moving average over the last 0.5 seconds, this will smooth out the data for you.

Another thing to be aware of is that the iPhone’s accelerometer peaks around 2.3 g. These g-forces are not easy to achieve (for example, if you clap your hands) so that you can exceed them, and the methods that accumulate data will not be very reliable.

+2
source

Source: https://habr.com/ru/post/915166/


All Articles