Absolute rotation rates

110 Views Asked by At

On iOS with CMDeviceMotion, I can get the device CMAttitude and its CMRotationRate. The rotation rates are in the local device coordinate system (x,y,z).

For a given CMAttitude, how can I determine the absolute rotation rates, i.e., the rates of rotation of the device in the world coordinate system (X,Y,Z) defined by the initial CMAttitudeReferenceFrame?

For example: say I initialise CMMotionManager with the xMagneticNorthZVertical reference frame. How can I calculate the rotation rates around the X-axis (world magnetic North) and the Z-axis (world vertical)?

1

There are 1 best solutions below

0
On

Multiply the CMRotationRate by the CMAttitude quaternion. This rotate the device frame to the world frame.