iPhone - What does the gyroscope measures? Can I get an absolute degree measurement in all axis?

后端 未结 2 1455
栀梦
栀梦 2021-01-03 12:29

I am relatively new to iPhone development and I am playing with the gyroscope, using Core Motion. After a few tests, this is my question.

What information is exactly

相关标签:
2条回答
  • 2021-01-03 12:34

    The gyroscope measures many things for you, and yes, one of these is "absolute angles". Take a look at the docs on CMDeviceMotion. It can give you a rotation rate, which is how fast the device is spinning, and it can give you a CMAttitude. The CMAttitude is what you're calling "absolute angles". It is technically defined as:

    the orientation of a body relative to a given frame of reference

    The really nice thing is that normal gyroscopes, as noted in the other answer, are prone to drift. The Core Motion framework does a lot of processing behind the scened for you in an effort to compensate for the drift before the measurements are reported. Practically, I've found that the framework does a remarkable (though not perfect) job at this task. Unless you need long term precision to a magnetic pole or something, the attitude reported by the framework can be considered as a perfect relative attitude measurement, for all intents and purposes.

    0 讨论(0)
  • 2021-01-03 12:46

    The iPhone uses accelerometers for its internal angle measurements, which means they are relative to the Earth's gravity. That's about as absolute as you're going to get, unless you need this program to work in space, too.

    0 讨论(0)
提交回复
热议问题