scara机器人用户坐标系标定与工具坐标(TCP)标定

一、scara机器人用户坐标系标定

在这里插入图片描述
  如上图,坐标系 { x 0 O y 0 } \{x_0Oy_0\} { x0Oy0}为机器人基坐标系,坐标系 { x 1 P y 1 } \{x_1Py_1\} { x1Py1}为需要建立的用户坐标系,这里假设 z z z轴垂直于纸面向外。用户坐标系标定也即确定机器人基坐标系与用户坐标系之间的关系。采用两点法便可标定scara机器人的用户坐标系:
  (1)机器人末端标定针对准点 P P P,记录此时机器人末端坐标为 ( x P , y P ) (x_P,y_P) (xP,yP)
  (2)机器人末端标定针对准点 Q Q Q(用户坐标系 x x x轴上任意一点, ∣ P Q ∣ |PQ| PQ不能太短以免导致计算误差较大),记录此时机器人末端坐标为 ( x Q , y Q ) (x_Q,y_Q) (xQ,yQ)
  (3)用户坐标系到机器人基坐标系的齐次变换矩阵为:
T = [ c o s θ − s i n θ x P s i n θ c o s θ y P 0 0 1 ] (1) T=\left[ \begin{matrix} cos\theta & -sin\theta & x_P \\ sin\theta & cos\theta & y_P \\ 0 & 0 & 1 \\ \end{matrix} \right] \tag{1} T=cosθsinθ0sinθcosθ0xPyP1(1)
  其中:
θ = a t a n 2 ( y Q − y P , x Q − x P ) (2) \theta=atan2(y_Q-y_P,x_Q-x_P) \tag{2} θ=atan2(yQyP,xQxP)(2)
  关于绕任意轴(这里是绕 z z z轴)的旋转矩阵的求解问题,详见另外一篇博文:三维空间任意一点绕任意轴线旋转

二、scara机器人工具坐标(TCP)标定

1、工具固定在小臂

