《最新ABB机器人编程程序解析.docx》由会员分享,可在线阅读,更多相关《最新ABB机器人编程程序解析.docx(49页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、Four short words sum up what has lifted most successful individuals above the crowd: a little bit more.-author-dateABB机器人编程程序解析ABB机器人编程程序解析ABB机器人编程1程序解析:1、此程序是典型的ABB机器人官方编程思路与方法,分为主程序,初始化例行程序和轨迹程序。2、思路清晰,结构编排明确,方便使用者阅读。%VERSION:1LANGUAGE:ENGLISH%MODULE MainModulePERS tooldata tGripper:=TRUE,0,0,100,
2、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,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
3、,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,0,0,0,1,0,0,0,0,0,0;以上是固定的数据存放位置。PROC main()主程序,是一个程序的开始rInitial;Accset 60,60;此部分其实可放入到rInitial中去,这样管理起来更方便velset 100,100;此部分其实可放入到rInitial中去,这样管理起来更方便WHILE TRUE DOrBox;在此指令后插入0.3秒的等
4、待指令,防止CPU过负荷的情况出现。ENDWHILEENDPROCPROC rInitial()SetDo DOGrip,0;WaitDI DIGripReleased,1;MoveJ pHome, v300, z50, tGripper;ENDPROCPROC rBox()MoveJ offs(pPointA,0,200,500), v1500, z100,tGripper;MoveJ offs(pPointA,0,200,0), v1500, z50,tGripper;A:TPErase;IF DIAllowPick=1THENWaitTime 0;ELSEIF DIAllowPick=0
5、 THENTPWrite Signal of AllowPick no ready,Please Check!;GOTO A;ENDIFMoveL 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,200), v1000, z50, tGripperWObj:=Wo
6、bBox;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;ENDPROCENDMODULEABB机器人编程02程序解析:1、此程序编写的思路是完全按照比赛题目中的要求的进行,就是按
7、步就班式的2、思路清晰,结构编排明确,方便使用者阅读。3、有相应的写屏信息提示,方便操作员对机器人运行状态的了解。4、有一点小问题,就是缺少初始化的部分。MODULEMainModuleCONSTrobtargetPHOME:=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,650.90,0.429093,0.468557,-0.496153,0.591749,-1,0,-
8、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,1,9E+09,9E+09,9E+09,9E+09,9E+09,9E+09;CONSTrobtarg
9、etP40:=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,9E+09,9E+09,9E+09,9E+09,9E+09,9E+09;PROCmain()在主程序里,过于臃肿,将具体功能尽量细分到例行程序TPErase;MoveJPHOME,v1000,z50
10、,tool0;OpenGripper;WaitTime5;WHILEtrueDOIFPLC=1THENTPErase;TPWriteWarning! Begin to move the new staff.;WaitTime1;ClkResetclock1;ClkStartclock1;MovFromAtoB;ClkStopclock1;reg1:=ClkRead(clock1);TPErase;TPWriteGoods handling in place, it take (time in second): Num:=reg1;运行时间的显示WaitTime5;ELSETPErase;TPW
11、riteWaiting for new goods.;运行状态的提醒WaitDIPLC,1;ENDIFENDWHILEENDPROCPROCOpenGripper()将对夹具的控制做在一个例行程序里,方便管理SetG0;ResetG1;ENDPROCPROCCloseGripper()将对夹具的控制做在一个例行程序里,方便管理SetG1;ResetG0;ENDPROCPROCMovFromAtoB()MoveJP30,v1000,z50,tool0;MoveJP20,v1000,z50,tool0;MoveLPA,v50,fine,tool0;WaitTime1;CloseGripper;Wa
12、itTime1;MoveJP20,v50,z50,tool0;MoveJP30,v1000,z50,tool0;MoveJP40,v1000,z50,tool0;MoveLPB,v50,fine,tool0;WaitTime1;OpenGripper;WaitTime1;MoveLP40,v50,z50,tool0;MoveJP30,v1000,z50,tool0;MoveJPHOME,v1000,z50,tool0;ENDPROCENDMODULEABB机器人编程03程序解析:1、此程序是典型的ABB机器人官方编程思路与方法,分为主程序,初始化例行程序和轨迹程序。2、思路清晰,结构编排明确,
13、方便使用者阅读。3、但有点要注意的初始化例行程序只在开始时,执行一次,正常运行时,不再执行。但此程序是每个循环都会进行一次初始化,是有点问题的。PROC main()InitAll;此初始化程序应与循环执行的程序隔离开,使用WHILE指令Circle;WaitTime 0.5;ENDPROCPROC InitAll()Reset Do_fixOn;WaitDIOnConfJOn;ConfLOn;VelSet 80, 1000;AccSet 70,70;MoveJ PHome, v150, fine, Tool0WObj:=Wobj2;RETURN;ENDPROCPROC Circle()Mov
14、eJ Home, v60, z0, Tool0WObj:=Wobj2;waitDI;work;reset waitDIMoveJ Home, v150, fine, Tool0WObj:=Wobj2;ENDPROCPROC fixopen()Set Do_fixopen;ENDPROCPROC fixclose()Reset Do_fixclose;ENDPROCPROC Work()MOVEJ A0v150, z10, Tool0WObj:=Wobj2;fixopen;waittime 2;MOVEL A1v30, fine,Tool0WObj:=Wobj2;fixclose;waittim
15、e 2;MOVEJ B0v150, z10, Tool0WObj:=Wobj2;MOVEj B1v30, fine,Tool0WObj:=Wobj2;fixopen;waittime 2;MoveJ PHome, v150, fine, Tool0WObj:=Wobj2;ENDPROCABB机器人编程04程序解析:1、此程序是典型的ABB机器人官方编程思路与方法。2、思路清晰,结构编排明确,方便使用者阅读。3、此程序有一个亮点,就是有一个回等待点的例行程序rMoveHome,这个好处在于可以在手动状态下,就能方便的回到机器人的等待位置。4、有足够的写屏信息,很好地提示运行状态。PROC Mai
16、n()rInitial;rMoveHome;While True DoVelset 100,3000;AccSet 70, 70;rpickworkpiece;rplaceworkpiece;endwhileproc rpickworkpiece;if workpiece=falseMoveJ pickup, v2000, z5, too10;A:TPErase;IF DI10_pickup=1THEN(pickup为PLC发来拾取信号)WaitTime 0;ELSEIF DI10_pickup=0 THENTPWrite PLC-pickup signal no ready.;GOTO A;
17、ENDIFMoveJ Offs(pickup,0,0,300), v500, z200, too10;SetDo DO10_pickup1,1;wait time1;workpiece=tureendifendprocproc rplaceworkpiece;if workpiece=tureMoveJ placemiddle, v2000, z5, too10;MoveJ placeworkpiece, v2000, z5, too10;MoveJ Offs(placeworkpiece,0,0,300), v500, z200, too10;SetDo DO10_pickup1,0;A:T
18、PErase;IF DI10_pickon=1THEN(pickon为PLC检测已放好信号)WaitTime 0;ELSEIF DI10_pickup=0 THENTPWrite PLC-pickON signal no ready.;GOTO A;workpiece=falseENDIFendprocPROC rInitial()TpReadFk nInput,Is the pack_machine ready,No,Yes;(机器是否准备好)If nInput=4 ThenbReady:=False;stop;ElseIF nInput=5 thenbReady:=True;ENDIFbF
19、irstPickBoard:=True;TpReadFk nInput,Do you want to place workpiece,No,Yes;(机器人抓头是否工件)If nInput=4 Thenworkpiece:=False;ElseIF nInput=5 thenworkpiece:=True;ENDPROC PROC rMoveHome()(定义原点)此例行程序可以方便地回到等待位置MoveJ pHome, v500, z50, tGripper;ENDPROCABB机器人编程05程序解析:1、此程序是典型的ABB机器人官方编程思路与方法。2、思路清晰,结构编排明确,方便使用者阅
20、读。3、此程序共分了3个程序模块,清楚地将不同用途的语句分开,方便阅读,这种编程在进行一些复杂系统的编程是非常有用的。4、里面编程中运用了很多编程技巧,节省了机器人示教的时间,如使用OFFS功能。5、在写屏信息提示方面也非常丰富。6、此程序非常适合大家的参考与提高。7、有一个小问题,缺少搬运重要的负荷重量设定数据。MODULE Data此模块专门用于存放程序数据的!targetCONST jointtarget home_pos := 0, 0, 0, 0, 90, 0, 9E9, 9E9, 9E9, 9E9, 9E9, 9E9 ;CONST jointtarget delta_pos :=
21、2, 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
22、,9E9;VAR wzstationary home;VAR shapedata joint_space;VAR num nu_inhome;VAR bool flag1:=FALSE;ENDMODULE%VERSION: 1LANGUAGE: 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,1,0,0,0,0,0,
23、0,1,0,0,0;ENDMODULEMODULE MainModulePROC main()CheckHome;CheckGriper;Production;ENDPROCPROC CheckHome()IF DOutput(do_inhome) = 1 THENnu_inhome := 1;ELSEnu_inhome :=0;ENDIFTEST nu_inhomeCASE 0 :GoHome;CASE 1 :RETURN;DEFAULT :TPWrite error;Stop;ENDTESTENDPROCPROC CheckGriper()IF di_griperclosed = 1 TH
24、ENControlGriper;ELSERETURN;ENDIFENDPROCPROC Production()WHILE TRUE DOWaitUntil di_plc=1;MoveL Offs(roFetch,0,0,500),v1000,z100,Tooldata_1WObj:=Workobject_1;利用OFFS此功能,减少示教MoveL roFetch,v1000,fine,Tooldata_1WObj:=Workobject_1;CloseGriper;MoveL Offs(roFetch,0,0,500),v1000,z100,Tooldata_1WObj:=Workobjec
25、t_1;MoveL Offs(roDeFetch,0,0,500),v1000,z100,Tooldata_1WObj:=Workobject_1;MoveL roDeFetch,v1000,fine,Tooldata_1WObj:=Workobject_1;OpenGriper;MoveL Offs(roDeFetch,0,0,500),v1000,z100,Tooldata_1WObj:=Workobject_1;ENDWHILEENDPROCPROC CloseGriper()flag1:=FALSE;Reset do_opengriper;Set do_closegriper;Wait
26、DI di_griperclosed, 1MaxTime:=3TimeFlag:=flag1;WHILE flag1=TRUE DOTPWriteCANNT CLOSE GRIPER;StopNoRegain;ENDWHILEENDPROCPROC OpenGriper()flag1:=FALSE;Set do_opengriper;Reset do_closegriper;WaitDI di_griperopend, 1MaxTime:=3TimeFlag:=flag1;WHILE flag1=TRUE DOTPWriteCANNT OPEN GRIPER;StopNoRegain;ENDW
27、HILEENDPROCPROC DEF_Zone()对机器人是否在等待位进行检测WZHomeJointDef Inside, joint_space, home_pos, delta_pos;WZDOSetStat, homeInside, joint_space, do_inhome, 1;!RETURN;ENDPROCPROC GoHome()VAR btnres answer;VAR string my_message2:= ,;CONST string my_buttons2:=MOVE TO HOME,STOP PRG;丰富的写屏指令my_message1:=RBT IS IN SA
28、FETY POSITION;my_message2:=OR CANNOT MOVE AUTOMATICALLY;answer:= UIMessageBox (Header:=RBT IS IN SAFETY AREA TO MOVE ON HOME?MsgArray:=my_messageBtnArray:=my_buttonsIcon:=iconWarning);IF answer=2 THENEXIT;!StopNoRegain;ELSEMoveAbsJ jhomeNoEOffs, v100, z5, Tooldata_1;ENDIFENDPROCPROC ControlGriper()V
29、AR 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_messageBtnArray:=my_buttonsIcon:=iconWarning);IF answer=2 THENEXIT;!StopNoRegain;ELSEOpenGriper;ENDIFENDPROCENDMODULE-