VR Development-Gyroscope part research

Source: Internet
Author: User

Recently, in the study of VR, I saw the code of the sensor processing by Google Cardboard, and did some research on gyroscope, rotation matrix and Rodrigo formula.
The physical significance of gyroscope data: the data obtained in the gyroscope is stored in (x, Y, z), which represents the angular velocity of the gyroscope in the (x, Y, z) direction. The status on the headset device is shown in the following figure.

This time (x, y, z) direction may be different from the mobile phone level, the specific changes can be tested under their own.
We look at the processing of gyroscope data by Google Cardboard.
Specific code in VR development-the study of the Rodrigo formula
Here are a few lines of code:
This.mu.set (Gyro);
This.mu.scale (-DT);
So3util.so3frommu (This.mu, this.so3lastmotion);
This is the gyroscope data processing, gyro is the gyroscope vector, by multiplying time to get the current rotation in the x, y, z direction angle, then the Rodrigo rotation matrix calculation, to get the rotation matrix. The parameter passed in by the function is MU and results are returned.
The Rodrigo formula calculates the rotation matrix by the rotation axis and the rotation angle, at which point the vector mu of the incoming parameter is the angle of rotation, and the vector mu is the axis of revolution. There may be some misunderstanding, why the vector mu represents both the axis of rotation and the angle of rotation. Assuming that both Y and Z are zero, the rotation angle in the Y and Z directions is zero, and only the x-axis is rotated (x,0,0), then the resulting rotation matrix must be rotated by the x-axis and the x=θ angle. At the same time, assuming that only Y and Z are not zero, the same result is obtained, and the axes are rotated by Y and Z respectively, so we get the conclusion that in three dimensional space (x, y, z) vector is the axis of rotation. At this point, the modulus of the vector represents the rotation angle can also be understood, representing the x, Y and z direction of the angle and.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.