Class

CMAttitude

The device’s attitude—its orientation relative to a known frame of reference—at a point in time.

Overview

The CMAttitude class offers three different mathematical representations of attitude: a rotation matrix, a quaternion, and Euler angles (roll, pitch, and yaw values). You access CMAttitude objects through the attitude property of each CMDeviceMotion objects passed to an application. An application starts receiving these device-motion objects as a result of calling the startDeviceMotionUpdates(using:to:withHandler:) method, thestartDeviceMotionUpdates(to:withHandler:) method, the startDeviceMotionUpdates(using:) method or the startDeviceMotionUpdates() method of the CMMotionManager class.

Topics

Getting a Mathematical Representation of Attitude as Euler Angles

var roll: Double

The roll of the device, in radians.

var pitch: Double

The pitch of the device, in radians.

var yaw: Double

The yaw of the device, in radians.

Getting a Mathematical Representation of Attitude as a Rotation Matrix

var rotationMatrix: CMRotationMatrix

Returns a rotation matrix representing the device's attitude.

Getting a Mathematical Representation of Attitude as a Quaternion

var quaternion: CMQuaternion

Returns a quaternion representing the device's attitude.

Obtaining the Change in Attitude

func multiply(byInverseOf: CMAttitude)

Yields the change in attitude given a specific attitude.

Constants

struct CMRotationMatrix

The type of a structure representing a rotation matrix.

struct CMQuaternion

The type for a quaternion representing a measurement of attitude.

struct CMAttitudeReferenceFrame

Enum constants for indicating the reference frames from which all attitude samples are referenced.

Relationships

Inherits From

See Also

Device Motion

Getting Processed Device Motion Data

Retrieve data that has already been processed to remove environmental bias, such as the effects of gravity.

class CMDeviceMotion

Encapsulated measurements of the attitude, rotation rate, and acceleration of a device.