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:

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 <x, y, z>.
这个旋转矢量将设备的方向表示为一个角度和坐标轴,设备围绕<x,y,z> 旋转θ角度。
The three elements of the rotation vector are <xsin(θ/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 <cos(θ/2), xsin(θ/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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 文/作家明月沧海 这是新的世界,拖着长长尾巴的家伙被我制服’我坐在房间里构想,向日葵昂首的姿势在这个节点上听见时光...
    作家明月沧海阅读 4,913评论 30 86
  • 在这几个月里面吗?老师带领着我们,每天朗读李白的诗歌。已经有几时首了。这些事有长有短,但都表达着,李白的心情。毛老...
    V8SUPERCHARGER阅读 3,853评论 0 1
  • 表达式计算就是把一串字符串当做代码解释运行,通过全局函数eval()实现此功能。 eval()即是函数也是运算符,...
    IFELSE阅读 1,137评论 0 0
  • 传说塞壬海妖拥有天籁般的歌喉,飞翔在墨绿的爱情海上空,她用歌声诱惑过往水手,使他们倾听失声,海船触礁,据说没有人能...
    花也伶侬OO阅读 4,044评论 2 4