Iphone - core movement (relative rotation)

Is there a way to get relative rotation from the motion of the nucleus?

I need: how much it rotates on one axis and in which direction (+ sign = counterclockwise, - = clockwise, in accordance with the right rule).

I found the rotationRate property, but now I'm sure how to extract an angle from it, as this gives me radians per second.

In recent days, I have been doing all kinds of things, but nothing has given me stable values. I tried to run a timed sample of kernel motion data using NSTimer and calculate the difference between the two samples, so I would get how much it has rotated since the last sample, but from time to time it gives me crazy numbers like 13600 degrees even when the iPhone is standing on the table.

Any thoughts on how this can be done?

thank

+5
source share
2 answers

Really. You can get what you are looking for by collapsing into the CMMotionManager properties through CMDeviceMotion and finally CMAttitude . The device ratio is defined as:

body orientation relative to a given reference frame.

In the case of DeviceMotion CMAttitude, this reference system is set by the frame when the update of device movements starts. From this point in time on, the device relation is reported in relation to this reference frame (not in relation to the previous frame).

CMAttitude CMAttitude , -, Euler Angles, . , (Pitch, Yaw, Roll).

+7

, , , , , , . Core Motion , , . , , / - y, , - z ( ). , , , , , .

+3

All Articles