2019-03-04

参考网址:https://developer.android.google.cn/reference/android/hardware/SensorEvent.html#values
Sensor.TYPE_ROTATION_VECTOR

https://developer.android.com/guide/topics/sensors/sensors_overview.html
https://developer.android.com/guide/topics

关于欧拉旋转的万向锁非常的一个解释。万向锁会导致少一个自由度
相关教程 最为详细(https://blog.csdn.net/cy_weiyi/article/details/46123785)
相关视频 https://v.youku.com/v_show/id_XNzkyOTIyMTI=.html

Sensor Coordinate System

In general, the sensor framework uses a standard 3-axis coordinate system to express data values. For most sensors, the coordinate system is defined relative to the device's screen when the device is held in its default orientation (see figure 1). When a device is held in its default orientation, the X axis is horizontal and points to the right, the Y axis is vertical and points up, and the Z axis points toward the outside of the screen face. In this system, coordinates behind the screen have negative Z values. This coordinate system is used by the following sensors:

  • Acceleration sensor
  • Gravity sensor
  • Gyroscope
  • Linear acceleration sensor
  • Geomagnetic field sensor

1. Sensor.TYPE_ROTATION_VECTOR

The rotation vector represents the orientation of the device as a combination of an angle and an axis, in which the device has rotated through an angle θ around an axis .
这个旋转矢量将设备的方向表示为一个角度和坐标轴,设备围绕 旋转θ角度。
The three elements of the rotation vector are sin(θ/2), ysin(θ/2), z*sin(θ/2)>, such that the magnitude of the rotation vector is equal to sin(θ/2), and the direction of the rotation vector is equal to the direction of the axis of rotation.
旋转矢量的方向为旋转轴的方向

The three elements of the rotation vector are equal to the last three components of a unit quaternion sin(θ/2), ysin(θ/2), z*sin(θ/2)>.
旋转矢量的三个元素等于一个四元数的后三位。
Elements of the rotation vector are unitless. The x,y, and z axis are defined in the same way as the acceleration sensor.
旋转向量中的元素是没有单位的,x,y,z轴定义为与加速度计传感器一样的。

The reference coordinate system is defined as a direct orthonormal basis, where:

X is defined as the vector product Y.Z (It is tangential to the ground at the device's current location and roughly points East).
Y is tangential to the ground at the device's current location and points towards magnetic north.
Z points towards the sky and is perpendicular to the ground.

image.png

values[0]: xsin(θ/2)
values[1]: y
sin(θ/2)
values[2]: z*sin(θ/2)
values[3]: cos(θ/2)
values[4]: estimated heading Accuracy (in radians) (-1 if unavailable)
values[3], originally optional, will always be present from SDK Level 18 onwards. values[4] is a new value that has been added in SDK Level 18.

TYPE_GAME_ROTATION_VECTOR
A constant describing an uncalibrated rotation vector sensor type.
type_game_rotation_vector 是没有经过校正的设备四元素,
Identical to TYPE_ROTATION_VECTOR except that it doesn't use the geomagnetic field. Therefore the Y axis doesn't point north, but instead to some other reference, that reference is allowed to drift by the same order of magnitude as the gyroscope drift around the Z axis. 这个方向没有使用地磁场,转向了其他参考。

In the ideal case, a phone rotated and returning to the same real-world orientation should report the same game rotation vector (without using the earth's geomagnetic field). However, the orientation may drift somewhat over time.

See SensorEvent.values for more details.

Sensor.TYPE_ORIENTATION

Sensor.TYPE_ORIENTATION:All values are angles in degrees.

  • values[0]: Azimuth, angle between the magnetic north direction and the y-axis, around the z-axis (0 to 359). 0=North, 90=East, 180=South, 270=West

    values[1]: Pitch, rotation around x-axis (-180 to 180), with positive values when the z-axis moves toward the y-axis.

    values[2]: Roll, rotation around the y-axis (-90 to 90) increasing as the device moves clockwise.

Note: This definition is different from yaw, pitch and roll used in aviation where the X axis is along the long side of the plane (tail to nose).

image.png

你可能感兴趣的:(2019-03-04)