iPhone - 陀螺仪测量什么?我可以获得所有轴上的绝对度数测量吗?
我对 iPhone 开发还比较陌生,我正在使用 Core Motion 来玩陀螺仪。经过几次测试,这就是我的问题。
陀螺仪到底测量的是什么信息?绝对角度?我的意思是,假设我以 90 度的角度纵向握住手机并开始采样。这些可能不是正确的值,但假设在这个位置,陀螺仪为我提供 0、0 和 0 度的偏航、俯仰和滚动。
现在,我将 iPhone 抛向空中,当它上升时,它会在所有轴上随机滚动大量整圈,然后返回到我手中的位置与之前相同。陀螺仪读数是否为 0,0,0(意味着它的位置与之前相同 = 绝对角度)?
如果没有,有没有办法测量所有轴上的绝对度数?作为绝对度数,我的意思是假设 0,0,0 作为采样开始时的位置。
谢谢
I am relatively new to iPhone development and I am playing with the gyroscope, using Core Motion. After a few tests, this is my question.
What information is exactly the gyroscope measuring? absolute angles? I mean, suppose I hold my phone in portrait, at exactly 90 degrees and start sampling. These may be not the correct values, but suppose that at this position, the gyroscope gives me 0, 0 and 0 degrees for yaw, pitch and roll.
Now I throw my iphone in the air and as it goes up it rolls at random a high number of full turns in all axis and returns to my hand at the same position as before. Will the gyroscope read 0,0,0 (meaning that it has the same position as before = absolute angle) or not?
If not, there's a way to measure absolute degrees in all axis? As absolute degrees I mean assuming 0,0,0 as the position it was when the sampling started.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
陀螺仪可以为您测量很多东西,是的,其中之一就是“绝对角度”。查看 CMDeviceMotion。它可以为您提供旋转速率,即设备旋转的速度,并且可以为您提供 CMAttitude。 CMAttitude 就是您所说的“绝对角度”。它在技术上定义为:
真正好的事情是,正如其他答案中所述,普通陀螺仪很容易漂移。 Core Motion 框架在后台为您进行了大量处理,以便在报告测量结果之前补偿漂移。实际上,我发现该框架在这项任务上做得非常出色(尽管并不完美)。除非您需要对磁极或其他物体进行长期精确度,否则无论出于何种意图和目的,框架报告的姿态都可以被视为完美的相对姿态测量。
The gyroscope measures many things for you, and yes, one of these is "absolute angles". Take a look at the docs on CMDeviceMotion. It can give you a rotation rate, which is how fast the device is spinning, and it can give you a CMAttitude. The CMAttitude is what you're calling "absolute angles". It is technically defined as:
The really nice thing is that normal gyroscopes, as noted in the other answer, are prone to drift. The Core Motion framework does a lot of processing behind the scened for you in an effort to compensate for the drift before the measurements are reported. Practically, I've found that the framework does a remarkable (though not perfect) job at this task. Unless you need long term precision to a magnetic pole or something, the attitude reported by the framework can be considered as a perfect relative attitude measurement, for all intents and purposes.
iPhone 使用加速度计进行内角测量,这意味着它们是相对于地球重力的。这几乎是你所能得到的绝对结果,除非你也需要这个程序在太空中工作。
The iPhone uses accelerometers for its internal angle measurements, which means they are relative to the Earth's gravity. That's about as absolute as you're going to get, unless you need this program to work in space, too.