Robofun 機器人論壇

 找回密碼
 申請會員
搜索
熱搜: 活動 交友 discuz
查看: 9791|回復: 3
打印 上一主題 下一主題

六軸數據(加速規+陀螺儀)實作四元數法轉歐拉角問題!!

[複製鏈接]
1#
發表於 2014-10-19 16:26:16 | 顯示全部樓層
回復 1# sam183132


   這裡有產品 UM6 Orientation Sensor,可自行秀出 Euler Angles (yaw, pitch, and roll)不用另外程式碼去算,


http://www.chrobotics.com/shop/orientation-sensor-um6
===========================================
>>>歐拉角數值(Roll,Pitch,Yaw)都會亂飄,


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;


    ret.x() = atan2(2.0*(_x*_y+_z*_w),(sqx-sqy-sqz+sqw));
    ret.y() = asin(-2.0*(_x*_z-_y*_w)/(sqx+sqy+sqz+sqw));
    ret.z() = atan2(2.0*(_y*_z+_x*_w),(-sqx-sqy+sqz+sqw));


    return ret;
}
This function will pack a vector with heading, pitch and roll information. x = heading, y = pitch, z = roll.
==============================================================================
可以從某些library,裡找到數學運算程式,如 FreeIMU library,
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

小黑屋|手機版|Archiver|機器人論壇 from 2005.07

GMT+8, 2024-5-14 16:58 , Processed in 0.172735 second(s), 7 queries , Apc On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表