PhoneGap iPhone 数字罗盘更新精度

发布于 2024-10-10 05:17:51 字数 679 浏览 3 评论 0原文

我正在使用phonegap 库在javascript 中开发增强现实iPhone 应用程序,结果非常好。我放置了一个低通滤波器来稳定设备倾斜时使用的加速度计读数,效果非常好。但是,我无法顺利地左/右移动。看来我的磁力计只会在每次移动整体时更新 程度。 Onload,我正在查看值 196.721054,然后将其向左旋转,直到达到 195.721054(相差一度)才发生变化。当然,这个装置必须比旋转一度更精确。

有谁知道是否有一个设置可以降低此阈值以获得更频繁的更新?仅供参考,这是我的代码:

var magneticHeading;//global variable
function startCollectingData() {
       magneticHeadingWatchID = navigator.compass.watchHeading(function(heading){
               magneticHeading=heading.magneticHeading;//save it as a global variable
       }, function(){/*don't do anything onFail*/},
       { frequency: 100});
}

我在选项中的某处读到,我可以执行 headerFilter:.01 之类的操作,但这似乎没有多大帮助。

想法?

I am in the process of developing an augmented reality iphone app in javascript using the phonegap library and it's turning out quite well. I put a low pass filter to calm down the accelerometer readings used on tilt of the device which works very nicely. However, I can't get a smooth left/right moving. It seems that my magentometer will only update everytime it moves a whole
degree. Onload, I'm looking at a value of 196.721054, and then rotating it left, it doesn't budge until it gets to 195.721054 (one degree difference). Surely, this device has to be more precise than one degree of rotation.

Does anybody know if there's a setting to lower the threashold of this to get more frequent updates? FYI, here's my code:

var magneticHeading;//global variable
function startCollectingData() {
       magneticHeadingWatchID = navigator.compass.watchHeading(function(heading){
               magneticHeading=heading.magneticHeading;//save it as a global variable
       }, function(){/*don't do anything onFail*/},
       { frequency: 100});
}

I read somewhere that in the options, I can do something like headingFilter:.01, but that doesn't seem to help much.

Thoughts?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文