Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 582
gpichler Avatar asked May 31 '14 16:05

gpichler


1 Answers

These are the differences between CMAccelerometerData and cmdevicemotion.

  1. Raw accelerometer data is the sum of all accelerations measured i.e. a combination of gravity and current acceleration of the device.
  2. Device motion data is the result of sensor fusion of all 3 sensors i.e. accelerometer, gyroscope and magnetometer. Thus bias and errors are eliminated (in theory) and the remaining acceleration data is separated into gravity and acceleration to be used conveniently.

In order to compare both you gotta check CMAccelerometerData.acceleration against CMDeviceMotion.userAcceleration + CMDeviceMotion.gravity to compare like with like.

In general CMDeviceMotion is your first choice in most cases when you want precise values and hardware independency.

like image 54
vaibhav Avatar answered Sep 26 '22 10:09

vaibhav