<pre>網(wǎng)絡(luò)資料學(xué)習(xí)與整合吹埠,并附加一些個人理解彤灶。
六軸傳感器 = 三軸加速度 + 三軸陀螺儀
</pre>
1.加速度計
安卓端:
? ?? ?加速度計用于測量加速度收恢。借助一個三軸加速度計可以測得一個固定平臺相對地球表面的運動方向究孕。如果平臺朝某個方向做加速度運動庸毫,各個軸向加速度值會含有重力產(chǎn)生的加速度值,使得無法獲得真正的加速度值合是。
- X軸的方向:沿著屏幕短邊水平方向從左到右了罪。
- Y軸的方向:從屏幕的左下角開始沿著屏幕的的垂直方向指向屏幕的頂端。
- Z軸的方向:當(dāng)水平放置時聪全,指向天空的方向泊藕。
加速度計
- 該數(shù)值包含重力加速度(垂直向下)的影響,單位:m/s^2荔烧。
- 將手機平放在桌面上吱七,default(0, 0, 9.81)
- 將手機向左傾斜汽久,x軸為正值鹤竭。將手機向右傾斜,x軸為負值景醇。
將手機向上傾斜臀稚,y軸為負值。將手機向下傾斜三痰,y軸為正值吧寺。
Therefore, to measure the real acceleration of the device, the contribution of the force of gravity must be removed from the accelerometer data. This can be achieved by applying a high-pass filter. Conversely, a low-pass filter can be used to isolate the force of gravity. The following example shows how you can do this:
? ?? ?因此,為了測量裝置的實際加速度散劫,必須從加速度計數(shù)據(jù)中去除重力所做的貢獻稚机。這可以通過應(yīng)用high-pass filter 來實現(xiàn)。相反获搏,可以使用a low-pass filter 來隔離重力赖条。
public void onSensorChanged(SensorEvent event){
// In this example, alpha is calculated as t / (t + dT),
// where t is the low-pass filter's time-constant and
// dT is the event delivery rate.
final float alpha = 0.8;
// Isolate the force of gravity with the low-pass filter.
gravity[0] = alpha * gravity[0] + (1 - alpha) * event.values[0];
gravity[1] = alpha * gravity[1] + (1 - alpha) * event.values[1];
gravity[2] = alpha * gravity[2] + (1 - alpha) * event.values[2];
// Remove the gravity contribution with the high-pass filter.
linear_acceleration[0] = event.values[0] - gravity[0];
linear_acceleration[1] = event.values[1] - gravity[1];
linear_acceleration[2] = event.values[2] - gravity[2];
}
芯片端:
可能使用的處理操作:濾波(去除重力加速度的貢獻)、峰谷檢測(受力點加速度值達到最高)。
加速度計檢測到得力的方向與它本身加速度的方向是相反的纬乍。
手環(huán)計步:
人體走路時加速度呈現(xiàn)周期性的變化碱茁,記錄波峰以及波谷的次數(shù)。即人們走一步仿贬,重心一次向上纽竣,一次向下,記錄為一步茧泪。
2. 三軸陀螺儀
- 陀螺儀的每個通道檢測一個軸的旋轉(zhuǎn)蜓氨。