iPhone 指南针显示错误航向俯仰角为 >约 45°
这可能很难解释几何形状,所以我会小心地拼写它。这在标准 compas 应用程序和 CLLocationManager 中的数据中可见。
1) 纵向握住手机时,俯仰角为 0°
2) 将相机指向天空(例如拍摄云朵)时,俯仰角为 0° -> 0°。 90°,其中 90 度是笔直向上的。
3)当手机向上倾斜(>0度并在“X”磁力计轴上旋转)并且当手机处于大约(但不精确)45度时,罗盘航向旋转180度。因此,当相机仍位于“N”点时,指南针将报告“S”。
4) 对于下一个(大约)90 度,罗盘航向旋转 180 度。
航向的这种旋转对我来说是破坏性的,它与加速度计并不完美对齐。是否有一个关于使用 CLHeading 数据中的 RAW 数据(X、Y、Z)来计算航向数据的好教程(我没有立即找到)?
最终结果是我希望指南针的方向始终与相机的方向相匹配。
This might be hard to explain the geometry so I will be careful in spelling it out. This is visible in the standard compas app and from the data in CLLocationManager.
1) When holding the phone in portrait orientation, consider the pitch angle to be 0°
2) When pointing the camera up into the sky (such as taking a picture of a cloud) the pitch angle goes from 0° -> 90° where 90 degrees is straight up.
3) when the phone is tilted upward (> 0 degrees and rotating on the "X" magnetometer axis) and when the phone is at about (but not exactly) 45 degrees, the compass heading rotates 180 degrees. So while the camera is still point "N", the compass will report "S".
4) for the next (roughly) 90 degrees, the compass heading is rotated 180 degrees.
This rotation of the heading is destructive for me and it does not align perfectly with the accelerometers. Is there a good tutorial (I did not find one off the bat) on using the the RAW data (X, Y, Z) from the CLHeading data to calculate heading data?
The end result is I want the heading of the compass to always match the heading of the camera.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能仅依赖指南针方向。请参阅此答案以了解您正在寻找的内容,特别是 CMAttitude 对象的 yaw 属性,以补偿您正在谈论的俯仰角:
在 iPhone 4 上使用陀螺仪补偿罗盘延迟
You can't rely on solely the compass heading. See this answer for what you're looking for, and in particular the CMAttitude object's yaw property to compensate for the pitch angle you're talking about:
Compensating compass lag with the gyroscope on iPhone 4