Compute rate of change of orientation(angular measurement) along y axis?

安稳与你 提交于 2019-12-06 06:14:24

First, just to clarify: Rotation rates are not measured "from" any axis, they're measured "around" an axis. You don't need to provide an initial reference frame, since you're just worried about change over time.

Anyways, The best you'll get is CMDeviceMotion's rotationRate property, about which the docs say:

A CMRotationRate structure contains data specifying the device’s rate of rotation around three axes. The value of this property contains a measurement of gyroscope data whose bias has been removed by Core Motion algorithms.

It's saying that it integrates sensor data from multiple sources (Accelerometer) in an attempt to remove the gyro drift from the readings, as opposed to the CMGyroData class, about which the docs say:

This property yields a measurement of the device’s rate of rotation around three axes. Whereas this property gives the raw data from the gyroscope, the identically named property of CMDeviceMotion gives a CMRotationRate structure measuring gyroscope data whose bias has been removed by Core Motion algorithms.

The takeaway from those references is that, if you want the most accurate rotation rate data, you should use something like:

CMMotionManager* manager = [[CMMotionManager alloc] init];
[manager startDeviceMotionUpdates];

// Later, in some other scope...
double rotationAroundY = [[manager deviceMotion] rotationRate].y;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!