iOS Developer Library

Developer

CoreMotion Framework Reference CMGyroData Class Reference

Options
Deployment Target:

On This Page
Language:

CMGyroData

Inherits From


Conforms To


Import Statement


Swift

import CoreMotion

Objective-C

@import CoreMotion;

Availability


Available in iOS 4.0 and later

An instance of the CMGyroData class contains a single measurement of the device’s rotation rate.

An application receives or samples CMGyroData objects at regular intervals after calling the startGyroUpdatesToQueue:withHandler: method or the startGyroUpdates method of the CMMotionManager class.

  • The rotation rate as measured by the device’s gyroscope. (read-only)

    Declaration

    Swift

    var rotationRate: CMRotationRate { get }

    Objective-C

    @property(readonly, nonatomic) CMRotationRate rotationRate

    Discussion

    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.

    Import Statement

    Objective-C

    @import CoreMotion;

    Swift

    import CoreMotion

    Availability

    Available in iOS 4.0 and later

Data Types

  • The type of structures representing a measurement of rotation rate.

    Declaration

    Swift

    struct CMRotationRate { var x: Double var y: Double var z: Double init() init(x x: Double, y y: Double, z z: Double) }

    Objective-C

    typedef struct { double x; double y; double z; } CMRotationRate

    Constants

    • x

      x

      The X-axis rotation rate in radians per second. The sign follows the right hand rule: If the right hand is wrapped around the X axis such that the tip of the thumb points toward positive X, a positive rotation is one toward the tips of the other four fingers.

    • y

      y

      The Y-axis rotation rate in radians per second. The sign follows the right hand rule: If the right hand is wrapped around the Y axis such that the tip of the thumb points toward positive Y, a positive rotation is one toward the tips of the other four fingers.

    • z

      z

      The Z-axis rotation rate in radians per second. The sign follows the right hand rule: If the right hand is wrapped around the Z axis such that the tip of the thumb points toward positive Z, a positive rotation is one toward the tips of the other four fingers.

    Import Statement

    Objective-C

    @import CoreMotion;

    Swift

    import CoreMotion

    Availability

    Available in iOS 4.0 and later