如何解释从iPhone的加速度计读数 [英] How to interpret the accelerometer readings from iPhone

查看:150
本文介绍了如何解释从iPhone的加速度计读数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个基于Kinect和iPhone应用程序。

I am trying to build a Kinect and iPhone based application.

我试图计算我手中的加速随着时间的推移在每个XY轴和Z轴的基于由的kinect返回的轨迹。基本上我选择0.5秒或15帧的标准时间间隔( DT )和3点( X0 X1 X2 ),在它们减少了0.5秒的时间separeted。首先我要指出,在3点的位置在米被提及。通过使用这些点,我计算两个速度( V0 =(X1 - X0)/ DT V1 =(X2 - X1)/ DT )。最后,通过使用这个速度,我计算 X1 X2 ACC之间的加速=(V1 - V0)。/ DT

I am trying to compute the acceleration of my hands over time on each of the X Y and Z axis based on the trajectory returned by the kinect. Basically I am selecting a standard time interval of 0.5 seconds or 15 frames( dt ) and 3 points, ( x0, x1 and x2 ) over time which are separeted by 0.5 seconds. First I should mention that the position of the 3 points is mentioned in meters. By using these points I am computing two speeds(v0 = (x1 - x0) / dt and v1 = (x2 - x1) / dt). Finally, by using these speeds, I am computing the acceleration between x1 and x2 as acc = (v1 - v0) / dt.

我重复这些计算在每一帧,我获得加速度的数组

I repeat these computation at each frame and I obtain an array of accelerations.

我已经说过了,我也有一个iPhone,我希望看到哪只手,我有我的iPhone,左手还是右手。我想试图通过我的手的加速度与iPhone的在正确的位置,使我有同样的轴系统拥有的加速度匹配做到这一点。

As I've said, I have also an iPhone and I want to see in which hand I have my iPhone, left hand or right hand. I want to do this by 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 accelerations and the accelerations of the phone.

电话acceelaration读数地方-2和2对各轴之间,而我的是-10到10之间,我应该如何解读iPhone的加速度,以获得类似的措施米/秒?

The phone acceelaration readings are somewhere between -2 and 2 for each axis, whereas mine are between -10 and 10. How should I interpret the iPhone accelerations in order to obtain similar measures to mine in meter / seconds ?

推荐答案

的加速度计数据中的G力单位提供。 x轴与手机屏幕的顶部边缘对齐,y轴与左边缘对齐,Z轴来直出对你的画面,如果你正在寻找它。因此,与您的手机搁在桌子面朝上,你应该得到(0,0,-1)为X,Y和Z轴分别的值。如果你放下你的手机,而它在自由下落,你应该得到(0,0,0)

Accelerometer data on the iPhone is provided in units of g-force. The x-axis is aligned with the top edge of your phone screen, the y-axis is aligned with the left edge, and the z-axis comes straight out of the screen towards you if you're looking at it. So with your phone resting on the table face-up, you should get values of (0, 0, -1) for the x, y, and z axes respectively. If you drop your phone, while it is in free-fall you should get (0, 0, 0).

假设你保持这样的排列将手机作为你移动它,以获得米的三维加速度每秒平方:

Assuming you keep the phone aligned like this as you move it around, to get the 3-Dimensional acceleration in metres 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
}

注意,您必须减去,以获得相对于你的客厅的加速度,而不是相对于4维时空地球重力的影响。

Notice that you must subtract the effect of Earth's gravity in order to get the acceleration relative to your living room rather than relative to 4-Dimensional space-time.

另外要注意,iPhone的加速计是相当嘈杂,这些值周围的抖动,即使手机是静态的,所以你要应用一些平滑。但是,如果你使用了类似的技术,你似乎做什么用的位置数据做,把值到一个数组每一帧为了在过去的0.5秒获得移动平均值,这会已经顺利的数据为您服务。

Also be aware that the iPhone accelerometer is quite noisy and these values jitter around even when the phone is static, so you will want to apply some smoothing. However, if you use a similar technique to what you seem to be doing with the position data, putting the values into an array each frame in order to get a rolling average over the last 0.5 seconds, this will already smooth the data for you.

需要注意的另一件事是,iPhone的加速计峰出约2.3克。这些G力并不难实现(例如,如果您合掌),所以你可能会超过他们,积累数据的技术会不会很可靠。

Another thing to be aware of is that the iPhone accelerometer peaks out at about 2.3g. These g-forces are not difficult to achieve (for example if you clap your hands together) so you may exceed them and techniques that accumulate data will not be very reliable.

这篇关于如何解释从iPhone的加速度计读数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