193 lines
16 KiB
HTML
193 lines
16 KiB
HTML
<html><head><title>Robot Workbench/zh-cn</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link type='text/css' href='wiki.css' rel='stylesheet'></head><body><h1>Robot Workbench/zh-cn</h1></div>
|
||
|
||
<div id="mw-content-text" lang="zh-CN" dir="ltr" class="mw-content-ltr"><hr/><div class="mw-parser-output"></div>
|
||
<div class="floatright"><a href="https://www.freecadweb.org/wiki/index.php?title=File:KukaKR16FreeCAD.jpg" class="image"><img alt="KukaKR16FreeCAD.jpg" src="400px-KukaKR16FreeCAD.jpg" width="400" height="276" srcset="/wiki/images/thumb/c/c5/KukaKR16FreeCAD.jpg/600px-KukaKR16FreeCAD.jpg 1.5x, /wiki/images/thumb/c/c5/KukaKR16FreeCAD.jpg/800px-KukaKR16FreeCAD.jpg 2x" /></a></div>
|
||
<p>机器人工作台是一个用于模仿工业 <a href="https://www.freecadweb.org/wiki/index.php?title=Robot_6-Axis/cn&action=edit&redlink=1" class="new" title="Robot 6-Axis/cn (page does not exist)">Robot 6-Axis</a> 的工具,就像 <a rel="nofollow" class="external text" href="http://kuka.com/">Kuka</a>。
|
||
用它可以完成以下任务:
|
||
</p>
|
||
<ul><li> 用机器人和工件设立一个模拟环境</li>
|
||
<li> 创建和填补轨迹</li>
|
||
<li> 将一个 CAD 零件的特征分解为轨迹</li>
|
||
<li> 模拟机器人的运动及其可达性</li>
|
||
<li> 将轨迹导出为机器人程序文件</li></ul>
|
||
<p>你可以从这儿找到例子:
|
||
<a rel="nofollow" class="external text" href="http://www.freecad-project.de/svn/ExampleData/Examples/RobotSimulation/">Example files</a> 或者去参考 <a href="Robot_tutorial.html" title="Robot tutorial">Robot tutorial</a>.
|
||
</p>
|
||
<div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
|
||
<ul>
|
||
<li class="toclevel-1 tocsection-1"><a href="#.E5.B7.A5.E5.85.B7"><span class="tocnumber">1</span> <span class="toctext">工具</span></a>
|
||
<ul>
|
||
<li class="toclevel-2 tocsection-2"><a href="#.E6.9C.BA.E5.99.A8.E4.BA.BA"><span class="tocnumber">1.1</span> <span class="toctext">机器人</span></a></li>
|
||
<li class="toclevel-2 tocsection-3"><a href="#.E8.BD.A8.E8.BF.B9"><span class="tocnumber">1.2</span> <span class="toctext">轨迹</span></a>
|
||
<ul>
|
||
<li class="toclevel-3 tocsection-4"><a href="#.E9.9D.9E.E5.8F.82.E6.95.B0.E6.80.A7.E8.BD.A8.E8.BF.B9"><span class="tocnumber">1.2.1</span> <span class="toctext">非参数性轨迹</span></a></li>
|
||
<li class="toclevel-3 tocsection-5"><a href="#.E5.8F.82.E6.95.B0.E6.80.A7.E8.BD.A8.E8.BF.B9"><span class="tocnumber">1.2.2</span> <span class="toctext">参数性轨迹</span></a></li>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</li>
|
||
<li class="toclevel-1 tocsection-6"><a href="#.E8.84.9A.E6.9C.AC.E7.BC.96.E7.A8.8B"><span class="tocnumber">2</span> <span class="toctext">脚本编程</span></a>
|
||
<ul>
|
||
<li class="toclevel-2 tocsection-7"><a href="#.E5.9F.BA.E6.9C.AC.E6.9C.BA.E5.99.A8.E4.BA.BA.E4.BA.8B.E9.A1.B9"><span class="tocnumber">2.1</span> <span class="toctext">基本机器人事项</span></a></li>
|
||
<li class="toclevel-2 tocsection-8"><a href="#.E6.96.87.E6.A1.A3.E5.A4.84.E7.90.86"><span class="tocnumber">2.2</span> <span class="toctext">文档处理</span></a></li>
|
||
<li class="toclevel-2 tocsection-9"><a href="#.E6.A8.A1.E6.8B.9F"><span class="tocnumber">2.3</span> <span class="toctext">模拟</span></a></li>
|
||
<li class="toclevel-2 tocsection-10"><a href="#.E5.AF.BC.E5.87.BA.E8.BD.A8.E8.BF.B9"><span class="tocnumber">2.4</span> <span class="toctext">导出轨迹</span></a></li>
|
||
</ul>
|
||
</li>
|
||
<li class="toclevel-1 tocsection-11"><a href="#Tutorials"><span class="tocnumber">3</span> <span class="toctext">Tutorials</span></a></li>
|
||
</ul>
|
||
</div>
|
||
|
||
<h2><span class="mw-headline" id=".E5.B7.A5.E5.85.B7">工具</span></h2>
|
||
<p>这里提供了设置机器人的主要命令。
|
||
</p>
|
||
<h3><span class="mw-headline" id=".E6.9C.BA.E5.99.A8.E4.BA.BA">机器人</span></h3>
|
||
<p>创建和管理六轴机器人的工具
|
||
</p>
|
||
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Robot_CreateRobot.png" class="image"><img alt="Robot CreateRobot.png" src="30px-Robot_CreateRobot.png" width="30" height="30" srcset="/wiki/images/thumb/8/8e/Robot_CreateRobot.png/45px-Robot_CreateRobot.png 1.5x, /wiki/images/thumb/8/8e/Robot_CreateRobot.png/60px-Robot_CreateRobot.png 2x" /></a> <a href="Robot_CreateRobot.html" title="Robot CreateRobot">创建机器人</a>: 在场景中插入一个新机器人</li>
|
||
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Robot_Simulate.png" class="image"><img alt="Robot Simulate.png" src="30px-Robot_Simulate.png" width="30" height="30" srcset="/wiki/images/thumb/4/42/Robot_Simulate.png/45px-Robot_Simulate.png 1.5x, /wiki/images/thumb/4/42/Robot_Simulate.png/60px-Robot_Simulate.png 2x" /></a> <a href="Robot_Simulate.html" title="Robot Simulate">模拟轨迹</a>: 打开模拟对话框并进行轨迹模拟 </li>
|
||
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Robot_Export.png" class="image"><img alt="Robot Export.png" src="30px-Robot_Export.png" width="30" height="30" srcset="/wiki/images/thumb/8/8e/Robot_Export.png/45px-Robot_Export.png 1.5x, /wiki/images/thumb/8/8e/Robot_Export.png/60px-Robot_Export.png 2x" /></a> <a href="Robot_Export.html" title="Robot Export">导出轨迹</a>: 导出一个机器人程序文件</li>
|
||
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Robot_SetHomePos.png" class="image"><img alt="Robot SetHomePos.png" src="30px-Robot_SetHomePos.png" width="30" height="30" srcset="/wiki/images/thumb/3/3c/Robot_SetHomePos.png/45px-Robot_SetHomePos.png 1.5x, /wiki/images/thumb/3/3c/Robot_SetHomePos.png/60px-Robot_SetHomePos.png 2x" /></a> <a href="Robot_SetHomePos.html" title="Robot SetHomePos">设置起始位置</a>: 设置机器人的起始位置</li>
|
||
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Robot_RestoreHomePos.png" class="image"><img alt="Robot RestoreHomePos.png" src="30px-Robot_RestoreHomePos.png" width="30" height="30" srcset="/wiki/images/thumb/9/95/Robot_RestoreHomePos.png/45px-Robot_RestoreHomePos.png 1.5x, /wiki/images/thumb/9/95/Robot_RestoreHomePos.png/60px-Robot_RestoreHomePos.png 2x" /></a> <a href="Robot_RestoreHomePos.html" title="Robot RestoreHomePos">还原初始位置</a>: 将机器人移动到起始位置</li></ul>
|
||
<h3><span class="mw-headline" id=".E8.BD.A8.E8.BF.B9">轨迹</span></h3>
|
||
<p>创建和操作轨迹的工具。分为两种:参数性的和非参数性的。
|
||
</p>
|
||
<h4><span class="mw-headline" id=".E9.9D.9E.E5.8F.82.E6.95.B0.E6.80.A7.E8.BD.A8.E8.BF.B9">非参数性轨迹</span></h4>
|
||
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Robot_CreateTrajectory.png" class="image"><img alt="Robot CreateTrajectory.png" src="30px-Robot_CreateTrajectory.png" width="30" height="30" srcset="/wiki/images/thumb/9/90/Robot_CreateTrajectory.png/45px-Robot_CreateTrajectory.png 1.5x, /wiki/images/thumb/9/90/Robot_CreateTrajectory.png/60px-Robot_CreateTrajectory.png 2x" /></a> <a href="Robot_CreateTrajectory.html" title="Robot CreateTrajectory">创建轨迹</a>: 在场景中插入一个新机器人</li>
|
||
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Robot_SetDefaultOrientation.png" class="image"><img alt="Robot SetDefaultOrientation.png" src="30px-Robot_SetDefaultOrientation.png" width="30" height="30" srcset="/wiki/images/thumb/e/e0/Robot_SetDefaultOrientation.png/45px-Robot_SetDefaultOrientation.png 1.5x, /wiki/images/thumb/e/e0/Robot_SetDefaultOrientation.png/60px-Robot_SetDefaultOrientation.png 2x" /></a> <a href="Robot_SetDefaultOrientation.html" title="Robot SetDefaultOrientation">设置默认方位</a>: 设置默认的方位航向点</li>
|
||
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Robot_SetDefaultValues.png" class="image"><img alt="Robot SetDefaultValues.png" src="30px-Robot_SetDefaultValues.png" width="30" height="30" srcset="/wiki/images/thumb/f/fc/Robot_SetDefaultValues.png/45px-Robot_SetDefaultValues.png 1.5x, /wiki/images/thumb/f/fc/Robot_SetDefaultValues.png/60px-Robot_SetDefaultValues.png 2x" /></a> <a href="Robot_SetDefaultValues.html" title="Robot SetDefaultValues">设置速度参数默认值</a>: 设置默认的航向点创建</li>
|
||
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Robot_InsertWaypoint.png" class="image"><img alt="Robot InsertWaypoint.png" src="30px-Robot_InsertWaypoint.png" width="30" height="30" srcset="/wiki/images/thumb/7/74/Robot_InsertWaypoint.png/45px-Robot_InsertWaypoint.png 1.5x, /wiki/images/thumb/7/74/Robot_InsertWaypoint.png/60px-Robot_InsertWaypoint.png 2x" /></a> <a href="Robot_InsertWaypoint.html" title="Robot InsertWaypoint">插入航向点</a>: 从当前机器人位置向轨迹中插入一个航向点</li>
|
||
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Robot_InsertWaypointPre.png" class="image"><img alt="Robot InsertWaypointPre.png" src="30px-Robot_InsertWaypointPre.png" width="30" height="30" srcset="/wiki/images/thumb/8/8f/Robot_InsertWaypointPre.png/45px-Robot_InsertWaypointPre.png 1.5x, /wiki/images/thumb/8/8f/Robot_InsertWaypointPre.png/60px-Robot_InsertWaypointPre.png 2x" /></a> <a href="Robot_InsertWaypointPre.html" title="Robot InsertWaypointPre">插入航向点</a>: 从当前的鼠标位置向轨迹中插入一个航向点</li></ul>
|
||
<h4><span class="mw-headline" id=".E5.8F.82.E6.95.B0.E6.80.A7.E8.BD.A8.E8.BF.B9">参数性轨迹</span></h4>
|
||
<ul><li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Robot_Edge2Trac.png" class="image"><img alt="Robot Edge2Trac.png" src="30px-Robot_Edge2Trac.png" width="30" height="30" srcset="/wiki/images/thumb/a/a7/Robot_Edge2Trac.png/45px-Robot_Edge2Trac.png 1.5x, /wiki/images/thumb/a/a7/Robot_Edge2Trac.png/60px-Robot_Edge2Trac.png 2x" /></a> <a href="Robot_Edge2Trac.html" title="Robot Edge2Trac">由边创建轨迹</a>: 插入一个新对象,该对象将边分解为轨迹</li>
|
||
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Robot_TrajectoryDressUp.png" class="image"><img alt="Robot TrajectoryDressUp.png" src="30px-Robot_TrajectoryDressUp.png" width="30" height="30" srcset="/wiki/images/thumb/2/28/Robot_TrajectoryDressUp.png/45px-Robot_TrajectoryDressUp.png 1.5x, /wiki/images/thumb/2/28/Robot_TrajectoryDressUp.png/60px-Robot_TrajectoryDressUp.png 2x" /></a> <a href="Robot_TrajectoryDressUp.html" title="Robot TrajectoryDressUp">修饰轨迹</a>: 覆盖轨迹的一个或多个属性</li>
|
||
<li> <a href="https://www.freecadweb.org/wiki/index.php?title=File:Robot_TrajectoryCompound.png" class="image"><img alt="Robot TrajectoryCompound.png" src="30px-Robot_TrajectoryCompound.png" width="30" height="30" srcset="/wiki/images/thumb/f/fb/Robot_TrajectoryCompound.png/45px-Robot_TrajectoryCompound.png 1.5x, /wiki/images/thumb/f/fb/Robot_TrajectoryCompound.png/60px-Robot_TrajectoryCompound.png 2x" /></a> <a href="Robot_TrajectoryCompound.html" title="Robot TrajectoryCompound">轨迹复合</a>: 由多个单轨迹创建一个复合轨迹</li></ul>
|
||
<h2><span class="mw-headline" id=".E8.84.9A.E6.9C.AC.E7.BC.96.E7.A8.8B">脚本编程</span></h2>
|
||
<p>本节是由 <a rel="nofollow" class="external free" href="https://github.com/FreeCAD/FreeCAD_sf_master/blob/master/src/Mod/Robot/RobotExample.py">https://github.com/FreeCAD/FreeCAD_sf_master/blob/master/src/Mod/Robot/RobotExample.py</a> 产生出来的,你可以直接使用这个文件。
|
||
</p><p>示例如何使用基本机器人中 Robot6Axis 的来模拟工业六轴机器人。机器人模块依赖于零件模块而不是其他模块。它的工作原理主要是基本类型的布局,矢量和矩阵。因此我们只需要:
|
||
</p>
|
||
<pre>from Robot import *
|
||
from Part import *
|
||
from FreeCAD import * </pre>
|
||
<h3><span class="mw-headline" id=".E5.9F.BA.E6.9C.AC.E6.9C.BA.E5.99.A8.E4.BA.BA.E4.BA.8B.E9.A1.B9">基本机器人事项</span></h3>
|
||
<p>创建机器人。如果你不想指定另一个的话,那么默认使用的是 Puma 560 机器人。
|
||
</p>
|
||
<pre>rob = Robot6Axis()
|
||
print rob </pre>
|
||
<p>访问轴和 Tcp。轴的次序在 1-6 之间
|
||
</p>
|
||
<pre>Start = rob.Tcp
|
||
print Start
|
||
print rob.Axis1 </pre>
|
||
<p>移动机器人的第一个轴:
|
||
</p>
|
||
<pre>rob.Axis1 = 5.0 </pre>
|
||
<p>Tcp发生了变化(前进运动)
|
||
</p>
|
||
<pre>print rob.Tcp </pre>
|
||
<p>移动机器人返回初始位置(后退运动)
|
||
</p>
|
||
<pre>rob.Tcp = Start
|
||
print rob.Axis1 </pre>
|
||
<p>和轴 2 相同:
|
||
</p>
|
||
<pre>rob.Axis2 = 5.0
|
||
print rob.Tcp
|
||
rob.Tcp = Start
|
||
print rob.Axis2 </pre>
|
||
<p>航点:
|
||
</p>
|
||
<pre>w = Waypoint(Placement(),name="Pt",type="LIN")
|
||
print w.Name,w.Type,w.Pos,w.Cont,w.Velocity,w.Base,w.Tool </pre>
|
||
<p>生成更多。 轨迹总是自动找到一个独特的航点名称
|
||
</p>
|
||
<pre>l = [w]
|
||
for i in range(5):
|
||
l.append(Waypoint(Placement(Vector(0,0,i*100),Vector(1,0,0),0),"LIN","Pt")) </pre>
|
||
<p>创建一个轨迹
|
||
</p>
|
||
<pre>t = Trajectory(l)
|
||
print t
|
||
for i in range(7):
|
||
t.insertWaypoints(Waypoint(Placement(Vector(0,0,i*100+500),Vector(1,0,0),0),"LIN","Pt")) </pre>
|
||
<p>查看航点清单:
|
||
</p>
|
||
<pre>print t.Waypoints
|
||
|
||
del rob,Start,t,l,w </pre>
|
||
<h3><span class="mw-headline" id=".E6.96.87.E6.A1.A3.E5.A4.84.E7.90.86">文档处理</span></h3>
|
||
<p>处理机器人文档对象:
|
||
首先在激活的文档中创建一个机器人
|
||
</p>
|
||
<pre>if(App.activeDocument() == None):App.newDocument()
|
||
|
||
App.activeDocument().addObject("Robot::RobotObject","Robot") </pre>
|
||
<p>定义的可视化表示和运动的定义(见 <a href="https://www.freecadweb.org/wiki/index.php?title=Robot_6-Axis/cn&action=edit&redlink=1" class="new" title="Robot 6-Axis/cn (page does not exist)">Robot 6-Axis</a> 和 <a href="VRML_Preparation_for_Robot_Simulation.html" title="VRML Preparation for Robot Simulation">VRML Preparation for Robot Simulation</a> 有关细节)
|
||
</p>
|
||
<pre>App.activeDocument().Robot.RobotVrmlFile = App.getResourceDir()+"Mod/Robot/Lib/Kuka/kr500_1.wrl"
|
||
App.activeDocument().Robot.RobotKinematicFile = App.getResourceDir()+"Mod/Robot/Lib/Kuka/kr500_1.csv" </pre>
|
||
<p>启动轴的位置(这只是和从 0 不同)
|
||
</p>
|
||
<pre>App.activeDocument().Robot.Axis2 = -90
|
||
App.activeDocument().Robot.Axis3 = 90 </pre>
|
||
<p>检索TCP位置
|
||
</p>
|
||
<pre>pos = FreeCAD.getDocument("Unnamed").getObject("Robot").Tcp </pre>
|
||
<p>移动机器人
|
||
</p>
|
||
<pre>pos.move(App.Vector(-10,0,0))
|
||
FreeCAD.getDocument("Unnamed").getObject("Robot").Tcp = pos </pre>
|
||
<p>在激活的文档中创建一个空轨迹对象
|
||
</p>
|
||
<pre>App.activeDocument().addObject("Robot::TrajectoryObject","Trajectory") </pre>
|
||
<p>得到轨迹
|
||
</p>
|
||
<pre>t = App.activeDocument().Trajectory.Trajectory </pre>
|
||
<p>添加机器人的实际TCP位置轨迹
|
||
</p>
|
||
<pre>StartTcp = App.activeDocument().Robot.Tcp
|
||
t.insertWaypoints(StartTcp)
|
||
App.activeDocument().Trajectory.Trajectory = t
|
||
print App.activeDocument().Trajectory.Trajectory </pre>
|
||
<p>插入更多的航点并再次将起始点插入到最后:
|
||
</p>
|
||
<pre>for i in range(7):
|
||
t.insertWaypoints(Waypoint(Placement(Vector(0,1000,i*100+500),Vector(1,0,0),i),"LIN","Pt"))
|
||
|
||
t.insertWaypoints(StartTcp) # end point of the trajectory
|
||
App.activeDocument().Trajectory.Trajectory = t
|
||
print App.activeDocument().Trajectory.Trajectory </pre>
|
||
<h3><span class="mw-headline" id=".E6.A8.A1.E6.8B.9F">模拟</span></h3>
|
||
<p>To be done.....
|
||
</p>
|
||
<h3><span class="mw-headline" id=".E5.AF.BC.E5.87.BA.E8.BD.A8.E8.BF.B9">导出轨迹</span></h3>
|
||
<p>轨迹由 Python 导出。 意思是为每个控制柜类型有一个后处理器 Python 模块。 下面详细描述了 Kuka 后处理器
|
||
</p>
|
||
<pre>from KukaExporter import ExportCompactSub
|
||
|
||
ExportCompactSub(App.activeDocument().Robot,App.activeDocument().Trajectory,'D:/Temp/TestOut.src') </pre>
|
||
<p>以及它是怎么做的:
|
||
</p>
|
||
<pre>for w in App.activeDocument().Trajectory.Trajectory.Waypoints:
|
||
(A,B,C) = (w.Pos.Rotation.toEuler())
|
||
print ("LIN {X %.3f,Y %.3f,Z %.3f,A %.3f,B %.3f,C %.3f} ; %s"%(w.Pos.Base.x,w.Pos.Base.y,w.Pos.Base.z,A,B,C,w.Name)) </pre>
|
||
<h2><span class="mw-headline" id="Tutorials">Tutorials</span></h2>
|
||
<ul><li> <a href="Robot_6-Axis.html" title="Robot 6-Axis">Robot 6-Axis</a></li>
|
||
<li> <a href="VRML_Preparation_for_Robot_Simulation.html" title="VRML Preparation for Robot Simulation">VRML Preparation for Robot Simulation</a></li></ul>
|
||
<p><br />
|
||
</p>
|
||
|
||
|
||
|
||
|
||
</div>
|
||
|
||
</div><div class="printfooter">
|
||
Online version: "<a dir="ltr" href="https://www.freecadweb.org/wiki/index.php?title=Robot_Workbench/zh-cn&oldid=290091">http://www.freecadweb.org/wiki/index.php?title=Robot_Workbench/zh-cn&oldid=290091</a>"</div>
|
||
<div id="catlinks" class="catlinks" data-mw="interface"></div><div class="visualClear"></div>
|
||
</div>
|
||
</div>
|
||
<div id="mw-navigation">
|
||
<h2>Navigation menu</h2>
|
||
|
||
</body></html> |