PhoneGap iPhone 数字罗盘更新精度
我正在使用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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论