0


机械臂六维力传感器重力补偿原理

重力补偿原理

1.力传感器数据分析

在这里插入图片描述

将六维力传感器三个力分量与力矩分量的零点值分别记为

  1. (
  2. F
  3. x
  4. 0
  5. ,
  6. F
  7. y
  8. 0
  9. ,
  10. F
  11. z
  12. 0
  13. )
  14. (F_{x0},F_{y0},F_{z0})
  15. (Fx0​,Fy0​,Fz0​),
  16. (
  17. M
  18. x
  19. 0
  20. ,
  21. M
  22. y
  23. 0
  24. ,
  25. M
  26. z
  27. 0
  28. )
  29. (M_{x0},M_{y0},M_{z0})
  30. (Mx0​,My0​,Mz0​),

传感器与末端工装重力为

  1. G
  2. G
  3. G,质心在六维力传感器坐标系中的坐标为
  4. (
  5. x
  6. ,
  7. y
  8. ,
  9. z
  10. )
  11. (x,y,z)
  12. (x,y,z),

重力

  1. G
  2. G
  3. G在三个坐标轴方向上的分力与作用力矩分别为
  4. (
  5. G
  6. x
  7. ,
  8. G
  9. y
  10. ,
  11. G
  12. z
  13. )
  14. (G_x,G_y,G_z)
  15. (Gx​,Gy​,Gz​),
  16. (
  17. M
  18. g
  19. x
  20. ,
  21. M
  22. g
  23. y
  24. ,
  25. M
  26. g
  27. z
  28. )
  29. (M_{gx},M_{gy},M_{gz})
  30. (Mgx​,Mgy​,Mgz​)。

根据力与力矩的关系可以得到(正方向由右手定则确定):

  1. {
  2. M
  3. g
  4. x
  5. =
  6. G
  7. z
  8. ×
  9. y
  10. G
  11. y
  12. ×
  13. z
  14. M
  15. g
  16. y
  17. =
  18. G
  19. x
  20. ×
  21. z
  22. G
  23. z
  24. ×
  25. x
  26. M
  27. g
  28. z
  29. =
  30. G
  31. y
  32. ×
  33. x
  34. G
  35. x
  36. ×
  37. y
  38. \left\{ \begin{array}{c} M_{gx}=G_z \times y-G_y \times z\\ M_{gy}=G_x \times z-G_z \times x\\ M_{gz}=G_y \times x-G_x \times y \end{array} \right.
  39. ⎩⎨⎧​Mgx​=Gz​×yGy​×zMgy​=Gx​×zGz​×xMgz​=Gy​×xGx​×y

将六维力传感器直接测量得到的三个方向的力分量与力矩分量分别记为

  1. (
  2. F
  3. x
  4. ,
  5. F
  6. y
  7. ,
  8. F
  9. z
  10. )
  11. (F_x,F_y,F_z)
  12. (Fx​,Fy​,Fz​),
  13. (
  14. M
  15. x
  16. ,
  17. M
  18. y
  19. ,
  20. M
  21. z
  22. )
  23. (M_x,M_y,M_z)
  24. (Mx​,My​,Mz​),

假设标定的时候没有外部作用力在末端夹持器上,则力传感器所测得的力和力矩由负载重力及零点组成,则有

  1. {
  2. F
  3. x
  4. =
  5. G
  6. x
  7. +
  8. F
  9. x
  10. 0
  11. F
  12. y
  13. =
  14. G
  15. y
  16. +
  17. F
  18. y
  19. 0
  20. F
  21. z
  22. =
  23. G
  24. z
  25. +
  26. F
  27. z
  28. 0
  29. \left\{ \begin{array}{c} F_x=G_x+F_{x0}\\ F_y=G_y+F_{y0}\\ F_z=G_z+F_{z0} \end{array} \right.
  30. ⎩⎨⎧​Fx​=Gx​+Fx0Fy​=Gy​+Fy0Fz​=Gz​+Fz0​​
  31. {
  32. M
  33. x
  34. =
  35. M
  36. g
  37. x
  38. +
  39. M
  40. x
  41. 0
  42. M
  43. y
  44. =
  45. M
  46. g
  47. y
  48. +
  49. M
  50. y
  51. 0
  52. M
  53. z
  54. =
  55. M
  56. g
  57. z
  58. +
  59. M
  60. z
  61. 0
  62. \left\{ \begin{array}{c} M_x=M_{gx}+M_{x0}\\ M_y=M_{gy}+M_{y0}\\ M_z=M_{gz}+M_{z0} \end{array} \right.
  63. ⎩⎨⎧​Mx​=Mgx​+Mx0My​=Mgy​+My0Mz​=Mgz​+Mz0​​

联立得:

  1. {
  2. M
  3. x
  4. =
  5. (
  6. F
  7. z
  8. F
  9. z
  10. 0
  11. )
  12. ×
  13. y
  14. (
  15. F
  16. y
  17. F
  18. y
  19. 0
  20. )
  21. ×
  22. z
  23. +
  24. M
  25. x
  26. 0
  27. M
  28. y
  29. =
  30. (
  31. F
  32. x
  33. F
  34. x
  35. 0
  36. )
  37. ×
  38. z
  39. (
  40. F
  41. z
  42. F
  43. z
  44. 0
  45. )
  46. ×
  47. x
  48. +
  49. M
  50. y
  51. 0
  52. M
  53. z
  54. =
  55. (
  56. F
  57. y
  58. F
  59. y
  60. 0
  61. )
  62. ×
  63. x
  64. (
  65. F
  66. x
  67. F
  68. x
  69. 0
  70. )
  71. ×
  72. y
  73. +
  74. M
  75. z
  76. 0
  77. \left\{ \begin{array}{c} M_x=(F_z-F_{z0}) \times y-(F_y-F_{y0}) \times z+M_{x0}\\ M_y=(F_x-F_{x0}) \times z-(F_z-F_{z0}) \times x+M_{y0}\\ M_z=(F_y-F_{y0}) \times x-(F_x-F_{x0}) \times y+M_{z0} \end{array} \right.
  78. ⎩⎨⎧​Mx​=(Fz​−Fz0​)×y−(Fy​−Fy0​)×z+Mx0My​=(Fx​−Fx0​)×z−(Fz​−Fz0​)×x+My0Mz​=(Fy​−Fy0​)×x−(Fx​−Fx0​)×y+Mz0​​
  79. {
  80. M
  81. x
  82. =
  83. F
  84. z
  85. ×
  86. y
  87. F
  88. y
  89. ×
  90. z
  91. +
  92. M
  93. x
  94. 0
  95. +
  96. F
  97. y
  98. 0
  99. ×
  100. z
  101. F
  102. z
  103. 0
  104. ×
  105. y
  106. M
  107. y
  108. =
  109. F
  110. x
  111. ×
  112. z
  113. F
  114. z
  115. ×
  116. x
  117. +
  118. M
  119. y
  120. 0
  121. +
  122. F
  123. z
  124. 0
  125. ×
  126. x
  127. F
  128. x
  129. 0
  130. ×
  131. z
  132. M
  133. z
  134. =
  135. F
  136. y
  137. ×
  138. x
  139. F
  140. x
  141. ×
  142. y
  143. +
  144. M
  145. z
  146. 0
  147. +
  148. F
  149. x
  150. 0
  151. ×
  152. y
  153. F
  154. y
  155. 0
  156. ×
  157. x
  158. \left\{ \begin{array}{c} M_x=F_z \times y - F_y \times z + M_{x0} + F_{y0} \times z -F_{z0} \times y \\ M_y=F_x \times z - F_z \times x + M_{y0} + F_{z0} \times x -F_{x0} \times z \\ M_z=F_y \times x - F_x \times y + M_{z0} + F_{x0} \times y -F_{y0} \times x \end{array} \right.
  159. ⎩⎨⎧​Mx​=Fz​×yFy​×z+Mx0​+Fy0​×zFz0​×yMy​=Fx​×zFz​×x+My0​+Fz0​×xFx0​×zMz​=Fy​×xFx​×y+Mz0​+Fx0​×yFy0​×x

其中的

  1. F
  2. x
  3. 0
  4. ,
  5. F
  6. y
  7. 0
  8. ,
  9. F
  10. z
  11. 0
  12. ,
  13. M
  14. x
  15. 0
  16. ,
  17. M
  18. y
  19. 0
  20. ,
  21. M
  22. z
  23. 0
  24. ,
  25. x
  26. ,
  27. y
  28. ,
  29. z
  30. F_{x0},F_{y0},F_{z0},M_{x0},M_{y0},M_{z0},x,y,z
  31. Fx0​,Fy0​,Fz0​,Mx0​,My0​,Mz0​,x,y,z为定值常数(忽略力传感器数据波动,并且末端工装不进行更换)

2.最小二乘法求解参数

2.1力矩方程

  1. {
  2. k
  3. 1
  4. =
  5. M
  6. x
  7. 0
  8. +
  9. F
  10. y
  11. 0
  12. ×
  13. z
  14. F
  15. z
  16. 0
  17. ×
  18. y
  19. k
  20. 2
  21. =
  22. M
  23. y
  24. 0
  25. +
  26. F
  27. z
  28. 0
  29. ×
  30. x
  31. F
  32. x
  33. 0
  34. ×
  35. z
  36. k
  37. 3
  38. =
  39. M
  40. z
  41. 0
  42. +
  43. F
  44. x
  45. 0
  46. ×
  47. y
  48. F
  49. y
  50. 0
  51. ×
  52. x
  53. \left\{ \begin{array}{c} k_1=M_{x0} + F_{y0} \times z -F_{z0} \times y\\ k_2=M_{y0} + F_{z0} \times x -F_{x0} \times z\\ k_3=M_{z0} + F_{x0} \times y -F_{y0} \times x \end{array} \right.
  54. ⎩⎨⎧​k1​=Mx0​+Fy0​×zFz0​×yk2​=My0​+Fz0​×xFx0​×zk3​=Mz0​+Fx0​×yFy0​×x

则:

  1. [
  2. M
  3. x
  4. M
  5. y
  6. M
  7. z
  8. ]
  9. =
  10. [
  11. 0
  12. F
  13. z
  14. F
  15. y
  16. 1
  17. 0
  18. 0
  19. F
  20. z
  21. 0
  22. F
  23. x
  24. 0
  25. 1
  26. 0
  27. F
  28. y
  29. F
  30. x
  31. 0
  32. 0
  33. 0
  34. 1
  35. ]
  36. [
  37. x
  38. y
  39. z
  40. k
  41. 1
  42. k
  43. 2
  44. k
  45. 3
  46. ]
  47. \begin{equation} \left[ \begin{array}{c} M_x \\ M_y \\ M_z \end{array} \right]= \left[ \begin{array}{ccc} 0 & F_z & -F_y & 1 & 0 & 0 \\ -F_z & 0 & F_x & 0 & 1 & 0 \\ F_y & -F_x & 0 & 0 & 0 & 1 \end{array} \right] \left[ \begin{array}{c} x \\ y \\ z \\ k1 \\ k2 \\ k3 \end{array} \right] \end{equation}
  48. MxMyMz​​​=​0FzFy​​Fz0Fx​​−FyFx0100010001​​​xyzk1k2k3​​​​

控制机械臂末端夹持器的位姿,取N个不同的姿态(N

  1. \geq
  2. 3,要求至少有三个姿态下的机械臂末端夹持器的指向向量不共面),得到N组六维力数据传感器数据,
  3. M
  4. =
  5. F
  6. A
  7. M=F \cdot A
  8. M=FA ,其中
  9. A
  10. =
  11. [
  12. x
  13. ,
  14. y
  15. ,
  16. z
  17. ,
  18. k
  19. 1
  20. ,
  21. k
  22. 2
  23. ,
  24. k
  25. 3
  26. ]
  27. T
  28. A=[x,y,z,k_1,k_2,k_3]^\mathrm{T}
  29. A=[x,y,z,k1​,k2​,k3​]T,则矩阵的最小二乘解为
  30. A
  31. =
  32. (
  33. F
  34. T
  35. F
  36. )
  37. 1
  38. F
  39. T
  40. M
  41. A=(F^\mathrm{T}F)^{-1}\cdot F^{\mathrm{T}}\cdot M
  42. A=(FTF)−1FTM

由多组数据可以解出负载质心在六维力传感器坐标系中的坐标

  1. (
  2. x
  3. ,
  4. y
  5. ,
  6. z
  7. )
  8. (x,y,z)
  9. (x,y,z)以及常数
  10. (
  11. k
  12. 1
  13. ,
  14. k
  15. 2
  16. ,
  17. k
  18. 3
  19. )
  20. (k_1,k_2,k_3)
  21. (k1​,k2​,k3​)的值。

2.2力方程

在机器人的安装固定过程中,由于安装平台会存在一定的斜度,使得机器人的基坐标系与世界坐标系出现一定的夹角,同样也会使得传感器的测量值与实际值存在一定偏差,因此需要进行倾角的计算。

记世界坐标系为

  1. O
  2. {O}
  3. O,基坐标系为
  4. B
  5. B
  6. B,法兰坐标系为
  7. W
  8. W
  9. W,力传感器坐标系为
  10. C
  11. {C}
  12. C,则由基坐标系向世界坐标系的姿态变换矩阵为:
  13. B
  14. O
  15. R
  16. =
  17. [
  18. 1
  19. 0
  20. 0
  21. 0
  22. c
  23. o
  24. s
  25. U
  26. s
  27. i
  28. n
  29. U
  30. 0
  31. s
  32. i
  33. n
  34. U
  35. c
  36. o
  37. s
  38. U
  39. ]
  40. [
  41. c
  42. o
  43. s
  44. V
  45. 0
  46. s
  47. i
  48. n
  49. V
  50. 0
  51. 1
  52. 0
  53. s
  54. i
  55. n
  56. V
  57. 0
  58. c
  59. o
  60. s
  61. V
  62. ]
  63. \begin{equation} ^O_BR= \left[ \begin{array}{ccc} 1 & 0 & 0 \\ 0 & cosU & sinU \\ 0 & sinU & cosU \end{array} \right] \left[ \begin{array}{ccc} cosV & 0 &sinV\\ 0 & 1 & 0\\ -sinV & 0 & cosV \\ \end{array} \right] \end{equation}
  64. BOR=​1000cosUsinU0sinUcosU​​​cosV0sinV010sinV0cosV​​​​

其中

  1. U
  2. U
  3. U是绕世界坐标系
  4. x
  5. x
  6. x轴的旋转角,
  7. V
  8. V
  9. V是绕基坐标系的
  10. y
  11. y
  12. y轴的旋转角

由末端法兰到基坐标系的姿态变换矩阵为:

  1. W
  2. B
  3. R
  4. =
  5. R
  6. z
  7. (
  8. A
  9. )
  10. R
  11. y
  12. (
  13. B
  14. )
  15. R
  16. x
  17. (
  18. C
  19. )
  20. ^B_WR=R_z(A) R_y(B) R_x(C)
  21. WBR=Rz​(A)Ry​(B)Rx​(C)
  22. A
  23. B
  24. C
  25. A B C
  26. ABC的值可以通过机器人示教器读出

因为力传感器安装到末端时,会存在

  1. Z
  2. Z
  3. Z轴上的一定偏角
  4. α
  5. \alpha
  6. α(可通过更换机器人参考坐标系手动将其重合,即偏角为0),由力传感器向法兰坐标系坐标系的姿态变换矩阵为:
  7. C
  8. W
  9. R
  10. =
  11. [
  12. c
  13. o
  14. s
  15. α
  16. s
  17. i
  18. n
  19. α
  20. 0
  21. s
  22. i
  23. n
  24. α
  25. c
  26. o
  27. s
  28. α
  29. 0
  30. 0
  31. 0
  32. 1
  33. ]
  34. \begin{equation} ^W_CR= \left[ \begin{array}{ccc} cos\alpha & -sin\alpha & 0 \\ sin\alpha & cos\alpha & 0 \\ 0 & 0 & 1 \end{array} \right] \end{equation}
  35. CWR=​cosαsinα0​−sinαcosα0001​​​​

则由世界坐标系到六维力传感器坐标系的姿态变换矩阵为

  1. 0
  2. C
  3. R
  4. =
  5. W
  6. C
  7. R
  8. B
  9. W
  10. R
  11. O
  12. B
  13. R
  14. =
  15. C
  16. W
  17. R
  18. T
  19. W
  20. B
  21. R
  22. T
  23. B
  24. O
  25. R
  26. T
  27. {^C_0R} = {^C_WR} \cdot {^W_BR} \cdot {^B_OR} = {^W_CR}^\mathrm{T} \cdot {^B_WR}^\mathrm{T} \cdot {^O_BR}^\mathrm{T}
  28. 0CR=WCRBWROBR=CWRTWBRTBORT

重力在世界坐标系

  1. O
  2. {O}
  3. O中的表示为
  4. O
  5. G
  6. =
  7. [
  8. 0
  9. ,
  10. 0
  11. ,
  12. g
  13. ]
  14. T
  15. {^{O}G=[0,0,-g]^\mathrm{T}}
  16. OG=[0,0,−g]T,

通过坐标变换,将重力分解到力传感器坐标系

  1. C
  2. {C}
  3. C得到
  4. C
  5. G
  6. =
  7. O
  8. C
  9. R
  10. O
  11. G
  12. =
  13. W
  14. C
  15. R
  16. B
  17. W
  18. R
  19. O
  20. B
  21. R
  22. O
  23. G
  24. =
  25. C
  26. W
  27. R
  28. T
  29. W
  30. B
  31. R
  32. T
  33. B
  34. O
  35. R
  36. T
  37. O
  38. G
  39. =
  40. C
  41. W
  42. R
  43. T
  44. W
  45. B
  46. R
  47. T
  48. [
  49. c
  50. o
  51. s
  52. U
  53. s
  54. i
  55. n
  56. V
  57. g
  58. s
  59. i
  60. n
  61. U
  62. g
  63. c
  64. o
  65. s
  66. U
  67. c
  68. o
  69. s
  70. V
  71. g
  72. ]
  73. ^{C}G=^C_OR \cdot {^{O}G}= {^C_WR} \cdot {^W_BR} \cdot {^B_OR} \cdot {^{O}G} ={^W_CR}^\mathrm{T} \cdot {^B_WR}^\mathrm{T} \cdot {^O_BR}^\mathrm{T} \cdot {^{O}G} \\ ={^W_CR}^\mathrm{T} \cdot {^B_WR}^\mathrm{T} \cdot \left[ \begin{array}{c} cosUsinV * g \\ -sinU * g \\ -cosUcosV * g \end{array} \right]
  74. CG=OCROG=WCRBWROBROG=CWRTWBRTBORTOG=CWRTWBRT⋅​cosUsinVgsinUgcosUcosVg​​

则:

  1. [
  2. F
  3. x
  4. ,
  5. F
  6. y
  7. ,
  8. F
  9. z
  10. ]
  11. T
  12. =
  13. [
  14. G
  15. x
  16. ,
  17. G
  18. y
  19. ,
  20. G
  21. z
  22. ]
  23. T
  24. +
  25. [
  26. F
  27. x
  28. 0
  29. ,
  30. F
  31. y
  32. 0
  33. ,
  34. F
  35. z
  36. 0
  37. ]
  38. T
  39. =
  40. O
  41. C
  42. R
  43. O
  44. G
  45. +
  46. [
  47. F
  48. x
  49. 0
  50. ,
  51. F
  52. y
  53. 0
  54. ,
  55. F
  56. z
  57. 0
  58. ]
  59. T
  60. [F_x,F_y,F_z]^{\mathrm{T}}=[G_x,G_y,G_z]^{\mathrm{T}}+[F_{x0},F_{y0},F_{z0}]^{\mathrm{T}}=^C_OR \cdot {^{O}G}+[F_{x0},F_{y0},F_{z0}]^{\mathrm{T}}
  61. [Fx​,Fy​,Fz​]T=[Gx​,Gy​,Gz​]T+[Fx0​,Fy0​,Fz0​]T=OCROG+[Fx0​,Fy0​,Fz0​]T
  62. [
  63. F
  64. x
  65. F
  66. y
  67. F
  68. z
  69. ]
  70. =
  71. [
  72. C
  73. W
  74. R
  75. T
  76. W
  77. B
  78. R
  79. T
  80. I
  81. ]
  82. [
  83. c
  84. o
  85. s
  86. U
  87. s
  88. i
  89. n
  90. V
  91. g
  92. s
  93. i
  94. n
  95. U
  96. g
  97. c
  98. o
  99. s
  100. U
  101. c
  102. o
  103. s
  104. V
  105. g
  106. F
  107. x
  108. 0
  109. F
  110. y
  111. 0
  112. F
  113. z
  114. 0
  115. ]
  116. \begin{equation} \left[ \begin{array}{c} F_x \\ F_y \\ F_z \end{array} \right]= \left[ \begin{array}{ccc} {^W_CR}^\mathrm{T} \cdot {^B_WR}^\mathrm{T} & I \end{array} \right] \left[ \begin{array}{c} cosUsinV * g \\ -sinU * g \\ -cosUcosV * g \\ F_{x0} \\ F_{y0} \\ F_{z0} \end{array} \right] \end{equation}
  117. FxFyFz​​​=[CWRTWBRTI​]​cosUsinVgsinUgcosUcosVgFx0Fy0Fz0​​​​​

令:

  1. {
  2. L
  3. x
  4. =
  5. c
  6. o
  7. s
  8. U
  9. s
  10. i
  11. n
  12. V
  13. g
  14. L
  15. y
  16. =
  17. s
  18. i
  19. n
  20. U
  21. g
  22. L
  23. z
  24. =
  25. c
  26. o
  27. s
  28. U
  29. c
  30. o
  31. s
  32. V
  33. g
  34. \left\{ \begin{array}{c} L_x=cosUsinV * g\\ L_y=-sinU * g\\ L_z= -cosUcosV * g \end{array} \right.
  35. ⎩⎨⎧​Lx​=cosUsinVgLy​=−sinUgLz​=−cosUcosVg

则可以表示为:

  1. [
  2. F
  3. x
  4. F
  5. y
  6. F
  7. z
  8. ]
  9. =
  10. [
  11. C
  12. W
  13. R
  14. T
  15. W
  16. B
  17. R
  18. T
  19. I
  20. ]
  21. [
  22. L
  23. x
  24. L
  25. y
  26. L
  27. z
  28. F
  29. x
  30. 0
  31. F
  32. y
  33. 0
  34. F
  35. z
  36. 0
  37. ]
  38. \begin{equation} \left[ \begin{array}{c} F_x \\ F_y \\ F_z \end{array} \right]= \left[ \begin{array}{ccc} {^W_CR}^\mathrm{T} \cdot {^B_WR}^\mathrm{T} & I \end{array} \right] \left[ \begin{array}{c} L_x \\ L_y \\ L_z\\ F_{x0} \\ F_{y0} \\ F_{z0} \end{array} \right] \end{equation}
  39. FxFyFz​​​=[CWRTWBRTI​]​LxLyLzFx0Fy0Fz0​​​​​

同理,取N个不同的姿态得到N组六维力传感器数据,

  1. f
  2. =
  3. R
  4. B
  5. f=R \cdot B
  6. f=RB,其中
  7. B
  8. =
  9. [
  10. L
  11. x
  12. ,
  13. L
  14. y
  15. ,
  16. L
  17. z
  18. ,
  19. F
  20. x
  21. 0
  22. ,
  23. F
  24. y
  25. 0
  26. ,
  27. F
  28. z
  29. 0
  30. ]
  31. T
  32. B=[L_x,L_y,L_z,F_{x0},F_{y0},F_{z0}]^{\mathrm{T}}
  33. B=[Lx​,Ly​,Lz​,Fx0​,Fy0​,Fz0​]T,则矩阵的最小二乘解为
  34. B
  35. =
  36. (
  37. R
  38. T
  39. R
  40. )
  41. 1
  42. R
  43. T
  44. f
  45. B=(R^\mathrm{T}R)^{-1} \cdot R^\mathrm{T}\cdot f
  46. B=(RTR)−1RTf

由多组数据可以解出力传感器的零点值

  1. (
  2. F
  3. x
  4. 0
  5. ,
  6. F
  7. y
  8. 0
  9. ,
  10. F
  11. z
  12. 0
  13. )
  14. (F_{x0},F_{y0},F_{z0})
  15. (Fx0​,Fy0​,Fz0​),安装倾角
  16. U
  17. ,
  18. V
  19. U,V
  20. U,V以及重力
  21. g
  22. g
  23. g的大小。
  24. g
  25. =
  26. L
  27. x
  28. 2
  29. +
  30. L
  31. y
  32. 2
  33. +
  34. L
  35. z
  36. 2
  37. g=\sqrt{{L_x}^2 + {L_y}^2 + {L_z}^2}\\
  38. g=Lx2+Ly2+Lz2
  39. U
  40. =
  41. a
  42. r
  43. c
  44. s
  45. i
  46. n
  47. (
  48. L
  49. y
  50. g
  51. )
  52. U = arcsin(\frac{-L_y}{g})
  53. U=arcsin(gLy​​)
  54. V
  55. =
  56. a
  57. r
  58. c
  59. t
  60. a
  61. n
  62. (
  63. L
  64. x
  65. L
  66. z
  67. )
  68. V = arctan(\frac{-L_x}{L_z})
  69. V=arctan(Lz​−Lx​​)

3.外部接触力计算

由此可以得出外部接触力为:

  1. {
  2. F
  3. e
  4. x
  5. =
  6. F
  7. x
  8. F
  9. x
  10. 0
  11. G
  12. x
  13. F
  14. e
  15. y
  16. =
  17. F
  18. y
  19. F
  20. y
  21. 0
  22. G
  23. y
  24. F
  25. e
  26. z
  27. =
  28. F
  29. z
  30. F
  31. z
  32. 0
  33. G
  34. z
  35. \left\{ \begin{array}{c} F_{ex}=F_x-F_{x0}-G_x\\ F_{ey}=F_y-F_{y0}-G_y\\ F_{ez}=F_z-F_{z0}-G_z \end{array} \right.
  36. ⎩⎨⎧​Fex​=Fx​−Fx0​−GxFey​=Fy​−Fy0​−GyFez​=Fz​−Fz0​−Gz​​
  37. [
  38. F
  39. e
  40. x
  41. F
  42. e
  43. y
  44. F
  45. e
  46. z
  47. ]
  48. =
  49. [
  50. F
  51. x
  52. F
  53. y
  54. F
  55. z
  56. ]
  57. [
  58. O
  59. C
  60. R
  61. I
  62. ]
  63. [
  64. 0
  65. 0
  66. g
  67. F
  68. x
  69. 0
  70. F
  71. y
  72. 0
  73. F
  74. z
  75. 0
  76. ]
  77. \begin{equation} \left[ \begin{array}{c} F_{ex} \\ F_{ey} \\ F_{ez} \end{array} \right]= \left[ \begin{array}{c} F_{x} \\ F_{y} \\ F_{z} \end{array} \right]- \left[ \begin{array}{ccc} ^C_OR & I \end{array} \right] \left[ \begin{array}{c} 0 \\ 0 \\ -g \\ F_{x0} \\ F_{y0} \\ F_{z0} \end{array} \right] \end{equation}
  78. FexFeyFez​​​=​FxFyFz​​​−[OCRI​]​00gFx0Fy0Fz0​​​​​

又:

  1. {
  2. M
  3. x
  4. 0
  5. =
  6. k
  7. 1
  8. F
  9. y
  10. 0
  11. ×
  12. z
  13. +
  14. F
  15. z
  16. 0
  17. ×
  18. y
  19. M
  20. y
  21. 0
  22. =
  23. k
  24. 2
  25. F
  26. z
  27. 0
  28. ×
  29. x
  30. +
  31. F
  32. x
  33. 0
  34. ×
  35. z
  36. M
  37. z
  38. 0
  39. =
  40. k
  41. 3
  42. F
  43. x
  44. 0
  45. ×
  46. y
  47. +
  48. F
  49. y
  50. 0
  51. ×
  52. x
  53. \left\{ \begin{array}{c} M_{x0}=k_1 - F_{y0} \times z +F_{z0} \times y \\ M_{y0}=k_2 - F_{z0} \times x +F_{x0} \times z\\ M_{z0}=k_3 - F_{x0} \times y +F_{y0} \times x \end{array} \right.
  54. ⎩⎨⎧​Mx0​=k1​−Fy0​×z+Fz0​×yMy0​=k2​−Fz0​×x+Fx0​×zMz0​=k3​−Fx0​×y+Fy0​×x
  55. C
  56. G
  57. =
  58. O
  59. C
  60. R
  61. O
  62. G
  63. =
  64. [
  65. G
  66. x
  67. ,
  68. G
  69. y
  70. ,
  71. G
  72. z
  73. ]
  74. T
  75. ^{C}G=^C_OR \cdot {^{O}G} = [G_x,G_y,G_z]^\mathrm{T}
  76. CG=OCROG=[Gx​,Gy​,Gz​]T
  77. {
  78. M
  79. g
  80. x
  81. =
  82. G
  83. z
  84. ×
  85. y
  86. G
  87. y
  88. ×
  89. z
  90. M
  91. g
  92. y
  93. =
  94. G
  95. x
  96. ×
  97. z
  98. G
  99. z
  100. ×
  101. x
  102. M
  103. g
  104. z
  105. =
  106. G
  107. y
  108. ×
  109. x
  110. G
  111. x
  112. ×
  113. y
  114. \left\{ \begin{array}{c} M_{gx}=G_z \times y-G_y \times z\\ M_{gy}=G_x \times z-G_z \times x\\ M_{gz}=G_y \times x-G_x \times y \end{array} \right.
  115. ⎩⎨⎧​Mgx​=Gz​×yGy​×zMgy​=Gx​×zGz​×xMgz​=Gy​×xGx​×y

即:

  1. [
  2. M
  3. g
  4. x
  5. M
  6. g
  7. y
  8. M
  9. g
  10. z
  11. ]
  12. =
  13. [
  14. 0
  15. z
  16. y
  17. z
  18. 0
  19. x
  20. y
  21. x
  22. 0
  23. ]
  24. [
  25. G
  26. x
  27. G
  28. y
  29. G
  30. z
  31. ]
  32. =
  33. [
  34. 0
  35. z
  36. y
  37. z
  38. 0
  39. x
  40. y
  41. x
  42. 0
  43. ]
  44. O
  45. C
  46. R
  47. [
  48. 0
  49. 0
  50. g
  51. ]
  52. \begin{equation} \left[ \begin{array}{c} M_{gx} \\ M_{gy} \\ M_{gz} \end{array} \right]= \left[ \begin{array}{ccc} 0 & -z & y\\ z & 0 &-x \\ -y & x & 0 \end{array} \right] \left[ \begin{array}{c} G_x \\ G_y \\ G_z \end{array} \right]= \left[ \begin{array}{ccc} 0 & -z & y\\ z & 0 &-x \\ -y & x & 0 \end{array} \right] \cdot ^C_OR \cdot \left[ \begin{array}{ccc} 0 \\ 0 \\ -g \end{array} \right] \end{equation}
  53. MgxMgyMgz​​​=​0zy​−z0xyx0​​​GxGyGz​​​=​0zy​−z0xyx0​​⋅OCR⋅​00g​​​​

得出外部接触力矩为:

  1. {
  2. M
  3. e
  4. x
  5. =
  6. M
  7. x
  8. M
  9. x
  10. 0
  11. M
  12. g
  13. x
  14. M
  15. e
  16. y
  17. =
  18. M
  19. y
  20. M
  21. y
  22. 0
  23. M
  24. g
  25. y
  26. M
  27. e
  28. z
  29. =
  30. M
  31. z
  32. M
  33. Z
  34. 0
  35. M
  36. g
  37. z
  38. \left\{ \begin{array}{c} M_{ex}=M_x-M_{x0}-M_{gx}\\ M_{ey}=M_y-M_{y0}-M_{gy}\\ M_{ez}=M_z-M_{Z0}-M_{gz} \end{array} \right.
  39. ⎩⎨⎧​Mex​=Mx​−Mx0​−MgxMey​=My​−My0​−MgyMez​=Mz​−MZ0​−Mgz​​

[1]高培阳. 基于力传感器的工业机器人恒力磨抛系统研究[D].华中科技大学,2019.
[2]张立建,胡瑞钦,易旺民.基于六维力传感器的工业机器人末端负载受力感知研究[J].自动化学报,2017,43(03):439-447.DOI:10.16383/j.aas.2017.c150753.
[3]董浩. 轴孔装配工业机器人柔顺控制算法研究[D].河南理工大学,2018.

代码如下:

  1. from numpy import*import numpy as np
  2. '''
  3. Made by 水木皆Ming
  4. 重力补偿计算
  5. '''classGravityCompensation:
  6. M = np.empty((0,0))
  7. F = np.empty((0,0))
  8. f = np.empty((0,0))
  9. R = np.empty((0,0))
  10. x =0
  11. y =0
  12. z =0
  13. k1 =0
  14. k2 =0
  15. k3 =0
  16. U =0
  17. V =0
  18. g =0
  19. F_x0 =0
  20. F_y0 =0
  21. F_z0 =0
  22. M_x0 =0
  23. M_y0 =0
  24. M_z0 =0
  25. F_ex =0
  26. F_ey =0
  27. F_ez =0
  28. M_ex =0
  29. M_ey =0
  30. M_ez =0defUpdate_M(self, torque_data):
  31. M_x = torque_data[0]
  32. M_y = torque_data[1]
  33. M_z = torque_data[2]if(any(self.M)):
  34. M_1 = matrix([M_x, M_y, M_z]).transpose()
  35. self.M = vstack((self.M, M_1))else:
  36. self.M = matrix([M_x, M_y, M_z]).transpose()defUpdate_F(self, force_data):
  37. F_x = force_data[0]
  38. F_y = force_data[1]
  39. F_z = force_data[2]if(any(self.F)):
  40. F_1 = matrix([[0, F_z,-F_y,1,0,0],[-F_z,0, F_x,0,1,0],[F_y,-F_x,0,0,0,1]])
  41. self.F = vstack((self.F, F_1))else:
  42. self.F = matrix([[0, F_z,-F_y,1,0,0],[-F_z,0, F_x,0,1,0],[F_y,-F_x,0,0,0,1]])defSolve_A(self):
  43. A = dot(dot(linalg.inv(dot(self.F.transpose(), self.F)), self.F.transpose()), self.M)
  44. self.x = A[0,0]
  45. self.y = A[1,0]
  46. self.z = A[2,0]
  47. self.k1 = A[3,0]
  48. self.k2 = A[4,0]
  49. self.k3 = A[5,0]# print("A= \n" , A)print("x= ", self.x)print("y= ", self.y)print("z= ", self.z)print("k1= ", self.k1)print("k2= ", self.k2)print("k3= ", self.k3)defUpdate_f(self, force_data):
  50. F_x = force_data[0]
  51. F_y = force_data[1]
  52. F_z = force_data[2]if(any(self.f)):
  53. f_1 = matrix([F_x, F_y, F_z]).transpose()
  54. self.f = vstack((self.f, f_1))else:
  55. self.f = matrix([F_x, F_y, F_z]).transpose()defUpdate_R(self, euler_data):# 机械臂末端到基坐标的旋转矩阵
  56. R_array = self.eulerAngles2rotationMat(euler_data)
  57. alpha =(0)*180/ np.pi
  58. # 力传感器到末端的旋转矩阵
  59. R_alpha = np.array([[math.cos(alpha),-math.sin(alpha),0],[math.sin(alpha), math.cos(alpha),0],[0,0,1]])
  60. R_array = np.dot(R_alpha, R_array.transpose())if(any(self.R)):
  61. R_1 = hstack((R_array, np.eye(3)))
  62. self.R = vstack((self.R, R_1))else:
  63. self.R = hstack((R_array, np.eye(3)))defSolve_B(self):
  64. B = dot(dot(linalg.inv(dot(self.R.transpose(), self.R)), self.R.transpose()), self.f)
  65. self.g = math.sqrt(B[0]* B[0]+ B[1]* B[1]+ B[2]* B[2])
  66. self.U = math.asin(-B[1]/ self.g)
  67. self.V = math.atan(-B[0]/ B[2])
  68. self.F_x0 = B[3,0]
  69. self.F_y0 = B[4,0]
  70. self.F_z0 = B[5,0]# print("B= \n" , B)print("g= ", self.g /9.81)print("U= ", self.U *180/ math.pi)print("V= ", self.V *180/ math.pi)print("F_x0= ", self.F_x0)print("F_y0= ", self.F_y0)print("F_z0= ", self.F_z0)defSolve_Force(self, force_data, euler_data):
  71. Force_input = matrix([force_data[0], force_data[1], force_data[2]]).transpose()
  72. my_f = matrix([cos(self.U)*sin(self.V)*self.g,-sin(self.U)*self.g,-cos(self.U)*cos(self.V)*self.g, self.F_x0, self.F_y0, self.F_z0]).transpose()
  73. R_array = self.eulerAngles2rotationMat(euler_data)
  74. R_array = R_array.transpose()
  75. R_1 = hstack((R_array, np.eye(3)))
  76. Force_ex = Force_input - dot(R_1, my_f)print('接触力:\n', Force_ex)defSolve_Torque(self, torque_data, euler_data):
  77. Torque_input = matrix([torque_data[0], torque_data[1], torque_data[2]]).transpose()
  78. M_x0 = self.k1 - self.F_y0 * self.z + self.F_z0 * self.y
  79. M_y0 = self.k2 - self.F_z0 * self.x + self.F_x0 * self.z
  80. M_z0 = self.k3 - self.F_x0 * self.y + self.F_y0 * self.x
  81. Torque_zero = matrix([M_x0, M_y0, M_z0]).transpose()
  82. Gravity_param = matrix([[0,-self.z, self.y],[self.z,0,-self.x],[-self.y, self.x,0]])
  83. Gravity_input = matrix([cos(self.U)*sin(self.V)*self.g,-sin(self.U)*self.g,-cos(self.U)*cos(self.V)*self.g]).transpose()
  84. R_array = self.eulerAngles2rotationMat(euler_data)
  85. R_array = R_array.transpose()
  86. Torque_ex = Torque_input - Torque_zero - dot(dot(Gravity_param, R_array), Gravity_input)print('接触力矩:\n', Torque_ex)defeulerAngles2rotationMat(self, theta):
  87. theta =[i * math.pi /180.0for i in theta]# 角度转弧度
  88. R_x = np.array([[1,0,0],[0, math.cos(theta[0]),-math.sin(theta[0])],[0, math.sin(theta[0]), math.cos(theta[0])]])
  89. R_y = np.array([[math.cos(theta[1]),0, math.sin(theta[1])],[0,1,0],[-math.sin(theta[1]),0, math.cos(theta[1])]])
  90. R_z = np.array([[math.cos(theta[2]),-math.sin(theta[2]),0],[math.sin(theta[2]), math.cos(theta[2]),0],[0,0,1]])# 第一个角为绕X轴旋转,第二个角为绕Y轴旋转,第三个角为绕Z轴旋转
  91. R = np.dot(R_x, np.dot(R_y, R_z))return R
  92. defmain():#
  93. force_data =[-6.349214527290314e-05,0.0016341784503310919,-24.31537437438965]
  94. torque_data=[-0.25042885541915894,0.32582423090934753,2.255179606436286e-05]
  95. euler_data =[-80.50866918099089,77.83705434751874,-9.294185889510375+12]
  96. force_data1 =[-7.469202995300293,2.3709897994995117,-23.0179500579834]
  97. torque_data1=[-0.2169264256954193,0.3719269931316376,0.10870222747325897]
  98. euler_data1 =[-105.99038376663763,60.89987226261212,-10.733422007074305+12]
  99. force_data2 =[-14.45930004119873,0.995974063873291,-19.523677825927734]
  100. torque_data2=[-0.19262456893920898,0.3845194876194,0.1622740775346756]
  101. euler_data2 =[-114.24258417090118,43.78913507089547,-19.384088817327235+12]
  102. compensation = GravityCompensation()
  103. compensation.Update_F(force_data)
  104. compensation.Update_F(force_data1)
  105. compensation.Update_F(force_data2)
  106. compensation.Update_M(torque_data)
  107. compensation.Update_M(torque_data1)
  108. compensation.Update_M(torque_data2)
  109. compensation.Solve_A()
  110. compensation.Update_f(force_data)
  111. compensation.Update_f(force_data1)
  112. compensation.Update_f(force_data2)
  113. compensation.Update_R(euler_data)
  114. compensation.Update_R(euler_data1)
  115. compensation.Update_R(euler_data2)
  116. compensation.Solve_B()# compensation.Solve_Force(force_data, euler_data)# compensation.Solve_Force(force_data1, euler_data1)# compensation.Solve_Force(force_data2, euler_data2)## compensation.Solve_Torque(torque_data, euler_data)# compensation.Solve_Torque(torque_data1, euler_data1)# compensation.Solve_Torque(torque_data2, euler_data2)if __name__ =='__main__':
  117. main()

Made by 水木皆Ming


本文转载自: https://blog.csdn.net/zhang1079528541/article/details/129503851
版权归原作者 水木皆Ming 所有, 如有侵权,请联系我们删除。

“机械臂六维力传感器重力补偿原理”的评论:

还没有评论