0

I want to now rotation delta of two devices. I try to use CMDeviceMotion's attitude.yaw.

let motionManager = CMMotionManager();
motionManager.showsDeviceMovementDisplay = true
motionManager.deviceMotionUpdateInterval = 1 / 25
if motionManager.deviceMotionAvailable {
   motionManager.startDeviceMotionUpdatesUsingReferenceFrame(CMAttitudeReferenceFrameXMagneticNorthZVertical,
   toQueue: NSOperationQueue.mainQueue(),
   withHandler: { (m: CMDeviceMotion!, e: NSError!) -> Void in
      if (e == nil) {
         self.attitude = m.attitud
         self.deviceAtitudeUpdated()
      }
   })
}

But when I run app on two devices and put them flush I expect to see the same value. But values are different. What should I do to see same values (maybe with little difference)

AlKozin
  • 904
  • 8
  • 25
  • You should always set a `zero` point manually. The devices might not be exactly the same. If you're doing absolute values like this then calibration should be done. (Like with the compass app). – Fogmeister Dec 01 '14 at 08:59
  • @Fogmeister, calibration screen appears from time to time because motionManager.showsDeviceMovementDisplay is true, but values are not same with or without calibration – AlKozin Dec 01 '14 at 15:18
  • Yeah, let me clarify what I meant when I said calibration. It's not so that the values are all the same across devices. It's so that you know for each individual device what the "zero" value actually is. The "zero" value may not be the same but you can measure all absolute orientation from the predefined "zero" value. It's not a calibration for the device. It's a calibration for your software. – Fogmeister Dec 01 '14 at 15:21
  • i.e. if you calibrate on a device and get a value for 3.5 (making this up) when the device is held flat then you know when it shows 3.5 in the future the device is flat. Another device might show 2.7 but again, it doesn't matter that 2.7 is different from 3.5 because in the second case you will be treating 2.7 as being held flat. – Fogmeister Dec 01 '14 at 15:22

1 Answers1

0

After trying different options I stay on using magneticField data instead of yaw. magneticField have some differences depends on device but amount of error is low.

AlKozin
  • 904
  • 8
  • 25