I have a Gyroscope, and use MCU to get raw data(xH, xL, yH, yL, zH, zL), then transfer the data to arduino to resolve.
And I got problems about the calculation angle, I move the sensor, but the value is wrong..
I have no Idea, the informations are tell me just integral the Angular speed value, that's all..
Please help me, give me some suggest.
我有一個陀螺儀,型號是L3G4200D,我使用MCU去喚醒並取得原始值(xH, xL, yH, yL, zH, zL),再將資料傳到Arduino做解析。
但我在計算x, y, z的移動角度時遇到問題,看了很多資料都是說直接對角速度做積分,就可以得到角度,但照著做後,卻得到不正確的數值,像是將陀螺儀放置於桌面上,平移時數值並沒有什麼變化,只有漂移的數值;還有先往上再往下,明明回到原點但數值卻越來越大,並沒有歸零。
麻煩大家的幫忙,非常感謝。
這是我的角度運算數值結果。
陀螺儀:
x: 0
y: 0
z: 0
陀螺儀:
x: 4
y: -21
z: -14
陀螺儀:
x: 4
y: -21
z: -14
陀螺儀:
x: 1
y: -76
z: 4
陀螺儀:
x: 1
y: -76
z: 4
陀螺儀:
x: 10
y: -120
z: -5
陀螺儀:
x: 10
y: -120
z: -5
陀螺儀:
x: 10
y: -120
z: -5
陀螺儀:
x: 10
y: -120
z: -5
陀螺儀:
x: 10
y: -120
z: -5
陀螺儀:
x: 10
y: -120
z: -5
陀螺儀:
x: 10
y: -120
z: -5
陀螺儀:
x: 10
y: -120
z: -5
陀螺儀:
x: 6
y: -98
z: -5
陀螺儀:
x: -6
y: -62
z: -15
陀螺儀:
x: -23
y: 7
z: -12
陀螺儀:
x: -23
y: 7
z: -12
陀螺儀:
x: -23
y: 20
z: -15
陀螺儀:
x: -24
y: 30
z: -16
陀螺儀:
x: -24
y: 33
z: -18
陀螺儀:
x: -27
y: 39
z: -18
陀螺儀:
x: -27
y: 39
z: -18
陀螺儀:
x: -26
y: 39
z: -18
陀螺儀:
x: -26
y: 39
z: -18
陀螺儀:
x: -26
y: 39
z: -18
陀螺儀:
x: -26
y: 39
z: -18
陀螺儀:
x: -26
y: 39
z: -18
陀螺儀:
x: -26
y: 39
z: -18
陀螺儀:
x: -26
y: 39
z: -18
陀螺儀:
x: -26
y: 39
z: -18
陀螺儀:
x: -26
y: 39
z: -18
陀螺儀:
x: -26
y: 39
z: -18
陀螺儀:
x: -26
y: 39
z: -18
陀螺儀:
x: -26
y: 39
z: -18
陀螺儀:
x: -26
y: 39
z: -18
This is my code
這是我的程式碼:
void timer100ms() {
ax = ax + ( ((xH * 256) + xL ) / 200 );
ay = ay + ( ((yH * 256) + yL ) / 200 );
az = az + ( ((zH * 256) + zL ) / 200 );
Serial.println("陀螺儀: ");
Serial.print("x: ");
Serial.println(ax);
Serial.print("y: ");
Serial.println(ay);
Serial.print("z: ");
Serial.println(az);
}