I want to compute rate of change of orientation of the iPhone along y axis. 1. Initially i need to define the reference as y axis, 2. Then measure the rate of change of orientation(angular measurement) from the defined reference.
Does CMAttitude provides a reliable angular measurements to implement this? Or Can i use rotational matrix or integrate gyroscope data(I implement this method, but it's not going to work due to the drift of the gyroscope). So please suggest me a reliable method to get this done?
Thank you in advance!
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;
来源:https://stackoverflow.com/questions/12305041/compute-rate-of-change-of-orientationangular-measurement-along-y-axis