Skip to content

Instantly share code, notes, and snippets.

@jonfriskics
Created October 28, 2014 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonfriskics/10b87838fb49944ec62d to your computer and use it in GitHub Desktop.
Save jonfriskics/10b87838fb49944ec62d to your computer and use it in GitHub Desktop.
CMMotion data
Here's the code I'm using with some logs below.
- (void)viewWillAppear:(BOOL)animated
{
self.manager = [[CMMotionManager alloc] init];
self.manager.deviceMotionUpdateInterval = 0.2;
self.manager.accelerometerUpdateInterval = 0.2;
self.manager.gyroUpdateInterval = 0.2;
self.manager.magnetometerUpdateInterval = 0.2;
[self.manager startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMDeviceMotion *motion, NSError *error) {
DLog(@"attitude: %@",motion.attitude);
DLog(@"rotationRate: %f %f %f",motion.rotationRate.x,motion.rotationRate.y,motion.rotationRate.z);
}];
}
// phone sitting on the table.
attitude: CMAttitude Pitch: 0.611658, Roll: 0.449262, Yaw: -0.003670
rotationRate: 0.001652 0.001144 -0.004280
attitude: CMAttitude Pitch: 0.627578, Roll: 0.416510, Yaw: -0.054718
rotationRate: 0.000429 0.002357 -0.000640
attitude: CMAttitude Pitch: 0.647615, Roll: 0.420013, Yaw: -0.092399
rotationRate: 0.004261 0.007085 -0.001898
attitude: CMAttitude Pitch: 0.636128, Roll: 0.414624, Yaw: -0.129247
rotationRate: 0.005379 0.003395 -0.003059
attitude: CMAttitude Pitch: 0.636813, Roll: 0.422757, Yaw: -0.155012
rotationRate: 0.000261 0.001084 -0.004303
attitude: CMAttitude Pitch: 0.627978, Roll: 0.439125, Yaw: -0.167319
rotationRate: 0.003937 0.006802 0.000631
attitude: CMAttitude Pitch: 0.636189, Roll: 0.445440, Yaw: -0.165167
rotationRate: 0.001497 0.005423 0.001003
attitude: CMAttitude Pitch: 0.642318, Roll: 0.460925, Yaw: -0.176044
rotationRate: -0.001007 0.004063 -0.000789
attitude: CMAttitude Pitch: 0.637423, Roll: 0.453413, Yaw: -0.177138
rotationRate: -0.001012 0.002766 0.002790
attitude: CMAttitude Pitch: 0.632344, Roll: 0.456643, Yaw: -0.184733
rotationRate: 0.001478 0.001442 0.002767
attitude: CMAttitude Pitch: 0.639983, Roll: 0.457948, Yaw: -0.188257
rotationRate: 0.001438 0.000195 -0.000928
attitude: CMAttitude Pitch: 0.640563, Roll: 0.464585, Yaw: -0.183965
rotationRate: 0.002653 0.002642 0.000856
attitude: CMAttitude Pitch: 0.647856, Roll: 0.465404, Yaw: -0.171340
rotationRate: 0.001348 0.000256 0.003524
attitude: CMAttitude Pitch: 1.948007, Roll: -1.010408, Yaw: -0.975513
rotationRate: 1.108420 -0.427092 -0.493042
attitude: CMAttitude Pitch: 27.109883, Roll: -3.991787, Yaw: -0.155038
rotationRate: 3.488511 0.227257 0.217953
attitude: CMAttitude Pitch: 68.105733, Roll: 0.122377, Yaw: -1.956041
rotationRate: 3.971556 0.170026 -0.593908
// picked the phone up and held it perpendicular to the ground like I was looking at it.
attitude: CMAttitude Pitch: 85.057815, Roll: 152.173385, Yaw: -153.819312
rotationRate: 1.082962 -0.128745 -0.302759
attitude: CMAttitude Pitch: 79.041323, Roll: 161.578254, Yaw: -164.728771
rotationRate: 0.114143 -0.177972 0.161953
attitude: CMAttitude Pitch: 78.093574, Roll: 162.423965, Yaw: -165.868110
rotationRate: -0.009789 -0.011747 0.057880
attitude: CMAttitude Pitch: 78.490013, Roll: 161.568933, Yaw: -165.310124
rotationRate: 0.015077 -0.010875 -0.001864
attitude: CMAttitude Pitch: 78.572828, Roll: 162.735399, Yaw: -166.696653
rotationRate: -0.037441 0.012060 0.004753
attitude: CMAttitude Pitch: 78.541772, Roll: 164.531495, Yaw: -168.773725
rotationRate: 0.028677 -0.035401 0.028162
attitude: CMAttitude Pitch: 78.258912, Roll: 166.051344, Yaw: -170.632600
rotationRate: -0.011745 -0.051451 0.032904
attitude: CMAttitude Pitch: 78.094268, Roll: 165.573918, Yaw: -170.181850
rotationRate: -0.016534 0.101266 -0.069757
attitude: CMAttitude Pitch: 77.912740, Roll: 165.345643, Yaw: -169.746431
rotationRate: 0.034823 0.074626 -0.032115
attitude: CMAttitude Pitch: 77.798381, Roll: 165.871104, Yaw: -170.045104
rotationRate: 0.043282 -0.081647 0.059717
attitude: CMAttitude Pitch: 77.668824, Roll: 165.698366, Yaw: -169.943050
rotationRate: -0.024098 -0.039043 0.048616
attitude: CMAttitude Pitch: 77.638476, Roll: 165.781100, Yaw: -170.036966
rotationRate: -0.010326 -0.029548 0.011893
attitude: CMAttitude Pitch: 77.743180, Roll: 164.930519, Yaw: -169.085169
rotationRate: 0.040531 -0.075304 -0.007740
attitude: CMAttitude Pitch: 77.545652, Roll: 164.321468, Yaw: -168.209146
rotationRate: -0.005177 -0.030972 0.040115
attitude: CMAttitude Pitch: 77.527927, Roll: 163.961244, Yaw: -167.788751
rotationRate: 0.001326 -0.001890 0.016560
attitude: CMAttitude Pitch: 77.760414, Roll: 163.758617, Yaw: -167.611465
rotationRate: 0.006887 0.073255 -0.062787
attitude: CMAttitude Pitch: 77.809660, Roll: 163.825120, Yaw: -167.664139
rotationRate: -0.027814 0.018315 -0.003428
attitude: CMAttitude Pitch: 77.943539, Roll: 163.341524, Yaw: -167.016885
rotationRate: -0.063258 0.011912 -0.015850
attitude: CMAttitude Pitch: 78.072734, Roll: 162.962533, Yaw: -166.619196
rotationRate: -0.026820 0.021963 -0.006966
attitude: CMAttitude Pitch: 78.246901, Roll: 162.774035, Yaw: -166.199136
rotationRate: -0.027776 0.064339 -0.024645
attitude: CMAttitude Pitch: 80.162839, Roll: 158.560962, Yaw: -161.650560
rotationRate: -0.659252 0.087104 -0.143785
// phone sitting on the table again.
attitude: CMAttitude Pitch: 77.988055, Roll: 19.174838, Yaw: -21.262595
rotationRate: -2.605355 -0.094255 0.035157
attitude: CMAttitude Pitch: 48.704826, Roll: 3.816603, Yaw: -6.772865
rotationRate: -2.451744 -0.255505 0.255738
attitude: CMAttitude Pitch: 24.783441, Roll: -0.103789, Yaw: -3.024033
rotationRate: -1.932457 0.019826 -0.189890
attitude: CMAttitude Pitch: 9.044466, Roll: -0.900313, Yaw: -3.335813
rotationRate: -0.852727 -0.161863 0.048991
attitude: CMAttitude Pitch: 0.520043, Roll: -0.640537, Yaw: -1.416907
rotationRate: 0.000227 0.000728 0.017234
attitude: CMAttitude Pitch: 0.551308, Roll: -0.400813, Yaw: -1.402322
rotationRate: -0.001051 0.005664 -0.001231
attitude: CMAttitude Pitch: 0.594149, Roll: -0.003774, Yaw: -1.386191
rotationRate: 0.000225 0.005647 0.001204
attitude: CMAttitude Pitch: 0.606349, Roll: 0.202233, Yaw: -1.372051
rotationRate: -0.002326 0.003305 -0.001247
attitude: CMAttitude Pitch: 0.615464, Roll: 0.293991, Yaw: -1.362522
rotationRate: 0.000121 0.006909 0.001272
attitude: CMAttitude Pitch: 0.620570, Roll: 0.345762, Yaw: -1.349213
rotationRate: 0.000064 0.002078 0.001339
attitude: CMAttitude Pitch: 0.618421, Roll: 0.379656, Yaw: -1.328498
rotationRate: -0.002477 -0.000283 0.001346
attitude: CMAttitude Pitch: 0.626924, Roll: 0.405616, Yaw: -1.312033
rotationRate: -0.002420 0.003336 0.002515
attitude: CMAttitude Pitch: 0.613733, Roll: 0.412977, Yaw: -1.295031
rotationRate: -0.001170 0.002093 0.003767
attitude: CMAttitude Pitch: 0.603063, Roll: 0.417340, Yaw: -1.262299
rotationRate: -0.000025 0.002136 0.005091
attitude: CMAttitude Pitch: 0.603159, Roll: 0.432822, Yaw: -1.234931
rotationRate: -0.001258 0.004587 0.002591
attitude: CMAttitude Pitch: 0.604250, Roll: 0.434413, Yaw: -1.200120
rotationRate: 0.001149 0.002191 0.002723
attitude: CMAttitude Pitch: 0.593843, Roll: 0.440620, Yaw: -1.167272
rotationRate: -0.001335 -0.000147 0.007657
attitude: CMAttitude Pitch: 0.595314, Roll: 0.443105, Yaw: -1.136979
rotationRate: 0.001298 0.001059 0.002784
attitude: CMAttitude Pitch: 0.598374, Roll: 0.445824, Yaw: -1.090561
rotationRate: 0.002673 -0.002526 0.000409
attitude: CMAttitude Pitch: 0.601809, Roll: 0.469264, Yaw: -1.043512
rotationRate: 0.003092 0.010736 0.003745
attitude: CMAttitude Pitch: 0.586420, Roll: 0.480446, Yaw: -1.005883
rotationRate: -0.002008 -0.001252 0.004958
attitude: CMAttitude Pitch: 0.607259, Roll: 0.462719, Yaw: -0.945055
rotationRate: 0.000801 0.004726 0.001097
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment