<noframes id="xxvtd"><form id="xxvtd"><nobr id="xxvtd"></nobr></form>

<address id="xxvtd"><listing id="xxvtd"><meter id="xxvtd"></meter></listing></address>

    <form id="xxvtd"></form>

    <address id="xxvtd"><address id="xxvtd"><th id="xxvtd"></th></address></address>
    我的訂單|我的收藏|我的商城|幫助中心|返回首頁
    搜維爾[www.mdwxyey.cn]>服務>VR研究院 孵化器>VR研究院>虛擬交互>haption

    使用Phantom omni力反饋設備控制機器人

    文章來源:Phantom 作者:frank 發布時間:2018年11月05日 點擊數: 字號:

    傳統的工業機器人普遍采用電機 、齒輪減速器 、關節軸三者直接連接的傳動機構,這種機構要求電機與減速器安裝在機械臂關節附近,其缺點是對于多關節機械臂,下一級關節的電機與減速器等驅動裝置成為上一級關節的額外負載 。這一額外負載帶來的負面影響往往超過機械臂連桿等必要結構件,因此提高了對機械臂動力和驅動元件的要求,由此造成整體重量 、體積 、造價和內部消耗的增加,降低了機械臂對外做功的能力和效率。為了避免這一問題許多主動式醫療機器人采用繩驅動方式,使用柔性繩索遠距離的傳遞運動和力矩。將驅動裝置安裝到遠離相關關節的基座上,使得整個機械臂的結構緊湊?,在減輕機械臂整體重量的同時提高了對外做功的能力。下圖所示的就是達芬奇手術機器人的末端夾子,采用繩驅動方式可以在較小的機械結構內實現多自由度的靈活運動:

    下面嘗試在VREP中使用力反饋設備Phantom omni來控制醫療機器人的末端夾子。機構簡圖如下圖所示,一共有5個自由度:其中移動自由度負責進給,一個整體旋轉自由度,還有兩個左右、上下彎曲的自由度,最后是控制夾子張合的自由度。

    刪除Solidworks CAD模型中的一些不必要特征,比如倒角、內部孔、螺紋孔等,導出成STL文件,再導入到VREP中。然后還需要進行繼續化簡,減少網格數量,當網格數減少到不影響幾何外觀就可以了。接下來在相應的位置添加關節,設置關節運動范圍(軟件限位),并將其設為Inverse kinematics模式。

    設置Calculation Modules中的Inverse kinematics:

    搭建好模型后可以先用鍵盤進行測試,按方向鍵移動ikTarget,VREP會根據構型自動計算運動學逆解,然后將ikTip移動到ikTarget處(這樣就會帶著整個機構運動)。

    鍵盤控制的腳本代碼如下:

    1. if?(sim_call_type==sim_childscriptcall_initialization)?then ?
    2. ?
    3. ????--?Put?some?initialization?code?here ?
    4. ????targetHandle?=?simGetObjectHandle('ikTarget') ?
    5. ?
    6. ?
    7. end ?
    8. ?
    9. ?
    10. if?(sim_call_type==sim_childscriptcall_actuation)?then ?
    11. ?
    12. ????--?Put?your?main?ACTUATION?code?here ?
    13. ?
    14. end ?
    15. ?
    16. ?
    17. ?
    18. if?(sim_call_type==sim_childscriptcall_sensing)?then ?
    19. ?
    20. ????--?Put?your?main?SENSING?code?here ?
    21. ????--?Read?the?keyboard?messages?(make?sure?the?focus?is?on?the?main?window,?scene?view): ?
    22. ????message,?auxiliaryData?=?simGetSimulatorMessage() ?
    23. ?
    24. ????if?(message?==?sim_message_keypress)?then ?
    25. ?
    26. ????????if?(auxiliaryData[1]==119)?then ?
    27. ????????????--?W?key ?
    28. ????????????local?p?=?simGetObjectPosition(targetHandle,?-1) ?
    29. ????????????p[1]?=?p[1]?-?0.001 ?
    30. ????????????simSetObjectPosition(targetHandle,?-1,?p) ?
    31. ????????end ?
    32. ????????if?(auxiliaryData[1]==115)?then ?
    33. ????????????--?S?key ?
    34. ????????????local?p?=?simGetObjectPosition(targetHandle,?-1) ?
    35. ????????????p[1]?=?p[1]?+?0.001 ?
    36. ????????????simSetObjectPosition(targetHandle,?-1,?p) ?
    37. ????????end ?
    38. ?
    39. ?
    40. ????????if?(auxiliaryData[1]==2007)?then ?
    41. ????????????--?up?key ?
    42. ????????????local?p?=?simGetObjectPosition(targetHandle,?-1) ?
    43. ????????????p[3]?=?p[3]?+?0.001 ?
    44. ????????????simSetObjectPosition(targetHandle,?-1,?p) ?
    45. ????????end ?
    46. ????????if?(auxiliaryData[1]==2008)?then ?
    47. ????????????--?down?key ?
    48. ????????????local?p?=?simGetObjectPosition(targetHandle,?-1) ?
    49. ????????????p[3]?=?p[3]?-?0.001 ?
    50. ????????????simSetObjectPosition(targetHandle,?-1,?p) ?
    51. ????????end ?
    52. ?
    53. ?
    54. ????????if?(auxiliaryData[1]==2009)?then ?
    55. ????????????--?left?key ?
    56. ????????????local?p?=?simGetObjectPosition(targetHandle,?-1) ?
    57. ????????????p[2]?=?p[2]?-?0.001 ?
    58. ????????????simSetObjectPosition(targetHandle,?-1,?p) ?
    59. ????????end ?
    60. ????????if?(auxiliaryData[1]==2010)?then ?
    61. ????????????--?right?key ?
    62. ????????????local?p?=?simGetObjectPosition(targetHandle,?-1) ?
    63. ????????????p[2]?=?p[2]?+?0.001 ?
    64. ????????????simSetObjectPosition(targetHandle,?-1,?p) ?
    65. ????????end ?
    66. ?
    67. ????end ?
    68. end ?
    69. ?
    70. ?
    71. if?(sim_call_type==sim_childscriptcall_cleanup)?then ?
    72. ?
    73. ????--?Put?some?restoration?code?here ?
    74. ?
    75. end?

    ?

    測試沒問題后可以使用CHAI3D插件來連接力反饋設備。這里采用增量控制的模式,即計算當前時刻與前一時刻手柄位置在X、Y、Z方向上的差,然后控制VREP中的ikTarget控制點按相應的增量移動。注意在VREP中機器人向前運動是沿X軸負方向、向上運動是沿Z軸正方向、向右運動是沿Y軸正方向,這與CHAI3D中坐標系的定義一致(向前推手柄是沿著X軸負方向...),因此可以使用力反饋設備直觀的控制機器人的運動。當然如果坐標系定義不一致,需要進行簡單的轉換才行。

    下面的代碼在sensing探測部分會使用simExtCHAI3D_readPosition來讀取當前操作手柄的位置和按鈕狀態。按照VREP默認設置,這部分代碼會50ms執行一次,這里會出現一個問題:如果采樣速率太快,會導致前后兩次采集到的位置數據偏差為零(人手的操作頻率沒那么快,還來不及改變位置),那么輸出的控制量就一直是零,這樣就沒辦法用增量控制的方式來操控機器人。解決辦法是延遲幾個周期再采樣,等到有足夠大的偏差之后再生成控制量。還有一個問題是使用CHAI3D返回的數據以“米”為單位,而VREP世界中的單位有可能未知,那么使用增量控制時需要對控制量乘一個比例系數,避免因操作端微小的移動造成從動端運動量過大,超出關節限制(無法到達的逆解)?;蛘呖梢哉{節比例系數,用操作端的大位移來控制從動端的小位移,實現精細控制。

    1. if?(sim_call_type==sim_childscriptcall_initialization)?then ?
    2. ????--?Check?if?the?plugin?is?loaded: ?
    3. ????moduleName=0 ?
    4. ????moduleVersion=0 ?
    5. ????index=0 ?
    6. ????pluginNotFound=true?
    7. ????while?moduleName?do?
    8. ????????moduleName,moduleVersion=simGetModuleName(index) ?
    9. ????????if?(moduleName=='CHAI3D')?then ?
    10. ????????????pluginNotFound=false?
    11. ????????end ?
    12. ????????index=index+1 ?
    13. ????end ?
    14. ?
    15. ????if?(pluginNotFound)?then ?
    16. ????????simDisplayDialog('Error','CHAI3D?plugin?was?not?found,?or?was?not?correctly?initialized?(v_repExtCHAI3D.dll).',sim_dlgstyle_ok,false,nil,{0.8,0,0,0,0,0},{0.5,0,0,1,1,1}) ?
    17. ????else?
    18. ?
    19. ????????--?Start?the?device: ?
    20. ????????local?toolRadius?=?0.001?--?the?radius?of?the?tool ?
    21. ????????local?workspaceRadius?=?0.2?--?the?workspace?radius ?
    22. ????????if?simExtCHAI3D_start(0,?toolRadius,workspaceRadius)?~=?1?then ?
    23. ????????????simDisplayDialog('Error','Device?failed?to?initialize.',sim_dlgstyle_ok,false,nil,{0.8,0,0,0,0,0},{0.5,0,0,1,1,1}) ?
    24. ????????else?
    25. ????????????CHAI3DPluginInitialized?=?true?
    26. ?
    27. ????????end ?
    28. ????end ?
    29. ?
    30. ????targetHandle?=?simGetObjectHandle('ikTarget') ?
    31. ?
    32. ????deltaPos?=?{0,?0,?0} ?
    33. ????counter?=?0 ?
    34. ????ratio?=?50 ?
    35. ?
    36. end ?
    37. ?
    38. ?
    39. if?(sim_call_type==sim_childscriptcall_actuation)?then ?
    40. ????if?buttonState?==1?then??--?press?the?button ?
    41. ????????local?p?=?simGetObjectPosition(targetHandle,?-1)?--?get?the?target?position ?
    42. ????????--?add?increment?of?the?tool?tip ?
    43. ????????p[1]?=?p[1]?+?deltaPos[1]?/?ratio?????????????????? ?
    44. ????????p[2]?=?p[2]?+?deltaPos[2]?/?ratio ?
    45. ????????p[3]?=?p[3]?+?deltaPos[3]?/?ratio ?
    46. ????????simSetObjectPosition(targetHandle,?-1,?p)??--?move?to?the?absolute?position ?
    47. ????end ?
    48. end ?
    49. ?
    50. ?
    51. ?
    52. if?(sim_call_type==sim_childscriptcall_sensing)?then ?
    53. ????if?CHAI3DPluginInitialized?then ?
    54. ????????--?Read?the?current?position?of?the?cursor: ?
    55. ????????local?currentToolPosition?=?simExtCHAI3D_readPosition(0) ?
    56. ???????? ?
    57. ????????--?Read?the?buttons?of?the?device: ?
    58. ????????buttonState?=?simExtCHAI3D_readButtons(0) ?
    59. ?
    60. ????????counter?=?counter?+?1??????--?increase?the?counter ?
    61. ???????? ?
    62. ????????if?counter?%?30?==?1?then??--?keep?the?value ?
    63. ????????????prevToolPosition?=?currentToolPosition ?
    64. ????????end ?
    65. ?
    66. ????????if?counter?%?30?==?0?then??--?calculate?tool?tip?increment ?
    67. ????????????deltaPos[1]?=?currentToolPosition[1]?-?prevToolPosition[1]??--?X-axis?increment ?
    68. ????????????deltaPos[2]?=?currentToolPosition[2]?-?prevToolPosition[2]??--?Y-axis?increment ?
    69. ????????????deltaPos[3]?=?currentToolPosition[3]?-?prevToolPosition[3]??--?Z-axis?increment ?
    70. ????????????counter?=?0??--?reset?counter ?
    71. ?
    72. ?
    73. ????????local?info?=?string.format("CurrentPosition:%.2f,%.2f,%.2f??DeltaPosition:%.2f,%.2f,%.2f", ?
    74. ????????????????????????????currentToolPosition[1],currentToolPosition[2],currentToolPosition[3], ?
    75. ????????????????????????????deltaPos[1],deltaPos[2],deltaPos[3]) ?
    76. ????????simAddStatusbarMessage(info) ?
    77. ?
    78. ????????end ?
    79. ?
    80. ????end ?
    81. end ?
    82. ?
    83. ?
    84. if?(sim_call_type==sim_childscriptcall_cleanup)?then ?
    85. ????if?CHAI3DPluginInitialized?then ?
    86. ?
    87. ????????--?Disconnects?all?devices?and?removes?all?objects?from?the?scene ?
    88. ????????simExtCHAI3D_reset() ?
    89. ????end ?
    90. end?

    ?

    力反饋設備手柄移動到合適的位置之后就可以按住按鈕開始操控機器人,松開按鈕會停止控制。如果在VREP虛擬場景中添加其它物體(比如障礙物),則還可以模擬環境中的力(接觸力、重力、摩擦力、彈簧力等)讓操控著“感覺”到。如果實際機器人上裝有力傳感器,則在用Phantom omni控制機器人的同時也能讀取力的信息,反饋給操作者。

    下面是使用Phantom omni來控制機器人的動態圖,黃色的軌跡為使用Graph記錄的控制點的空間位置:

    對于該機構也可以自己實現運動學逆解的數值算法,下面給出偽逆矩陣法和阻尼最小二乘法的參考:

    1. import?math?? ?
    2. import?numpy?as?np
    3. ?
    4. #?link?length ?
    5. L1?=?1?? ?
    6. L2?=?1 ?
    7. ?
    8. gamma?=?1???????#?step?size ?
    9. lamda?=?0.2?????#?damping?constant?(DLS-method) ?
    10. stol?=?1e-3?????#?tolerance ?
    11. nm?=?10?????????#?initial?error ?
    12. count?=?0???????#?iteration?count ?
    13. ilimit?=?20?????#?maximum?iteration
    14. ?
    15. #?numerical?method?for?inverse?kinematics ?
    16. method?=?'Pseudo?Inverse'??#?'Pseudo?Inverse',?'DLS',?...
    17. ?
    18. #?initial?joint?value ?
    19. q?=?np.array([0,?0,?math.pi/2,?0])?#?[theta1,?d1,?theta2,?theta3]
    20. ?
    21. #?target?position?? ?
    22. target_pos?=?np.array([1,?0,?2])???#?[x,y,z] ?
    23. ?
    24. ?
    25. while?True: ?
    26. ????if(nm?>?stol):
    27. ????????#?forward?kinematics: ?
    28. ????????x?=?np.array([math.cos(q[0])*math.cos(q[2])*(L1+L2*math.cos(q[3]))+L2*math.sin(q[0])*math.sin(q[3]),\ ?
    29. ????????math.cos(q[2])*math.sin(q[0])*(L1+L2*math.cos(q[3]))-L2*math.cos(q[0])*math.sin(q[3]),\ ?
    30. ????????q[1]+(L1+L2*math.cos(q[3]))*math.sin(q[2])])
    31. ?
    32. ????????#?compute?error ?
    33. ????????error?=?target_pos?-?x
    34. ?
    35. ????????#?compute?Jacobian ?
    36. ????????J11?=?-math.sin(q[0])*math.cos(q[2])*(L1+L2*math.cos(q[3]))+L2*math.cos(q[0])*math.sin(q[3]) ?
    37. ????????J12?=?0 ?
    38. ????????J13?=?-math.sin(q[2])*math.cos(q[0])*(L1+L2*math.cos(q[3])) ?
    39. ????????J14?=?L2*(math.sin(q[0])*math.cos(q[3])-math.cos(q[0])*math.cos(q[2])*math.sin(q[3])) ?
    40. ????????J21?=?math.cos(q[0])*math.cos(q[2])*(L1+L2*math.cos(q[3]))+L2*math.sin(q[0])*math.sin(q[3]) ?
    41. ????????J22?=?0 ?
    42. ????????J23?=?-math.sin(q[0])*math.sin(q[2])*(L1+L2*math.cos(q[3])) ?
    43. ????????J24?=?-L2*(math.cos(q[0])*math.cos(q[3])+math.sin(q[0])*math.cos(q[2])*math.sin(q[3])) ?
    44. ????????J31?=?0 ?
    45. ????????J32?=?1 ?
    46. ????????J33?=?math.cos(q[2])*(L1+L2*math.cos(q[3])) ?
    47. ????????J34?=?-L2*math.sin(q[2])*math.sin(q[3]) ?
    48. ?
    49. ????????J?=?np.array([[J11,J12,J13,J14],[J21,J22,J23,J24],[J31,J32,J33,J34]]) ?
    50. ???????? ?
    51. ????????if?method?==?'Pseudo?Inverse':?
    52. ????????????#?Pseudo?Inverse?Method ?
    53. ????????????J_pseudo?=?np.dot(J.transpose(),?np.linalg.inv(J.dot(J.transpose())))?#?compute?pseudo?inverse ?
    54. ????????????dq?=?gamma?*?J_pseudo.dot(error) ?
    55. ???????????? ?
    56. ????????if?method?==?'DLS':
    57. ????????????#?Damped?Least?Squares?Method ?
    58. ????????????f?=?np.linalg.solve(J.dot(J.transpose())+lamda**2*np.identity(3),?error) ?
    59. ????????????dq?=?np.dot(J.transpose(),?f)
    60. ?
    61. ????????#?update?joint?position??? ?
    62. ????????q?=?q?+?dq ?
    63. ?
    64. ????????nm?=?np.linalg.norm(error) ?
    65. ?
    66. ????????count?=?count?+?1 ?
    67. ????????if?count?>?ilimit: ?
    68. ????????????print?"Solution?wouldn't?converge!"?
    69. ????????????break?
    70. ????else:
    71. ????????#?print?result ?
    72. ????????print?'theta1='?+?str(q[0]*180/math.pi)+'?d1='+str(q[1])?+?'?theta2='?+?str((q[2]-math.pi/2)*180/math.pi)+'?theta3='?+?str(q[3]*180/math.pi) ?
    73. ????????print?'Current?position:?%.2f,?%.2f,?%.2f'?%(x[0],x[1],x[2])???? ?
    74. ????????print?str(count)+'?iterations'+'??err:'+str(nm) ?
    75. ????????break?

    ?

    電話:010-50951355 傳真:010-50951352  郵箱:sales@www.mdwxyey.cn ;點擊查看區域負責人電話
    手機:13811546370 / 13720091697 / 13720096040 / 13811548270 / 13811981522 / 18600440988 /13810279720 /13581546145

    • 暫無資料
    • 暫無資料
    • 暫無資料
    • 暫無資料
    • 暫無資料
    在线免费观看韩国a视频