# How does smartphone VR positioning work? [closed]

I've recently came across Google's cartboard VR headset, which allows you to use your smartphone as a virtual reality device. The headset basically splits the screen in your left and right eyes, which makes 3D vision possible. This is a well known cognitive mechanism that I won't discuss here.

Now, what bothers me is actually the sensor side of the question.

Let us use the following frame of reference for the rest of this discussion:

I've been astonished by the precision with which your head's movement is detected.

Sure, the integrated accelerometer (which can detect gravity), can account for rotation around x and y (roll and pitch) since it knows the direction of the ground.

But how do you deal with rotations around z (yaw), which is obviously collinear with the direction of gravity?

My guess is that the system uses the smartphone's magnetometer as a compass (your orientation is then computed relatively to the Earth's magnetic north)

However, many people argue that yaw is detected via the gyrometer. Which doesn't seem right to me, for two reasons:

• First, even though it's made to detect a rotation, it will easily get lost in some cases. Indeed, if you rotate you head around z at a constant rate (i.e. without any angular acceleration), the device can not tell whether you're rotating clockwise or anti-clockwise (the tangential acceleration is non-existent). In practice, I agree that this problem could perhaps be fixed by looking at the previous time-steps (if an acceleration has stopped but no subsequent deceleration has been recorded, it means the user is still rotating at constant speed). But would it be precise? Since there is no absolute frame of reference, wouldn't the results diverge quickly?
• Second, the very fine precision of the measurement. I've tried to rotate the phone around its vertical axis as slow as I could, and the program was still sensing my moves. Can a smartphone's gyrometer measure such tiny accelerations?

For these reasons, I believe that the magnetometer (i.e. the compass) is the way to go. Even if you turn and shake you phone very aggressively, the virtual reality reference frame doesn't seem to be disturbed. Which lets me think that the device is taking the external world as a reference, rather than relying on it's internal sense of position.

Now, can a magnetometer achieve such a precision of measurement as well? How is the detection of the Earth's magnetic field not disturbed by surrounding sources (I've put a magnet next to my phone, but never managed to mislead the VR program).

Or could the solution lie in a combination of different sensors? (comparing the measurements of the accelerometer, the gyroscope and the magnetometer to cancel most sources of error)

• I think your premise is wrong. Gyroscope has nothing to do with gravity, they are based on angular momentum conservation. They still work in the total absence of gravity. – Mandrill Nov 11 '16 at 20:37
• Thanks. You're right, i've mixed up "gyrometer" and "accelerometer". The rest of the question remains the same. – user126566 Nov 11 '16 at 20:58
• Crossposted from physics.stackexchange.com/q/292134/2451 – Qmechanic Nov 11 '16 at 21:36
• I'm voting to close this question because the original copy on Physics has been answered and cross-posting the same problem statement on multiple sites is discouraged. – Air Jan 17 '17 at 17:04