您好!欢迎光临工博士商城

ABB机器人配件

产品:109    

咨询热线:17312666086(微信同号)

QQ QQ
您当前的位置:首页 » 新闻中心 » ABB机器人-欧拉角与四元数转化
产品分类
新闻中心
ABB机器人-欧拉角与四元数转化
发布时间:2021-06-15        浏览次数:1134        返回列表
 

important; word-wrap: break-word !important;">1. 机器人空中点位表示方法通常是x,y,z,a,b,c,其中a,b,c表示该点的旋转姿态。

important; word-wrap: break-word !important;">定义分别为绕Z轴、Y轴、X轴的旋转角度,如果用Tait-Bryan angle表示,分别为Yaw、Pitch、Roll

important; word-wrap: break-word !important;"> 

important; word-wrap: break-word !important;">2. 通过用于描述坐标系各轴相对于参考系统的方向的旋转矩阵,描述坐标系的姿态(诸如工具的姿态)(参见下图)。

important; word-wrap: break-word !important;">旋转后的坐标系轴(x,y,z)为矢量,其可以用参考坐标系表示如下:

important; word-wrap: break-word !important;">x = (x1, x2, x3)

important; word-wrap: break-word !important;">y = (y1, y2, y3)

important; word-wrap: break-word !important;">z = (z1, z2, z3)

important; word-wrap: break-word !important;">这意味着参考坐标系中x矢量的x轴向分量将为x1,y轴向分量将为x2,以此类推。

important; word-wrap: break-word !important;">这三个矢量可在一个矩阵(旋转矩阵)中组合,各矢量由此构成一栏:

important; word-wrap: break-word !important;">四元数仅仅是一种描述此旋转矩阵的更为简洁的方式;根据旋转矩阵的各元素,计算四元数:

important; word-wrap: break-word !important;"> 

important; word-wrap: break-word !important;">3. 综合以上,可以得到欧拉角--四元数的转化如下

important; word-wrap: break-word !important;"> 

important; word-wrap: break-word !important;">4  可以得到四元数--欧拉角的转化如下

important; word-wrap: break-word !important;"> 

important; word-wrap: break-word !important;"> 

important; word-wrap: break-word !important;">arctan和arcsin的结果是,这并不能覆盖所有朝向(对于的取值范围已经满足),因此需要用atan2来代替arctan

important; word-wrap: break-word !important;"> 

important; word-wrap: break-word !important;">5. ABB机器人提供了欧拉角与四元数转化的相关函数,其中

important; word-wrap: break-word !important;">object.rot := OrientZYX(anglez, angley, anglex) 函数为欧拉角-四元数函数,注意函数中的顺序为rz,ry,rx

important; word-wrap: break-word !important;">anglex := EulerZYX(X, object.rot); 函数为四元数-欧拉角函数,此处举例提取绕X旋转角度,也可提取绕Y和绕Z旋转角度。

important; word-wrap: break-word !important;">6. 在RAPID端可以自己编写函数,得到欧拉角与四元数转化函数,如下

important; word-wrap: break-word !important;"> 

important; word-wrap: break-word !important;">
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
important; word-wrap: break-word !important;">FUNC orient eulerAnglesToQuaternion(num hdg,num pitch,num roll)important; word-wrap: break-word !important;">       //返回四元数important; word-wrap: break-word !important;">        VAR num cosRoll;important; word-wrap: break-word !important;">        VAR num sinRoll;important; word-wrap: break-word !important;">        VAR num cospitch;important; word-wrap: break-word !important;">        VAR num sinpitch;important; word-wrap: break-word !important;">        VAR num cosheading;important; word-wrap: break-word !important;">        VAR num sinheading;important; word-wrap: break-word !important;">        VAR orient orient1;important; word-wrap: break-word !important;">        important; word-wrap: break-word !important;">        cosRoll:=Cos(roll*0.5);important; word-wrap: break-word !important;">        sinRoll:=Sin(roll*0.5);important; word-wrap: break-word !important;">        cosPitch:=Cos(pitch*0.5);important; word-wrap: break-word !important;">        sinPitch:=Sin(pitch*0.5);important; word-wrap: break-word !important;">        cosHeading:=Cos(hdg*0.5);important; word-wrap: break-word !important;">        sinHeading:=Sin(hdg*0.5);important; word-wrap: break-word !important;">
important; word-wrap: break-word !important;"> orient1.q1:=cosRoll*cosPitch*cosHeading+sinRoll*sinPitch*sinHeading;important; word-wrap: break-word !important;"> orient1.q2:=sinRoll*cosPitch*cosHeading-cosRoll*sinPitch*sinHeading;important; word-wrap: break-word !important;"> orient1.q3:=cosRoll*sinPitch*cosHeading+sinRoll*cosPitch*sinHeading;important; word-wrap: break-word !important;"> orient1.q4:=cosRoll*cosPitch*sinHeading-sinRoll*sinPitch*cosHeading;important; word-wrap: break-word !important;"> RETURN orient1;important; word-wrap: break-word !important;"> ENDFUNCimportant; word-wrap: break-word !important;">
important; word-wrap: break-word !important;"> FUNC num quaternionToEulerAngles(\switch X|switch Y|switch Z,orient orient1)important; word-wrap: break-word !important;">          //返回欧拉角important; word-wrap: break-word !important;"> VAR num q0important; word-wrap: break-word !important;"> VAR num q1;important; word-wrap: break-word !important;"> VAR num q2;important; word-wrap: break-word !important;"> VAR num q3;important; word-wrap: break-word !important;"> q0:=orient1.q1;important; word-wrap: break-word !important;"> q1:=orient1.q2;important; word-wrap: break-word !important;"> q2:=orient1.q3;important; word-wrap: break-word !important;"> q3:=orient1.q4;important; word-wrap: break-word !important;"> IF present(x) return atan2(2*(q2*q3+q0*q1),q0*q0-q1*q1-q2*q2+q3*q3);important; word-wrap: break-word !important;"> IF present(y) return asin(2*(q0*q2-q1*q3));important; word-wrap: break-word !important;"> IF present(z) RETURN atan2(2*(q1*q2+q0*q3),q0*q0+q1*q1-q2*q2-q3*q3);important; word-wrap: break-word !important;">         //roll=atan2f(2. f*(q2q3+q0q1),q0q0-q1q1-q2q2+q3q3);important; word-wrap: break-word !important;">         //pitch=asinf(2. f*(q0q2-q1q3));important; word-wrap: break-word !important;">         //yaw=atan2f(2. f*(q1q2+q0q3),q0q0+q1q1-q2q2-q3q3);important; word-wrap: break-word !important;"> ENDFUNC



 

联系热线:17312666086(微信同号)   联系人:李刚 联系地址:上海市宝山区富联一路98弄6号

技术和报价服务:星期一至星期六8:00-22:00 ABB机器人配件