If you want to get Euler angles from your quaternion (y』know, heading, pitch & roll) then you』ll need to do something like this
Vector Quaternion::toEuler()
{
Vector ret;
double sqw = _w*_w;
double sqx = _x*_x;
double sqy = _y*_y;
double sqz = _z*_z;
return ret;
}
This function will pack a vector with heading, pitch and roll information. x = heading, y = pitch, z = roll.
==============================================================================
可以從某些library,裡找到數學運算程式,如 FreeIMU library,作者: g921002 時間: 2014-10-22 00:40
確認陀螺儀跟加速規的座標軸是不是一致(N,E,D-->X,Y,Z)作者: sam183132 時間: 2014-10-22 23:52
感謝各位大大的回覆,最後我發現了問題之所在~
原因是因為我輸入的陀螺儀數值有問題,我輸入的陀螺儀數值單位是deg/s,
但公式需要的陀螺儀數值,其單位是rad/s,所以我將輸入的陀螺儀數據更正之後就可以了~!!