在这里插入图片描述
  如上图,scara机器人大臂为 L 1 = ∣ O A ∣ L_1=|OA| L1=OA,小臂为 L 2 = ∣ A B ∣ L_2=|AB| L2=AB,固定在小臂的工具为 C D CD CD θ 1 , θ 2 \theta_1,\theta_2 θ1,θ2为关节角度,坐标系 { x 0 O y 0 } \{x_0Oy_0\} { x0Oy0}为机器人基坐标系,坐标系 { x e B y e } \{x_eBy_e\} { xeBye}为机器人小臂末端坐标系。工具固定在小臂的 T C P TCP TCP即为点 D D D在坐标系 { x e B y e } \{x_eBy_e\} { xeBye}的坐标,可以利用两点法求得。
  将坐标系 { x e B y e } \{x_eBy_e\} { xeBye}沿向量 B A ⃗ \vec{BA} BA 平移至点 A A A,建立辅助坐标系 { x 1 A y 1 } \{x_1Ay_1\} { x1Ay1}。将点 D D D对准机器人工作空间里任意一点,此时机器人两关节角度分别为 θ 1 ( 1 ) , θ 2 ( 1 ) \theta_1^{(1)},\theta_2^{(1)} θ1(1),θ2(1),将 ∣ A D ∣ |AD| AD视为机器人的小臂长,根据运动学正解得:(详见博文:scara机器人运动学正逆解)
{ x D = L 1 c o s θ 1 ( 1 ) + ∣ A D ∣ c o s ( θ 1 ( 1 ) + θ 2 ( 1 ) + α ) y D = L 1 s i n θ 1 ( 1 ) + ∣ A D ∣ s i n ( θ 1 ( 1 ) + θ 2 ( 1 ) + α ) (3) \left \{ \begin{array}{c} x_D=L_1cos\theta_1^{(1)}+|AD|cos(\theta_1^{(1)}+\theta_2^{(1)}+\alpha) \\ \tag 3 y_D=L_1sin\theta_1^{(1)}+|AD|sin(\theta_1^{(1)}+\theta_2^{(1)}+\alpha) \end{array}\right. { xD=L1cosθ1(1)+ADcos(θ1(1)+θ2(1)+α)yD=L1sinθ1(1)+ADsin(θ1(1)+θ2(1)+α)(3)
  上式展开得:
{ x D = L 1 c o s θ 1 ( 1 ) + ∣ A D ∣ [ c o s ( θ 1 ( 1 ) + θ 2 ( 1 ) ) c o s α − s i n ( θ 1 ( 1 ) + θ 2 ( 1 ) ) s i n α ] y D = L 1 s i n θ 1 ( 1 ) + ∣ A D ∣ [ s i n ( θ 1 ( 1 ) + θ 2 ( 1 ) ) c o s α + c o s ( θ 1 ( 1 ) + θ 2 ( 1 ) ) s i n α ] (4) \left \{ \begin{array}{c} x_D=L_1cos\theta_1^{(1)}+|AD|[cos(\theta_1^{(1)}+\theta_2^{(1)})cos\alpha-sin(\theta_1^{(1)}+\theta_2^{(1)})sin\alpha] \\ \tag 4 y_D=L_1sin\theta_1^{(1)}+|AD|[sin(\theta_1^{(1)}+\theta_2^{(1)})cos\alpha+cos(\theta_1^{(1)}+\theta_2^{(1)})sin\alpha ] \end{array}\right. { xD=L1cosθ1(1)+AD[cos(θ1(1)+θ2(1))cosαsin(θ1(1)+θ2(1))sinα]yD=L1sinθ1(1)+AD[sin(θ1(1)+θ2(1))cosα+cos(θ1(1)+θ2(1))sinα](4)
  设点 D D D在坐标系 { x 1 A y 1 } \{x_1Ay_1\} { x1Ay1}的坐标为 ( x D ′ , y D ′ ) (x_D',y_D') (xD,yD),则 x D ′ = ∣ A D ∣ c o s α , y D ′ = ∣ A D ∣ s i n α x_D'=|AD|cos\alpha,y_D'=|AD|sin\alpha xD=ADcosα,yD=ADsinα,上式化简为:
{ x D = L 1 c o s θ 1 ( 1 ) + c o s ( θ 1 ( 1 ) + θ 2 ( 1 ) ) x D ′ − s i n ( θ 1 ( 1 ) + θ 2 ( 1 ) ) y D ′ y D = L 1 s i n θ 1 ( 1 ) + s i n ( θ 1 ( 1 ) + θ 2 ( 1 ) ) x D ′ + c o s ( θ 1 ( 1 ) + θ 2 ( 1 ) ) y D ′ (5) \left \{ \begin{array}{c} x_D=L_1cos\theta_1^{(1)}+cos(\theta_1^{(1)}+\theta_2^{(1)})x_D'-sin(\theta_1^{(1)}+\theta_2^{(1)})y_D' \\ \tag 5 y_D=L_1sin\theta_1^{(1)}+sin(\theta_1^{(1)}+\theta_2^{(1)})x_D'+cos(\theta_1^{(1)}+\theta_2^{(1)})y_D' \end{array}\right. { xD=L1cosθ1(1)+cos(θ1(1)+θ2(1))xDsin(θ1(1)+θ2(1))yDyD=L1sinθ1(1)+sin(θ1(1)+θ2(1))xD+cos(θ1(1)+θ2(1))yD(5)

  在另一手系下,将点 D D D对准机器人工作空间同一点,此时机器人两关节角度分别为 θ 1 ( 2 ) , θ 2 ( 2 ) \theta_1^{(2)},\theta_2^{(2)} θ1(2),θ2(2),同理可得:
{ x D = L 1 c o s θ 1 ( 2 ) + c o s ( θ 1 ( 2 ) + θ 2 ( 2 ) ) x D ′ − s i n ( θ 1 ( 2 ) + θ 2 ( 2 ) ) y D ′ y D = L 1 s i n θ 1 ( 2 ) + s i n ( θ 1 ( 2 ) + θ 2 ( 2 ) ) x D ′ + c o s ( θ 1 ( 2 ) + θ 2 ( 2 ) ) y D ′ (6) \left \{ \begin{array}{c} x_D=L_1cos\theta_1^{(2)}+cos(\theta_1^{(2)}+\theta_2^{(2)})x_D'-sin(\theta_1^{(2)}+\theta_2^{(2)})y_D' \\ \tag 6 y_D=L_1sin\theta_1^{(2)}+sin(\theta_1^{(2)}+\theta_2^{(2)})x_D'+cos(\theta_1^{(2)}+\theta_2^{(2)})y_D' \end{array}\right. { xD=L1cosθ1(2)+cos(θ1(2)+θ2(2))xDsin(θ1(2)+θ2(2))yDyD=L1sinθ1(2)+sin(θ1(2)+θ2(2))xD+cos(θ1(2)+θ2(2))yD(6)
  令:
{ a 11 = c o s ( θ 1 ( 2 ) + θ 2 ( 2 ) ) − c o s ( θ 1 ( 1 ) + θ 2 ( 1 ) ) a 12 = − s i n ( θ 1 ( 2 ) + θ 2 ( 2 ) ) + s i n ( θ 1 ( 1 ) + θ 2 ( 1 ) ) b 1 = L 1 ( − c o s θ 1 ( 2 ) + c o s θ 1 ( 1 ) ) a 21 = s i n ( θ 1 ( 2 ) + θ 2 ( 2 ) ) − s i n ( θ 1 ( 1 ) + θ 2 ( 1 ) ) a 22 = c o s ( θ 1 ( 2 ) + θ 2 ( 2 ) ) + c o s ( θ 1 ( 1 ) + θ 2 ( 1 ) ) b 2 = L 1 ( − s i n θ 1 ( 2 ) + s i n θ 1 ( 1 ) ) (7) \begin{cases} a_{11}=cos(\theta_1^{(2)}+\theta_2^{(2)}) - cos(\theta_1^{(1)}+\theta_2^{(1)}) \\ \tag 7 a_{12}= -sin(\theta_1^{(2)}+\theta_2^{(2)}) + sin(\theta_1^{(1)}+\theta_2^{(1)})\\ b_1 = L_1(-cos\theta_1^{(2)}+cos\theta_1^{(1)}) \\ a_{21}=sin(\theta_1^{(2)}+\theta_2^{(2)}) - sin(\theta_1^{(1)}+\theta_2^{(1)}) \\ a_{22}= cos(\theta_1^{(2)}+\theta_2^{(2)}) +cos(\theta_1^{(1)}+\theta_2^{(1)})\\ b_2 = L_1(-sin\theta_1^{(2)}+sin\theta_1^{(1)}) \\ \end{cases} a11=cos(θ1(2)+θ2(2))cos(θ1(1)+θ2(1))a12=sin(θ1(2)+θ2(2))+sin(θ1(1)+θ2(1))b1=L1(cosθ1(2)+cosθ1(1))a21=sin(θ1(2)+θ2(2))sin(θ1(1)+θ2(1))a22=cos(θ1(2)+θ2(2))+cos(θ1(1)+θ2(1))b2=L1(sinθ1(2)+sinθ1(1))(7)

  联立式(5)和式(6),解得:
{ x D ′ = − ( a 12 b 2 − a 22 b 1 ) / ( a 11 a 22 − a 12 a 21 ) y D ′ = ( a 11 b 2 − a 21 b 1 ) / ( a 11 a 22 − a 12 a 21 ) (8) \begin{cases} x_D'=-(a_{12}b_2 - a_{22}b_1)/(a_{11}a_{22} - a_{12}a_{21}) \\ y_D'=(a_{11}b_2 - a_{21}b_1)/(a_{11}a_{22} - a_{12}a_{21}) \\ \tag {8} \end{cases} { xD=(a12b2a22b1)/(a11a22a12a21)yD=(a11b2a21b1)/(a11a22a12a21)(8)
  工具 T C P TCP TCP为:
{ t x D = x D ′ − L 2 t y D = y D ′ (9) \begin{cases} t_{xD}=x_D'-L_2 \\ t_{yD}=y_D' \\ \tag {9} \end{cases} { txD=xDL2tyD=yD(9)

2、工具固定在末端

在这里插入图片描述
  如上图,scara机器人大臂为 L 1 = ∣ O A ∣ L_1=|OA| L1=OA,小臂为 L 2 = ∣ A B ∣ L_2=|AB| L2=AB,固定在末端的工具为 B D BD BD,其长度为 R R R θ 1 , θ 2 , θ 4 \theta_1,\theta_2,\theta_4 θ1,θ2,θ4为关节角度,坐标系 { x 0 O y 0 } \{x_0Oy_0\} { x0Oy0}为机器人基坐标系,坐标系 { x e B y e } \{x_eBy_e\} { xeBye}为机器人末端坐标系。工具固定在末端的 T C P TCP TCP即为点 D D D在坐标系 { x e B y e } \{x_eBy_e\} { xeBye}的坐标,可以利用两点法求得。
  将点 D D D对准机器人工作空间里任意一点,此时机器人末端位姿为 ( x B ( 1 ) , y B ( 1 ) , c B ( 1 ) ) (x_B^{(1)},y_B^{(1)},c_B^{(1)}) (xB(1),yB(1),cB(1)),根据运动学正解得:
{ x D = x B ( 1 ) + R c o s ( c B ( 1 ) + α ) y D = y B ( 1 ) + R s i n ( c B ( 1 ) + α ) (10) \left \{ \begin{array}{c} x_D=x_B^{(1)}+Rcos(c_B^{(1)}+\alpha)\\ \tag {10} y_D=y_B^{(1)}+Rsin(c_B^{(1)}+\alpha) \end{array}\right. { xD=xB(1)+Rcos(cB(1)+α)yD=yB(1)+Rsin(cB(1)+α)(10)
  上式展开得:
{ x D = x B ( 1 ) + R [ c o s ( c B ( 1 ) ) c o s α − s i n ( c B ( 1 ) ) s i n α ] y D = y B ( 1 ) + R [ s i n ( c B ( 1 ) ) c o s α + c o s ( c B ( 1 ) ) s i n α ] (11) \left \{ \begin{array}{c} x_D=x_B^{(1)} +R[cos(c_B^{(1)})cos\alpha-sin(c_B^{(1)})sin\alpha]\\ \tag {11} y_D=y_B^{(1)} +R[sin(c_B^{(1)})cos\alpha+cos(c_B^{(1)})sin\alpha] \end{array}\right. { xD=xB(1)+R[cos(cB(1))cosαsin(cB(1))sinα]yD=yB(1)+R[sin(cB(1))cosα+cos(cB(1))sinα](11)
  设点 D D D在坐标系 { x e B y e } \{x_eBy_e\} { xeBye}的坐标为 ( t x D , t y D ) (t_{xD},t_{yD}) (txD,tyD),则 t x D = R c o s α , t y D = R s i n α t_{xD}=Rcos\alpha,t_{yD}=Rsin\alpha txD=Rcosα,tyD=Rsinα,上式化简为:
{ x D = x B ( 1 ) + c o s ( c B ( 1 ) ) t x D − s i n ( c B ( 1 ) ) t y D y D = y B ( 1 ) + s i n ( c B ( 1 ) ) t x D + c o s ( c B ( 1 ) ) t y D (12) \left \{ \begin{array}{c} x_D=x_B^{(1)} +cos(c_B^{(1)})t_{xD}-sin(c_B^{(1)})t_{yD}\\ \tag {12} y_D=y_B^{(1)} +sin(c_B^{(1)})t_{xD}+cos(c_B^{(1)})t_{yD} \end{array}\right. { xD=xB(1)+cos(cB(1))txDsin(cB(1))tyDyD=yB(1)+sin(cB(1))txD+cos(cB(1))tyD(12)

  在另一位姿下,将点 D D D对准机器人工作空间同一点,此时机器人末端位姿为 ( x B ( 2 ) , y B ( 2 ) , c B ( 2 ) ) (x_B^{(2)},y_B^{(2)},c_B^{(2)}) (xB(2),yB(2),cB(2)),同理可得:
{ x D = x B ( 2 ) + c o s ( c B ( 2 ) ) t x D − s i n ( c B ( 2 ) ) t y D y D = y B ( 2 ) + s i n ( c B ( 2 ) ) t x D + c o s ( c B ( 2 ) ) t y D (13) \left \{ \begin{array}{c} x_D=x_B^{(2)} +cos(c_B^{(2)})t_{xD}-sin(c_B^{(2)})t_{yD}\\ \tag {13} y_D=y_B^{(2)} +sin(c_B^{(2)})t_{xD}+cos(c_B^{(2)})t_{yD} \end{array}\right. { xD=xB(2)+cos(cB(2))txDsin(cB(2))tyDyD=yB(2)+sin(cB(2))txD+cos(cB(2))tyD(13)

  令:
{ a 11 = c o s ( c B ( 2 ) ) − c o s ( c B ( 1 ) ) a 12 = − s i n ( c B ( 2 ) ) + s i n ( c B ( 1 ) ) b 1 = − x B ( 2 ) + x B ( 1 ) a 21 = s i n ( c B ( 2 ) ) − s i n ( c B ( 1 ) ) a 22 = c o s ( c B ( 2 ) ) + c o s ( c B ( 1 ) ) b 2 = − y B ( 2 ) + y B ( 1 ) (14) \begin{cases} a_{11}=cos(c_B^{(2)}) - cos(c_B^{(1)}) \\ \tag {14} a_{12}= -sin(c_B^{(2)}) + sin(c_B^{(1)})\\ b_1 =-x_B^{(2)} +x_B^{(1)}\\ a_{21}=sin(c_B^{(2)}) - sin(c_B^{(1)}) \\ a_{22}= cos(c_B^{(2)}) +cos(c_B^{(1)})\\ b_2 = -y_B^{(2)} +y_B^{(1)} \\ \end{cases} a11=cos(cB(2))cos(cB(1))a12=sin(cB(2))+sin(cB(1))b1=xB(2)+xB(1)a21=sin(cB(2))sin(cB(1))a22=cos(cB(2))+cos(cB(1))b2=yB(2)+yB(1)(14)

  联立式(11)和式(12),解得工具 T C P TCP TCP为:
{ t x D = − ( a 12 b 2 − a 22 b 1 ) / ( a 11 a 22 − a 12 a 21 ) t y D = ( a 11 b 2 − a 21 b 1 ) / ( a 11 a 22 − a 12 a 21 ) (15) \begin{cases} t_{xD}=-(a_{12}b_2 - a_{22}b_1)/(a_{11}a_{22} - a_{12}a_{21}) \\ t_{yD}=(a_{11}b_2 - a_{21}b_1)/(a_{11}a_{22} - a_{12}a_{21}) \\ \tag {15} \end{cases} { txD=(a12b2a22b1)/(a11a22a12a21)tyD=(a11b2a21b1)/(a11a22a12a21)(15)

猜你喜欢

转载自blog.csdn.net/maple_2014/article/details/105030198