问题描述
我想在iPad上找出音高,偏航和滚动1.由于没有deviceMotion功能,我可以从加速度计中获取这些数据吗?我假设我可以使用它返回的向量与参考向量(即重力)进行比较。
iOS是否检测到设备何时静止,然后将其视为重力向量?或者我必须这样做?
谢谢。
绝对有可能从加速度计数据计算出俯仰和滚动,但是Yaw需要更多信息(陀螺仪肯定但可能指南针可以工作)。
举例来看。根据他们的如何工作,我很确定他们使用的是加速度计而不是陀螺仪。 / p>
此外,这里有一些我在 a用于计算音高和滚动:
我还在寻找的是如何校准俯仰和滚转值基于用户如何握住设备。如果我不能很快解决,我可能会提出一个单独的问题。祝你好运!
I want to find out the pitch, yaw, and roll on an iPad 1. Since there is no deviceMotion facility, can I get this data from the accelerometer? I assume that I can use the vector that it returns to compare against a reference vector i.e. gravity.
Does iOS detect when the device is still and then take that as the gravity vector? Or do I have to do that?Thanks.
It's definitely possible to calculate the Pitch and Roll from accelerometer data, but Yaw requires more information (gyroscope for sure but possibly compass could be made to work).
For an example look at Hungry Shark for iOS . Based on how their tilt calibration ui works I'm pretty sure they're using the accelerometer instead of the gyroscope.
Also, here are some formula's I found on a blog post from Taylor-Robotic a for calculating pitch and roll:
The thing I'm still looking for is how to calibrate the pitch and roll values based on how the user is holding the device. If I can't figure it out soon, I may open up a separate question. Good Luck!
这篇关于iOS:我可以从加速度计数据中获得俯仰/偏航/滚动吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!