2019-03-04

參考網(wǎng)址: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)>.
旋轉矢量的三個元素等于一個四元數(shù)的后三位艾帐。
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 是沒有經(jīng)過校正的設備四元素贯涎,
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
最后編輯于
?著作權歸作者所有,轉載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市匾效,隨后出現(xiàn)的幾起案子舷蟀,更是在濱河造成了極大的恐慌,老刑警劉巖面哼,帶你破解...
    沈念sama閱讀 217,509評論 6 504
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件野宜,死亡現(xiàn)場離奇詭異,居然都是意外死亡魔策,警方通過查閱死者的電腦和手機匈子,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,806評論 3 394
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來闯袒,“玉大人虎敦,你說我怎么就攤上這事≌遥” “怎么了其徙?”我有些...
    開封第一講書人閱讀 163,875評論 0 354
  • 文/不壞的土叔 我叫張陵,是天一觀的道長喷户。 經(jīng)常有香客問我唾那,道長,這世上最難降的妖魔是什么褪尝? 我笑而不...
    開封第一講書人閱讀 58,441評論 1 293
  • 正文 為了忘掉前任闹获,我火速辦了婚禮,結果婚禮上恼五,老公的妹妹穿的比我還像新娘昌罩。我一直安慰自己,他們只是感情好灾馒,可當我...
    茶點故事閱讀 67,488評論 6 392
  • 文/花漫 我一把揭開白布茎用。 她就那樣靜靜地躺著,像睡著了一般睬罗。 火紅的嫁衣襯著肌膚如雪轨功。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,365評論 1 302
  • 那天容达,我揣著相機與錄音古涧,去河邊找鬼。 笑死花盐,一個胖子當著我的面吹牛羡滑,可吹牛的內(nèi)容都是我干的菇爪。 我是一名探鬼主播,決...
    沈念sama閱讀 40,190評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼柒昏,長吁一口氣:“原來是場噩夢啊……” “哼凳宙!你這毒婦竟也來了?” 一聲冷哼從身側響起职祷,我...
    開封第一講書人閱讀 39,062評論 0 276
  • 序言:老撾萬榮一對情侶失蹤氏涩,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后有梆,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體是尖,經(jīng)...
    沈念sama閱讀 45,500評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,706評論 3 335
  • 正文 我和宋清朗相戀三年泥耀,在試婚紗的時候發(fā)現(xiàn)自己被綠了饺汹。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,834評論 1 347
  • 序言:一個原本活蹦亂跳的男人離奇死亡爆袍,死狀恐怖首繁,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情陨囊,我是刑警寧澤,帶...
    沈念sama閱讀 35,559評論 5 345
  • 正文 年R本政府宣布夹攒,位于F島的核電站蜘醋,受9級特大地震影響,放射性物質發(fā)生泄漏咏尝。R本人自食惡果不足惜压语,卻給世界環(huán)境...
    茶點故事閱讀 41,167評論 3 328
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望编检。 院中可真熱鬧胎食,春花似錦、人聲如沸允懂。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,779評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽蕾总。三九已至粥航,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間生百,已是汗流浹背递雀。 一陣腳步聲響...
    開封第一講書人閱讀 32,912評論 1 269
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留蚀浆,地道東北人缀程。 一個月前我還...
    沈念sama閱讀 47,958評論 2 370
  • 正文 我出身青樓搜吧,卻偏偏與公主長得像,于是被迫代替她去往敵國和親杨凑。 傳聞我的和親對象是個殘疾皇子赎败,可洞房花燭夜當晚...
    茶點故事閱讀 44,779評論 2 354

推薦閱讀更多精彩內(nèi)容

  • 文/作家明月滄海 這是新的世界僵刮,拖著長長尾巴的家伙被我制服’我坐在房間里構想,向日葵昂首的姿勢在這個節(jié)點上聽見時光...
    作家明月滄海閱讀 1,194評論 30 86
  • 在這幾個月里面嗎鹦牛?老師帶領著我們搞糕,每天朗讀李白的詩歌。已經(jīng)有幾時首了曼追。這些事有長有短窍仰,但都表達著,李白的心情礼殊。毛老...
    V8SUPERCHARGER閱讀 630評論 0 1
  • 表達式計算就是把一串字符串當做代碼解釋運行驹吮,通過全局函數(shù)eval()實現(xiàn)此功能。 eval()即是函數(shù)也是運算符晶伦,...
    IFELSE閱讀 169評論 0 0
  • 傳說塞壬海妖擁有天籟般的歌喉碟狞,飛翔在墨綠的愛情海上空,她用歌聲誘惑過往水手婚陪,使他們傾聽失聲族沃,海船觸礁,據(jù)說沒有人能...
    花也伶儂OO閱讀 722評論 2 4