user1463853 user1463853 - 4 months ago 37
iOS Question

Difference between CMAccelerometerData and CMDeviceMotion

Can someone explain the difference between

CMAccelerometerData
and
CMDeviceMotion
.

It seems to me like the acceleration values of
CMAccelerometerData
are raw values, as the data of
CMDeviceMotion
is somehow interpolated, or something like that.

Answer

An instance of the CMAccelerometerData class represents an accelerometer event. It is a measurement of acceleration along the three spatial axes at a moment of time.

An instance of CMDeviceMotion encapsulates measurements of the attitude, rotation rate, and acceleration of a device.

The difference is that CMDeviceMotion incorporates the gyroscope, accelerometer and compass data where CMAccelerometerData only contains the raw accelerometer data.