iPhone - 陀螺仪测量什么?我可以获得所有轴上的绝对度数测量吗?

发布于 2024-10-19 03:57:19 字数 345 浏览 5 评论 0原文

我对 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

停顿的约定 2024-10-26 03:57:19

陀螺仪可以为您测量很多东西,是的,其中之一就是“绝对角度”。查看 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 orientation of a body relative to
a given frame of reference

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.

萌逼全场 2024-10-26 03:57:19

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文