目录
- 1.Sensor.TYPE_ACCELEROMETER:
- 2.Sensor.TYPE_GYROSCOPE:
- 3.Sensor.TYPE_GRAVITY:
- 4.Sensor.TYPE_MAGNETIC_FIELD:
- 5.Sensor.TYPE_LIGHT:
- 6.Sensor.TYPE_PROXIMITY:
- 7.Sensor.TYPE_LINEAR_ACCELERATION:
- 8.Sensor.TYPE_ORIENTATION:
- 9.Sensor.TYPE_ROTATION_VECTOR:
- 10.Sensor.TYPE_GAME_ROTATION_VECTOR:
- 11.Sensor.TYPE_GYROSCOPE_UNCALIBRATED:
1.Sensor.TYPE_ACCELEROMETER:
原文翻译
All values are in SI units (m/s^2)
values[0]: Acceleration minus Gx on the x-axis
values[1]: Acceleration minus Gy on the y-axis
values[2]: Acceleration minus Gz on the z-axis
所有值均为SI单位(m/s^2)
值[0]:x轴上的加速度减去Gx
值[1]:加速度减去y轴上的Gy
值[2]:z轴上的加速度减去Gz
A sensor of this type measures the acceleration applied to the device (Ad). Conceptually, it does so by measuring forces applied to the sensor itself (Fs) using the relation:
Ad = - ∑Fs / mass
In particular, the force of gravity is always influencing the measured acceleration:
特别地,重力总是影响着测量到的加速度:
Ad = -g - ∑F / mass
For this reason, when the device is sitting on a table (and obviously not accelerating), the accelerometer reads a magnitude of g = 9.81 m/s^2
因此,当设备坐在桌子上(显然没有加速),加速度计读取g = 9.81 m/s^2的量级
Similarly, when the device is in free-fall and therefore dangerously accelerating towards to ground at 9.81 m/s^2, its accelerometer reads a magnitude of 0 m/s^2.
同样,当设备处于自由落体状态,并因此危险地以9.81米/秒2的速度向地面加速时,其加速度计的读数为0米/秒2。
It should be apparent that in order to measure the real acceleration of the device, the contribution of the force of gravity must be eliminated. This can be achieved by applying a high-pass filter. Conversely, a low-pass filter can be used to isolate the force of gravity.
显然,为了测量装置的实际加速度,必须消除重力的作用。这可以通过应用高通滤波器来实现。相反,可以使用低通滤波器来隔离重力。
笔记
- 1.虽然这个文档在一开始的时候说是隔离重力的,但是可以通过实际测量和后面的描述当中知道,这个东西是带有重力的,需要我们抹除重力的影响。
2.Sensor.TYPE_GYROSCOPE:
原文翻译
All values are in radians/second and measure the rate of rotation around the device’s local X, Y and Z axis.
所有值都以弧度/秒为单位,测量围绕设备本地X、Y和Z轴的旋转速率。
The coordinate system is the same as is used for the acceleration sensor.
坐标系与用于加速度传感器的坐标系相同。
Rotation is positive in the counter-clockwise direction. That is, an observer looking from some positive location on the x, y or z axis at a device positioned on the origin would report positive rotation if the device appeared to be rotating counter clockwise.
在逆时针方向上旋转为正。也就是说,一个观察者从x、y或z轴上的某个正位置观察一个位于原点的设备,如果该设备看起来是逆时针旋转,那么该设备将报告正旋转。
Note that this is the standard mathematical definition of positive rotation and does not agree with the definition of roll given earlier.
注意,这是正旋转的标准数学定义,与前面给出的滚动的定义不一致。
values[0]: Angular speed around the x-axis
values[1]: Angular speed around the y-axis
values[2]: Angular speed around the z-axis
笔记
- 1.这里我们注意这个东西的单位是使用弧度/s的,所以这样才能读出来那么小的数值
- 2.这里的正方向是与我们的坐标系标准的正方向是一致的。
- 3.这个东西也是加速度坐标系。
3.Sensor.TYPE_GRAVITY:
A three dimensional vector indicating the direction and magnitude of gravity. Units are m/s^2. The coordinate system is the same as is used by the acceleration sensor.
Note: When the device is at rest, the output of the gravity sensor should be identical to that of the accelerometer.
注意:当设备处于静止状态时,重力传感器的输出应与加速度计的输出一致。
笔记
- 1.重力加速和加速度的读数一样可以做一个简易的静止判别器。
4.Sensor.TYPE_MAGNETIC_FIELD:
All values are in micro-Tesla (uT) and measure the ambient magnetic field in the X, Y and Z axis.
所有值均以微特斯拉(uT)为单位,测量X、Y、Z轴的环境磁场。
笔记
就是一个正常的磁场
5.Sensor.TYPE_LIGHT:
values[0]: Ambient light level in SI lux units
笔记
就是一个光强传感器
6.Sensor.TYPE_PROXIMITY:
原文翻译
values[0]: Proximity sensor distance measured in centimeters
Note: Some proximity sensors only support a binary near or far measurement. In this case, the sensor should report its maximum range value in the far state and a lesser value in the near state.
values[0]:近距离传感器距离,单位为厘米
注意:一些接近传感器只支持二进制近或远的测量。在这种情况下,传感器应该在远状态报告它的最大量程值,在近状态报告一个较小的值。
笔记
- 1.这个东西可以返回一个距离,单位是一个厘米
- 2.但是一些手机上的硬件只能感知远近,没有具体的距离,这时候就不能产生具体的返回数值了,只能是意思的返回一个大数字或是小数字。
7.Sensor.TYPE_LINEAR_ACCELERATION:
A three dimensional vector indicating acceleration along each device axis, not including gravity. All values have units of m/s^2.
The coordinate system is the same as is used by the acceleration sensor.
The output of the accelerometer, gravity and linear-acceleration sensors must obey the following relation:
acceleration = gravity + linear-acceleration
- 1.一个三维矢量,表示沿设备轴方向的加速度,不包括重力。所有值的单位都是m/s^2。
- 2.坐标系与加速度传感器使用的坐标系相同。
- 3.加速度计、重力传感器和直线加速度传感器的输出必须遵循以下关系:加速度=重力+线性加速度
笔记
也就是这个东西是不包含重力的纯加速度,这个加速度的坐标系是和我们之前的重力和加速度是一种坐标系。
8.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
值[0]:方位角,磁北极方向和y轴之间的夹角,围绕z轴(0到359)。0=北,90=东,180=南,270=西
values[1]: Pitch, rotation around x-axis (-180 to 180), with positive values when the z-axis moves toward the y-axis.
俯仰,绕x轴旋转(-180 ~ 180),z轴向y轴移动时为正值。
values[2]: Roll, rotation around the y-axis (-90 to 90) increasing as the device moves clockwise.
随着设备顺时针移动,绕y轴旋转(-90到90)增加。
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).
这个定义不同于航空中使用的偏航、俯仰和横摇,在航空中X轴是沿着飞机的长边(从机尾到机头)。
Note: This sensor type exists for legacy reasons, please use rotation vector sensor type and getRotationMatrix() in conjunction with remapCoordinateSystem() and getOrientation() to compute these values instead.
Important note: For historical reasons the roll angle is positive in the clockwise direction (mathematically speaking, it should be positive in the counter-clockwise direction).
重要提示:由于历史原因,横滚角在顺时针方向上是正的(从数学上讲,它应该在逆时针方向上是正的)。
笔记
- 1.注意这个东西他都是用度来作为单位的。
- 2.这里我们注意这里的航向角是0-360的,是和北极的夹角,这里我们要注意这个东西是在北极附近存在跳变的。
- 3.在数学上讲,应该是逆时针为正,但是由于历史原因,横滚角在顺时针的方向是正的。正方向是遵循右手定则的,即:右手握住对应的旋转轴,大拇指指向正方向,那么四根手指指向的方向就是正方向了。这里我们从正方向看向版面,这个正方向正好是逆时针旋转,所以称作逆时针。
- 4.这和我们在惯性导航当中使用的航空相关的方式是不同的。所以需要注意。
9.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>.
就是说用四元数描述手机当前的orientation
The three elements of the rotation vector are <xsin(θ/2), ysin(θ/2), zsin(θ/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.
旋转矢量的三个元素是<xsin(θ/2), ysin(θ/2), zsin(θ/2)>,使得旋转矢量的大小等于sin(θ/2),旋转矢量的方向等于旋转轴的方向。
The three elements of the rotation vector are equal to the last three components of a unit quaternion <cos(θ/2), xsin(θ/2), ysin(θ/2), zsin(θ/2)>.
旋转矢量的三个元素等于单位四元数<cos(θ/2), xsin(θ/2), ysin(θ/2), zsin(θ/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.
World coordinate-system diagram.
将参考坐标系定义为直接标准正交基,其中:
- X被定义为矢量积Y.Z(它与设备当前位置的地面相切,大致指向东方)。
- Y与设备当前位置的地面相切,指向磁北。
- Z指向天空,垂直于地面。世界坐标系统图。
(这里其实就是描述了一个东北天坐标系)
values[0]: xsin(θ/2)
values[1]: ysin(θ/2)
values[2]: z*sin(θ/2)
values[3]: cos(θ/2)
values[4]: estimated heading Accuracy (in radians) (-1 if unavailable)
估计航向精度(弧度)(-1,如果不可用)是在SDK Level 18中添加的一个新值。
values[3], originally optional, will always be present from SDK Level 18 onwards.
最初是可选的,从SDK Level 18开始总是会出现。(最早是可以控制是否出现的,后来就是都会出现,不用的话直接不拿就是了)
values[4] is a new value that has been added in SDK Level 18.
是在SDK Level 18中添加的一个新值。
笔记
- 1.前面三个是旋转轴,后面那个是旋转角解算
values[0]: x*sin(θ/2)
values[1]: y*sin(θ/2)
values[2]: z*sin(θ/2)
values[3]: cos(θ/2) - 2.value[4]表示的是一种估计的精度
- 3.sdk18之前可以选择是不是提供最终的解算(value[3]),在18之后的sdk当中这个是稳定出现的。
- 4.关于四元数的各种可以参考:四元数介绍
- 5.我们可以看到在标准四元数的定义当中(x,y,z)应该是一个长度为一的标准向量,但是在安卓的官方文档当中却没有提起此事。我们实验一下,可以看到,安卓当中的(x,y,z)也是一个长度为1的标准向量。
- 6.另外官方还说了这里的(x,y,z)是和重力和加速度相同的坐标系,其实就是载体坐标系(b系)下的四元数。
- 7.这里我们注意这个东西从官方定义上来看和欧拉角表示的旋转是一种意思,欧拉角是表示着从水平的状态转化到当前状态的变化,这里的四元数其实也表示着这种从水平状态转化到当前状态的方式。
- 8.他这里提到了两个坐标系,这里的表示坐标系,其实是投影坐标系,就是我们将表示这次变化的向量分解在这个投影坐标系下。还有一个是相对坐标系,我们知道我们世界上的任何运动都是相对的,所以当我们应当确定相对坐标系的问题,这里确定的相对坐标系是n系,其实就是当地的东北天坐标系。这个其实好理解,其实也可以简单的理解为相对于使用者的脚下站着的点的运动描述在使用手机的载体坐标系下。
想要具体了解应该去:惯性导航基础 - 9.这个玩意是依靠地磁得到的内容
10.Sensor.TYPE_GAME_ROTATION_VECTOR:
Identical to Sensor.TYPE_ROTATION_VECTOR except that it doesn’t use the geomagnetic field.
和Sensor.TYPE_ROTATION_VECTOR相同,除了它不使用地磁场。
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.
因此,Y轴并不指向北方,而是指向一些其他的参考点,该参考点被允许以与陀螺仪绕Z轴漂移相同的数量级漂移。
In the ideal case, a phone rotated and returning to the same real-world orientation will report the same game rotation vector (without using the earth’s geomagnetic field).
在理想的情况下,手机旋转并返回到相同的现实世界方向将报告相同的游戏旋转矢量(不使用地球的地磁场)。
However, the orientation may drift somewhat over time.
然而,方向可能会随着时间的推移而有所漂移。
See Sensor.TYPE_ROTATION_VECTOR for a detailed description of the values. This sensor will not have the estimated heading accuracy value.
这个传感器不会有估计的航向精度值。
笔记
- 1.这个东西不会有航向精度的返回
- 2.这个东西的y轴并不指向北方,而是指向参考点,所以相同的姿态变换总是得到相同的游戏四元数。
- 3.这个玩意不是依靠地磁得到的。
11.Sensor.TYPE_GYROSCOPE_UNCALIBRATED:
All values are in radians/second and measure the rate of rotation around the X, Y and Z axis. An estimation of the drift on each axis is reported as well.
所有值都以弧度/秒为单位,测量围绕X、Y和Z轴的旋转速率。还报告了每个轴上漂移的估计。
No gyro-drift compensation is performed. Factory calibration and temperature compensation is still applied to the rate of rotation (angular speeds).
不进行陀螺漂移补偿。工厂校准和温度补偿仍然适用于转速(角速度)。
The coordinate system is the same as is used for the Sensor.TYPE_ACCELEROMETER Rotation is positive in the counter-clockwise direction (right-hand rule). That is, an observer looking from some positive location on the x, y or z axis at a device positioned on the origin would report positive rotation if the device appeared to be rotating counter clockwise. The range would at least be 17.45 rad/s (ie: ~1000 deg/s).
values[0] : angular speed (w/o drift compensation) around the X axis in rad/s
values[1] : angular speed (w/o drift compensation) around the Y axis in rad/s
values[2] : angular speed (w/o drift compensation) around the Z axis in rad/s
values[3] : estimated drift around X axis in rad/s
values[4] : estimated drift around Y axis in rad/s
values[5] : estimated drift around Z axis in rad/s
Pro Tip: Always use the length of the values array while performing operations on it. In earlier versions, this used to be always 3 which has changed now.
笔记
- 1安卓内核不对其进行漂移的补偿,但是传感器本身就带有的出厂就有的补偿这里是不管的。
-