【问题标题】:iOS5: low update rate of CLHeading readings -> switching to CoreMotion is problematiciOS5:CLHeading 读数更新率低 -> 切换到 CoreMotion 有问题
【发布时间】:2011-12-14 22:31:08
【问题描述】:

在 iOS5 中,Compass 原始数据读取的更新频率CLHeading 急剧下降。这导致我的增强现实应用程序无法使用,因为它依赖于对原始指南针数据的接近实时读取。

因此,我现在正尝试切换到 CoreMotion。这提供了更频繁更新的磁力计数据:

cmManager = [[CMMotionManager alloc] init];    
[cmManager startMagnetometerUpdates];

然后我可以在游戏期间随时访问magneticField 数据:

CMMagneticField magneticField = cmManager.magnetometerData.magneticField;

我遇到的问题如下: CMMagneticField 中的数据与 CLHeading x/y/z 数据的单位不同。

我想将CMMagneticField x/y/z 数据转换为与 CLHeading / CLHeadingComponentValue 相同的单位 - 以便能够使用我现有的 AR 代码。

这里有几个读数:

7.3     /  17.64 /  -39.58          CLHeadingComponentValue X/Y/Z
-103.12 /  88.51 /  -20.05          CMMagneticField 

-10.81  /  -34.9 /  -18.6          CLHeadingComponentValue X/Y/Z
-121.00 /   33.29 /  3.1           CMMagneticField    

-20.8  /  -38.0 /   -4.0          CLHeadingComponentValue X/Y/Z
-132.9 /   32.2 /  14.4           CMMagneticField

【问题讨论】:

    标签: objective-c ios5 compass-geolocation core-motion magnetometer


    【解决方案1】:

    文档中与此相关的唯一参考是报告的 CLHeadingComponentValue 已标准化为 -128 到 +128 的范围。但对我来说,似乎应用了其他类型的校准。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-04-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-10
      相关资源
      最近更新 更多