《2022年最新ABB机器人编程程序解析.pdf》由会员分享,可在线阅读,更多相关《2022年最新ABB机器人编程程序解析.pdf(11页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、精品文档精品文档 ABB 机器人编程1程序解析:1、此程序是典型的ABB 机器人官方编程思路与方法,分为主程序,初始化例行程序和轨迹程序。2、思路清晰,结构编排明确,方便使用者阅读。% VERSION:1 LANGUAGE:ENGLISH % MODULE MainModule PERS tooldata tGripper:=TRUE,0,0,100,1,0,0,0,25,0,0,10,1,0,0,0,0,0,0; PERS wobjdata WobBox:=FALSE,TRUE,1,1,1,0,0,0,0,0,0,0,1,0,0,0; CONST robtarget pPointA:=1,1
2、,1,1,1,1,1,-1,0,0,0,9E+09,9E+09,9E+09,9E+09,9E+09,9E+09; CONST robtarget pPointB:=1,1,1,1,1,1,1,-1,0,0,0,9E+09,9E+09,9E+09,9E+09,9E+09,9E+09; CONST robtarget PHome:=1,1,1,1,1,1,1,-1,0,0,0,9E+09,9E+09,9E+09,9E+09,9E+09,9E+09; PERS loaddata load_Empty:=1,0,0,0,1,0,0,0,0,0,0; PERS loaddata load_Box:=20
3、,0,0,0,1,0,0,0,0,0,0; 以上是固定的数据存放位置。 PROC main() 主程序,是一个程序的开始 rInitial; Accset 60,60; 此部分其实可放入到rInitial 中去,这样管理起来更方便 velset 100,100; 此部分其实可放入到rInitial 中去,这样管理起来更方便 WHILE TRUE DO rBox; 在此指令后插入0.3 秒的等待指令,防止CPU 过负荷的情况出现。 ENDWHILE ENDPROC PROC rInitial() SetDo DOGrip,0; WaitDI DIGripReleased,1; MoveJ pHo
4、me, v300, z50, tGripper; ENDPROC PROC rBox() MoveJ offs(pPointA,0,200,500), v1500, z100,tGripper; MoveJ offs(pPointA,0,200,0), v1500, z50,tGripper; A: TPErase; IF DIAllowPick=1 THEN WaitTime 0; ELSEIF DIAllowPick=0 THEN 精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 1 页,共 11 页
5、- - - - - - - - - - 精品文档精品文档 TPWrite Signal of AllowPick no ready,Please Check!; GOTO A; ENDIF MoveL pPointA,v800, fine, tGripper; SetDo DOGrip,1; WaitDI DIGripPicked,1; Gripload load_Box; 这一句很重要的, 设定机器人的实际负荷情况,有利于机器人伺服控制的优化 MoveJ offs(pPointA,0,0,500), v1000, z100, tGripper; MoveJ offs(pPointB,0,0,
6、200), v1000, z50, tGripperWObj:=WobBox; MoveL pPointB, v1000, fine, tGripperWObj:=WobBox; SetDo DOGrip,0; WaitDI DIGripReleased,1; Gripload load_Empty; MoveL offs(pPointB,0,200,0), v800, z50, tGripperWObj:=WobBox; MoveJ offs(pPointB,0,200,500), v1500, z100, tGripperWObj:=WobBox; ENDPROC ENDMODULE AB
7、B 机器人编程 02 程序解析:1、此程序编写的思路是完全按照比赛题目中的要求的进行,就是按步就班式的2、思路清晰,结构编排明确,方便使用者阅读。3、有相应的写屏信息提示,方便操作员对机器人运行状态的了解。4、有一点小问题,就是缺少初始化的部分。MODULEMainModule CONSTrobtargetPHOME:=1149.87,13.55,451.35,0.729477,0.0748599,0.679603,0.0199765,0,0,0,1,9E+09,9E+09,9E+09,9E+09,9E+09,9E+09; CONSTrobtargetPA:=250.14,-652.34,65
8、0.90,0.429093,0.468557,-0.496153,0.591749,-1,0,-2,1,9E+09,9E+09,9E+09,9E+09,9E+09,9E+09; CONSTrobtargetP20:=250.14,-652.35,828.56,0.429091,0.468538,-0.496163,0.591756,-1,0,-3,1,9E+09,9E+09,9E+09,9E+09,9E+09,9E+09; CONSTrobtargetP30:=695.24,18.14,826.55,0.0377066,-0.677588,0.0913591,-0.728771,0,0,-2,
9、1,9E+09,9E+09,9E+09,9E+09,9E+09,9E+09; CONSTrobtargetP40:=1227.51,18.14,826.55,0.0377092,-0.677583,0.0913642,-0.728774,0,0,-3,1,9E+09,9E+09,9E+09,9E+09,9E+09,9E+09; CONSTrobtargetPB:=1227.52,18.15,424.02,0.0377092,-0.677591,0.0913577,-0.728767,0,0,-2,1,9精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归
10、纳 - - - - - - - - - -第 2 页,共 11 页 - - - - - - - - - - 精品文档精品文档E+09,9E+09,9E+09,9E+09,9E+09,9E+09; PROCmain() 在主程序里,过于臃肿,将具体功能尽量细分到例行程序 TPErase; MoveJPHOME,v1000,z50,tool0; OpenGripper; WaitTime5; WHILEtrueDO IFPLC=1THEN TPErase; TPWriteWarning! Begin to move the new staff.; WaitTime1; ClkResetclock1
11、; ClkStartclock1; MovFromAtoB; ClkStopclock1; reg1:=ClkRead(clock1); TPErase; TPWriteGoods handling in place, it take (time in second): Num:=reg1; 运行时间的显示 WaitTime5; ELSETPErase; TPWriteWaiting for new goods.; 运行状态的提醒 WaitDIPLC,1; ENDIF ENDWHILE ENDPROC PROCOpenGripper() 将对夹具的控制做在一个例行程序里,方便管理 SetG0;
12、 ResetG1; ENDPROC PROCCloseGripper() 将对夹具的控制做在一个例行程序里,方便管理 SetG1; ResetG0; ENDPROC PROCMovFromAtoB() MoveJP30,v1000,z50,tool0; MoveJP20,v1000,z50,tool0; MoveLPA,v50,fine,tool0; WaitTime1; CloseGripper; WaitTime1; MoveJP20,v50,z50,tool0; MoveJP30,v1000,z50,tool0; MoveJP40,v1000,z50,tool0; MoveLPB,v50
13、,fine,tool0; 精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 3 页,共 11 页 - - - - - - - - - - 精品文档精品文档 WaitTime1; OpenGripper; WaitTime1; MoveLP40,v50,z50,tool0; MoveJP30,v1000,z50,tool0; MoveJPHOME,v1000,z50,tool0; ENDPROC ENDMODULE ABB 机器人编程 03程序解析:1、此程序是典型的ABB 机器人官方编程思路与方法,分为主程
14、序,初始化例行程序和轨迹程序。2、思路清晰,结构编排明确,方便使用者阅读。3、但有点要注意的初始化例行程序只在开始时,执行一次,正常运行时,不再执行。但此程序是每个循环都会进行一次初始化,是有点问题的。PROC main() InitAll; 此初始化程序应与循环执行的程序隔离开,使用WHILE 指令 Circle; WaitTime 0.5; ENDPROC PROC InitAll() Reset Do_fixOn; WaitDIOn ConfJOn; ConfLOn; VelSet 80, 1000; AccSet 70,70; MoveJ PHome, v150, fine, Tool
15、0WObj:=Wobj2; RETURN; ENDPROC PROC Circle() MoveJ Home, v60, z0, Tool0WObj:=Wobj2; waitDI; 精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 4 页,共 11 页 - - - - - - - - - - 精品文档精品文档 work; reset waitDI MoveJ Home, v150, fine, Tool0WObj:=Wobj2; ENDPROC PROC fixopen() Set Do_fixopen;
16、ENDPROC PROC fixclose() Reset Do_fixclose; ENDPROC PROC Work() MOVEJ A0 v150, z10, Tool0WObj:=Wobj2; fixopen; waittime 2; MOVEL A1 v30, fine,Tool0WObj:=Wobj2; fixclose; waittime 2; MOVEJ B0 v150, z10, Tool0WObj:=Wobj2; MOVEj B1 v30, fine,Tool0WObj:=Wobj2; fixopen; waittime 2; MoveJ PHome, v150, fine
17、, Tool0WObj:=Wobj2; ENDPROC ABB 机器人编程 04 程序解析:1、此程序是典型的ABB 机器人官方编程思路与方法。2、思路清晰,结构编排明确,方便使用者阅读。3、此程序有一个亮点,就是有一个回等待点的例行程序rMoveHome,这个好处在于可以在手动状态下,就能方便的回到机器人的等待位置。4、有足够的写屏信息,很好地提示运行状态。PROC Main() 精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 5 页,共 11 页 - - - - - - - - - - 精品文档精品文
18、档 rInitial; rMoveHome; While True Do Velset 100,3000; AccSet 70, 70; rpickworkpiece; rplaceworkpiece; endwhile proc rpickworkpiece; if workpiece=false MoveJ pickup, v2000, z5, too10; A: TPErase; IF DI10_pickup=1 THEN (pickup 为 PLC 发来拾取信号 ) WaitTime 0; ELSEIF DI10_pickup=0 THEN TPWrite PLC-pickup sig
19、nal no ready.; GOTO A; ENDIF MoveJ Offs(pickup,0,0,300), v500, z200, too10; SetDo DO10_pickup1,1; wait time 1; workpiece=ture endif endproc proc rplaceworkpiece; if workpiece=ture MoveJ placemiddle, v2000, z5, too10; MoveJ placeworkpiece, v2000, z5, too10; MoveJ Offs(placeworkpiece,0,0,300), v500, z
20、200, too10; SetDo DO10_pickup1,0; A: TPErase; IF DI10_pickon=1 THEN (pickon 为 PLC 检测已放好信号 ) WaitTime 0; ELSEIF DI10_pickup=0 THEN TPWrite PLC-pickON signal no ready.; GOTO A; workpiece=false ENDIF 精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 6 页,共 11 页 - - - - - - - - - - 精品文
21、档精品文档 endproc PROC rInitial() TpReadFk nInput,Is the pack_machine ready,No,Yes;(机器是否准备好) If nInput=4 Then bReady:=False; stop; ElseIF nInput=5 then bReady:=True; ENDIF bFirstPickBoard:=True; TpReadFk nInput,Do you want to place workpiece,No,Yes;(机器人抓头是否工件) If nInput=4 Then workpiece:=False; ElseIF n
22、Input=5 then workpiece:=True; ENDPROC PROC rMoveHome() (定义原点)此例行程序可以方便地回到等待位置 MoveJ pHome, v500, z50, tGripper; ENDPROC ABB 机器人编程 05程序解析:1、此程序是典型的ABB 机器人官方编程思路与方法。精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 7 页,共 11 页 - - - - - - - - - - 精品文档精品文档2、思路清晰,结构编排明确,方便使用者阅读。3、此程序共分
23、了3 个程序模块,清楚地将不同用途的语句分开,方便阅读,这种编程在进行一些复杂系统的编程是非常有用的。4、里面编程中运用了很多编程技巧,节省了机器人示教的时间,如使用OFFS 功能。5、在写屏信息提示方面也非常丰富。6、此程序非常适合大家的参考与提高。7、有一个小问题,缺少搬运重要的负荷重量设定数据。MODULE Data 此模块专门用于存放程序数据的 !target CONST jointtarget home_pos := 0, 0, 0, 0, 90, 0, 9E9, 9E9, 9E9, 9E9, 9E9, 9E9 ; CONST jointtarget delta_pos := 2,
24、2, 2, 2, 2, 2, 9E9, 9E9, 9E9, 9E9, 9E9, 9E9 ; CONST jointtarget jhome := 0, 0, 0, 0, 90, 0, 9E9, 9E9, 9E9, 9E9, 9E9, 9E9 ; PERS robtarget roFetch:=2000,0,233.483269239532,0,0,1,0,0,0,0,0,9E9,9E9,9E9,9E9,9E9,9E9; PERS robtarget roDeFetch:=2000,1000,233.483269239532,0,0,1,0,0,0,0,0,9E9,9E9,9E9,9E9,9E9
25、,9E9; VAR wzstationary home; VAR shapedata joint_space; VAR num nu_inhome; VAR bool flag1:=FALSE; ENDMODULE % VERSION: 1 LANGUAGE: ENGLISH % MODULE CalibData 此模块用于存放需要设定的程序数据 TASK PERS tooldata Tooldata_1:=TRUE,0,0,1000,1,0,0,0,1,0,0,1,1,0,0,0,0,0,0; TASK PERS wobjdata Workobject_1:=FALSE,TRUE,0,0,0
26、,1,0,0,0,0,0,0,1,0,0,0; ENDMODULE 精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 8 页,共 11 页 - - - - - - - - - - 精品文档精品文档MODULE MainModule PROC main() CheckHome; CheckGriper; Production; ENDPROC PROC CheckHome() IF DOutput(do_inhome) = 1 THEN nu_inhome := 1; ELSE nu_inhome :=0;
27、ENDIF TEST nu_inhome CASE 0 : GoHome; CASE 1 : RETURN; DEFAULT : TPWrite error; Stop; ENDTEST ENDPROC PROC CheckGriper() IF di_griperclosed = 1 THEN ControlGriper; ELSE RETURN; ENDIF ENDPROC PROC Production() WHILE TRUE DO WaitUntil di_plc=1; MoveL Offs(roFetch,0,0,500),v1000,z100,Tooldata_1WObj:=Wo
28、rkobject_1; 利用 OFFS此功能,减少示教 MoveL roFetch,v1000,fine,Tooldata_1WObj:=Workobject_1; CloseGriper; MoveL Offs(roFetch,0,0,500),v1000,z100,Tooldata_1WObj:=Workobject_1; MoveL Offs(roDeFetch,0,0,500),v1000,z100,Tooldata_1WObj:=Workobject_1; MoveL roDeFetch,v1000,fine,Tooldata_1WObj:=Workobject_1; OpenGri
29、per; MoveL Offs(roDeFetch,0,0,500),v1000,z100,Tooldata_1WObj:=Workobject_1; ENDWHILE 精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 9 页,共 11 页 - - - - - - - - - - 精品文档精品文档ENDPROC PROC CloseGriper() flag1:=FALSE; Reset do_opengriper; Set do_closegriper; WaitDI di_griperclosed, 1
30、MaxTime:=3TimeFlag:=flag1; WHILE flag1=TRUE DO TPWriteCANNT CLOSE GRIPER; StopNoRegain; ENDWHILE ENDPROC PROC OpenGriper() flag1:=FALSE; Set do_opengriper; Reset do_closegriper; WaitDI di_griperopend, 1MaxTime:=3TimeFlag:=flag1; WHILE flag1=TRUE DO TPWriteCANNT OPEN GRIPER; StopNoRegain; ENDWHILE EN
31、DPROC PROC DEF_Zone() 对机器人是否在等待位进行检测WZHomeJointDef Inside, joint_space, home_pos, delta_pos; WZDOSetStat, homeInside, joint_space, do_inhome, 1; !RETURN; ENDPROC PROC GoHome() VAR btnres answer; VAR string my_message2:= ,; CONST string my_buttons2:=MOVE TO HOME,STOP PRG; 丰富的写屏指令 my_message1:=RBT IS
32、IN SAFETY POSITION; my_message2:=OR CANNOT MOVE AUTOMATICALLY; answer:= UIMessageBox ( Header:=RBT IS IN SAFETY AREA TO MOVE ON HOME? MsgArray:=my_message BtnArray:=my_buttons Icon:=iconWarning); IF answer=2 THEN EXIT; !StopNoRegain; ELSE MoveAbsJ jhomeNoEOffs, v100, z5, Tooldata_1; ENDIF ENDPROC 精品
33、资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 10 页,共 11 页 - - - - - - - - - - 精品文档精品文档PROC ControlGriper() VAR btnres answer; VAR string my_message2:= ,; CONST string my_buttons2:=OPEN GRIPER,STOP PRG; 丰富的写屏指令 my_message1:=GRIPER IS NOT EMPTY; my_message2:=OR SENSOR IS WRONG; answer:= UIMessageBox ( Header:=OPEN THE GRIPER? MsgArray:=my_message BtnArray:=my_buttons Icon:=iconWarning); IF answer=2 THEN EXIT; !StopNoRegain; ELSE OpenGriper; ENDIF ENDPROC ENDMODULE 精品资料 - - - 欢迎下载 - - - - - - - - - - - 欢迎下载 名师归纳 - - - - - - - - - -第 11 页,共 11 页 - - - - - - - - - -
限制150内