使用 Core Motion 是否可以获得更准确或更快的加速度计读数?
我可以使用 Core Motion 框架的这个方法:
- (void)startAccelerometerUpdatesToQueue:(NSOperationQueue *)queue withHandler:(CMAccelerometerHandler)handler
作为
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
UIKit 的 UIAccelerationDelegate 方法的替代方法。在那里,我必须指定更新频率。我希望尽可能快速、准确地获得加速度数据。
Core Motion是我的朋友吗?我可以从 Core Motion 的这种方法中获得的读数频率是多少?文档没有谈论它。
I can use this method of the Core Motion framework:
- (void)startAccelerometerUpdatesToQueue:(NSOperationQueue *)queue withHandler:(CMAccelerometerHandler)handler
as an alternative to the
- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
UIAccelerationDelegate method of UIKit. There, I have to specify the frequency of updates. I want to get acceleration data as fast and accurate as possible.
Is Core Motion my friend here? What's the frequency of readings I can expect from that method of Core Motion? The documentation doesn't talk about it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑!既然这个答案已经存在一年多了,当然它只具有历史价值。在这个阶段,我想,每个人都应该只使用 CoreMotion,仅此而已。希望这个历史性的答案对历史学生有所帮助!
我的印象是:CMAttitude 和 CMDeviceMotion 为您提供两者加速器和陀螺仪的好处(如果陀螺仪存在)。而 CMAccelerometerData 仅是加速度。 (就像 Core Motion 之前的时代一样。)
我的印象是 CoreMotion 的两个具体优点是:(
一)令人难以置信的拥有四元数的便利性和给你的态度
(二)显然,陀螺仪和加速器都在带有陀螺仪的机器上使用,不需要您做任何额外的工作......这是一个巨大的优势。
我相信加速度计本身的使用质量没有实际的技术差异。
因此:如果(出于某种原因)您只需要 Accel'r,并且您可以进行数学计算(如果与您手头的任务相关),则可以使用老式 Accel'r 委托。
简而言之,我们似乎都不会再使用老式的加速度计代表了!
Edit! Now that this answer is OVER A YEAR OLD, certainly it is only of historic value. At this stage, I guess, everyone should only be using CoreMotion and that's that. Hope this historic answer it helps an history students!
My impression is that: CMAttitude and CMDeviceMotion give you the benefit of both the accel'r and the gyro (if the gyro is present). Whereas CMAccelerometerData is only the accel'r. (Exactly like in the old days before Core Motion.)
My impression is that the two specific advantages of CoreMotion are:
(One) the mindboggling convenience of having Quaternions and attitude given to you on a silver platter
(Two) apparently, both gyro and accel'r are used on machines with a gyro, with no extra work from you ... a huge advantage.
I believe there is no actual technical difference in the quality of usage of the accelerometer per se.
Thus: if (for some reason) you want only the accel'r, and you can do the math (if relevant to your task at hand), you could use the old-school accel'r delegate.
It seems that in short, none of us will ever again use the old-school accelerometer delegate!