2

I am in the process of developing an iPhone app that uses the devices X and Y CMMotionManager orientation.

When I've been testing my app on ipod touch's and iPads I've had no problems when I place the device on a level surface the X and Y attitude variables equal roughly 0.

BUT

When I tested it on an iPhone 5 the Y variable was equal to around -6 and the X about 6 on the same level surface!!

Is this an ios bug? or something wrong with my code?

Any help with this would greatly appreciated.

This is my code btw:

    motion = gyroscopeManager.deviceMotion;
  NSString *x = [NSString stringWithFormat:@"%f", 180 * motion.gravity.x / M_PI];
 NSString *y = [NSString stringWithFormat:@"%f", 180 * motion.gravity.y / M_PI];
Brown2025
  • 31
  • 5
  • Do they all have the same version of iOS installed? – Kay Jun 13 '13 at 10:45
  • Yes, also I tested the app on three different iPhone 5's and all of them did the same thing – Brown2025 Jun 13 '13 at 11:55
  • I only have access to one device but experienced some similar issues as well s. [Drifting yaw angle after moving fast](http://stackoverflow.com/questions/13613239/drifting-yaw-angle-after-moving-fast). I filed a bug report. They tried to close it, I reopened it, now it's one of those zombies in the database. Surprisingly I got my problems were reduced when switching from gyro to gravity based control – Kay Jun 13 '13 at 12:22
  • Hmm ok, thanks for that, I might try it in ios 7 beta see if its been fixed – Brown2025 Jun 13 '13 at 12:52
  • 1
    Ok app behaves exactly the same as before on ios 7 pre-release :( – Brown2025 Jun 13 '13 at 14:13
  • If you can confirm this with a demo project like [MotionGraphs](http://developer.apple.com/library/ios/#samplecode/MotionGraphs/Introduction/Intro.html) it would be worth a bug report. – Kay Jun 13 '13 at 14:18
  • Ok i've done some testing. I cannot replicate the problem on MotionGraphs app, Thank you @Kay for suggesting that. I have the found that the problem is temperamental. Sometimes the app (my app) will display an accurate reading while other times it will do the -6 thing. Grrr! – Brown2025 Jun 19 '13 at 11:06

1 Answers1

0

I found the problem! in another section of my code I had included a method that checked the devices acceleration, when I removed this method the gyroscope behaved normally!

Brown2025
  • 31
  • 5