0

Suppose we have accelerometer and magnetometer. I'm wondering if there is an approach to calculate yaw angle without calibrating magnetometer if -

  1. Yaw angle relative to the magnetic north is not required to be accurate; so when the device pointing to magnetic north, yaw angle is not required to be 0, it can be any degree. But the yaw angle needs to be accurate relative to rotation, means when the device rotates, the change of yaw angle needs to correctly reflect the change of actual degrees.

thanks,

Ted Cheng
  • 33
  • 1
  • 8

2 Answers2

0

Ted- I agree that calibrating magnetometers is a pain, but you do need each axis to give the same readings if they were pointed in the same direction. You do not need to know the inclination, declination or magnetic field for your location, however, to get the bearing from magnetic north.

Dave
  • 1
  • Thanks Dave, the reason I asked this question is I'm researching how Kolibree (http://www.kolibree.com/en/) calculated the angle relative to the teeth. I think the user needs place the brush parallel to teeth to get initial heading angle first, then when rotating the brush, the relative angle to the teeth can be calculated by comparing the new heading with the initial heading; the brush uses magnetometer, but how can user calibrate the brush before using it ? It's not like an iPhone, people accept the fact that you have to calibrate before using compass. – Ted Cheng Feb 14 '15 at 07:52
0

This code fragment will point you in the right direction if you presumably haven't already found it.

        motionManager.startDeviceMotionUpdatesUsingReferenceFrame(
        CMAttitudeReferenceFrame.XArbitraryCorrectedZVertical,
        toQueue: NSOperationQueue.currentQueue()!,
        withHandler: {
            [unowned self] (data: CMDeviceMotion?, error: NSError?) in
            // ignore errors
            if let gotData = data {
            print(self.motionManager.deviceMotion!.attitude.yaw)
            }
          }
        )
user3069232
  • 8,587
  • 7
  • 46
  • 87