离线编程意味着在生产线外进行机器人编程。离线编程避免了在线编程导致的生产“停机”时间,通过离线编程与仿真可以更好地调试与规划工作空间、避免出错。
用合适的仿真器进行离线编程将最大化机器人系统的投资回报率。给机器人设计新任务所需要的时间由数周缩短到数天,短期生产也可实现“机器人化”。
使用RoboDK进行离线编程没有限制。RoboDK友好的用户图形界面方便了工业机器人仿真。应用程序编程接口(API)意味着您可以使用Python给机器人编程。RoboDK支持多种品牌的机器人控制器,给您的机器人输出相应的程序文件。您还可以根据需要编辑后处理器(Post Processor)。
Python让您更快、更有效地整合您的系统。相较于其他编程语言来说,Python更简单有效,并且容易学习。版本Python 3.10 将随 RoboDK 自动安装.
RoboDK 用于Python 的应用程序编程接口(API)参考资料以及范例在 这里。RoboDK的应用程序编程接口(API)与 C#(包括范例)以及 Matlab 也兼容。
from robolink import * # RoboDK's API from robodk import * # Math toolbox for robots # Any interaction with RoboDK must be done through # Robolink() RDK = Robolink() # get the robot item: robot = RDK.Item('ABB IRB 1600ID-4/1.5') # get the home target and the welding targets: home = RDK.Item('Home') target = RDK.Item('Target 1') # get the pose of the target (4x4 matrix): ref = target.Pose() # move the robot to home, then to the center: robot.MoveJ(home) robot.MoveJ(target) # call a robot program to start the weld gun RDK.RunProgram('WeldStart') # make an hexagon around the center: for i in range(7): ang = i*2*pi/6 #ang = 0, 60, 120, ..., 360 pi = ref*rotz(ang)*transl(200,0,0)*rotz(-ang) robot.MoveL(pi) # call a robot program to stop the weld gun RDK.RunProgram('WeldStop') # move back to the center, then home: robot.MoveL(target) robot.MoveJ(home)
当仿真调试满意之后,在主程序树中右键点击Python程序(即此范例中的“Hexagonal Path”),然后选择“生成机器人程序文件”,以下文件将自动生成。
MODULE MOD_Weld_Hexagon PERS wobjdata rdkWObj := [FALSE, TRUE, "", [[0,0,0],[1,0,0,0]],[[0,0,0],[1,0,0,0]]; PERS tooldata rdkTool := [TRUE,[[0,0,0],[1,0,0,0]],[3,[0,0,200],[1,0,0,0],0,0,0.005]]; VAR speeddata rdkSpeed := [500,500,500,500]; VAR extjoint rdkExtax := [9E9,9E9,9E9,9E9,9E9,9E9]; PROC Weld_Hexagon() !Program generated by RoboDK for ABB IRB 1600ID-4/1.5 on 29/11/2014 17:42:31 ConfJ \On; ConfL \On; rdkWObj.oframe:=[0,0,0],[1,0,0,0]; rdkWObj.uframe:=[0,0,0],[1,0,0,0]; rdkTool.tframe:=[-4,0,371.3],[0.92387953,0,0.38268343,0]; MoveAbsJ [[-0,-19.143793,-7.978668,0,49.189506,-0]],rdkExtax], rdkSpeed, rdkZone, rdkTool, \WObj:=rdkWObj; MoveJ [[1010.634,-114.491,662.29],[0,0,1,0],[-1,0,-1,0],rdkExtax], rdkSpeed, rdkZone, rdkTool, \WObj:=rdkWObj; WeldStart; MoveL [[810.634,-114.491,662.29],[0,0,1,0],[-1,0,-1,0],rdkExtax], rdkSpeed, rdkZone, rdkTool, \WObj:=rdkWObj; MoveL [[910.634,58.715,662.29],[0,0,1,0.00000001],[0,-1,0,0],rdkExtax], rdkSpeed, rdkZone, rdkTool, \WObj:=rdkWObj; MoveL [[1110.634,58.715,662.29],[0,0,1,0],[0,-1,0,0],rdkExtax], rdkSpeed, rdkZone, rdkTool, \WObj:=rdkWObj; MoveL [[1210.634,-114.491,662.29],[0,0,1,0],[-1,0,-1,0],rdkExtax], rdkSpeed, rdkZone, rdkTool, \WObj:=rdkWObj; MoveL [[1110.634,-287.696,662.29],[0,0,1,0],[-1,0,-1,0],rdkExtax], rdkSpeed, rdkZone, rdkTool, \WObj:=rdkWObj; MoveL [[910.634,-287.696,662.29],[0,0,1,0],[-1,0,-1,0],rdkExtax], rdkSpeed, rdkZone, rdkTool, \WObj:=rdkWObj; MoveL [[810.634,-114.491,662.29],[0,0,1,0],[-1,0,-1,0],rdkExtax], rdkSpeed, rdkZone, rdkTool, \WObj:=rdkWObj; WeldStop; MoveL [[1010.634,-114.491,662.29],[0,0,1,0],[-1,0,-1,0],rdkExtax], rdkSpeed, rdkZone, rdkTool, \WObj:=rdkWObj; MoveAbsJ [[-0,-19.143793,-7.978668,0,49.189506,-0]],rdkExtax], rdkSpeed, rdkZone, rdkTool, \WObj:=rdkWObj; ConfJ \On; ConfL \On; ENDPROC ENDMODULE