ABB机器人编程1程序解析:1、此程序是典型的ABB机器人官方编程思路与方法,分为主程序,初始化例行程序和轨迹程序。2、思路清晰,结构编排明确,方便使用者阅读。%%%VERSION:1LANGUAGE:ENGLISH%%%MODULEMainModulePERStooldatatGripper:=[TRUE,[[0,0,100],[1,0,0,0]],[25,[0,0,10],[1,0,0,0],0,0,0]];PERSwobjdataWobBox:=[FALSE,TRUE,,[[1,1,1],[0,0,0,0]],[[0,0,0],[1,0,0,0]]];CONSTrobtargetpPointA:=[[1,1,1],[1,1,1,1],[-1,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];CONSTrobtargetpPointB:=[[1,1,1],[1,1,1,1],[-1,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];CONSTrobtargetPHome:=[[1,1,1],[1,1,1,1],[-1,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];PERSloaddataload_Empty:=[1,[0,0,0],[1,0,0,0],0,0,0];PERSloaddataload_Box:=[20,[0,0,0],[1,0,0,0],0,0,0];以上是固定的数据存放位置。PROCmain()主程序,是一个程序的开始rInitial;Accset60,60;此部分其实可放入到rInitial中去,这样管理起来更方便velset100,100;此部分其实可放入到rInitial中去,这样管理起来更方便WHILETRUEDOrBox;在此指令后插入0.3秒的等待指令,防止CPU过负荷的情况出现。ENDWHILEENDPROCPROCrInitial()SetDoDOGrip,0;WaitDIDIGripReleased,1;MoveJpHome,v300,z50,tGripper;ENDPROCPROCrBox()MoveJoffs(pPointA,0,200,500),v1500,z100,tGripper;MoveJoffs(pPointA,0,200,0),v1500,z50,tGripper;A:TPErase;IFDIAllowPick=1THENWaitTime0;ELSEIFDIAllowPick=0THENTPWriteSignalofAllowPicknoready,PleaseCheck!;GOTOA;ENDIFMoveLpPointA,v800,fine,tGripper;SetDoDOGrip,1;WaitDIDIGripPicked,1;Griploadload_Box;这一句很重要的,设定机器人的实际负荷情况,有利于机器人伺服控制的优化MoveJoffs(pPointA,0,0,500),v1000,z100,tGripper;MoveJoffs(pPointB,0,0,200),v1000,z50,tGripper\WObj:=WobBox;MoveLpPointB,v1000,fine,tGripper\WObj:=WobBox;SetDoDOGrip,0;WaitDIDIGripReleased,1;Griploadload_Empty;MoveLoffs(pPointB,0,200,0),v800,z50,tGripper\WObj:=WobBox;MoveJoffs(pPointB,0,200,500),v1500,z100,tGripper\WObj:=WobBox;ENDPROCENDMODULEABB机器人编程02程序解析:1、此程序编写的思路是完全按照比赛题目中的要求的进行,就是按步就班式的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,-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]];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],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];PROCmain()在主程序里,过于臃肿,将具体功能尽量细分到例行程序TPErase;MoveJPHOME,v1000,z50,tool0;OpenGripper;WaitTime5;WHILEtrueDOIFPLC=1THENTPErase;TPWriteWarning!Begintomovethenewstaff...;WaitTime1;ClkResetclock1;ClkStartclock1;MovFromAtoB;ClkStopclock1;reg1:=ClkRead(clock1);TPErase;TPWriteGoodshandlinginplace,ittake(timeinsecond):\Num:=reg1;运行时间的显示WaitTime5;ELSETPErase;TPWriteWaitingfornewgoods...;运行状态的提醒WaitDIPLC,1;ENDIFENDWHILEENDPROCPROCOpenGripper()将对夹具的控制做在一个例行程序里,方便管理SetG0;ResetG1;ENDPROCPROCCloseGripper()将对夹具的控制做在一个例行程序里,方便管理SetG1;ResetG0;ENDPROCPROCMovFromAtoB()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,fine,tool0;WaitTime1;OpenGripper;WaitTime1;MoveLP40,v50,z50,tool0;MoveJP30,v1000,z50,tool0;MoveJPHOME,v1000,z50,tool0;ENDPROCENDMODULEABB机器人编程03程序解析:1、此程序是典型的ABB机器人官方编程思路与方法,分为主程序,初始化例行程序和轨迹程序。2、思路清晰,结构编排明确,方便使用者阅读。3、但有点要注意的初始化例行程序只在开始时,执行一次,正常运行时,不再执行。但此程序是每个循环都会进行一次初始化,是有点问题的。PROCmain()InitAll;此初始化程序应与循环执行的程序隔离开,使用WHILE指令Circle;WaitTime0.5;ENDPROCPROCInitAll()ResetDo_fixOn;WaitDI\OnConfJ\On;ConfL\On;VelSet80,1000;AccSet70,70;MoveJPHome,v150,fine,Tool0\WObj:=Wobj2;RETURN;ENDPROCPROCCircle()MoveJHome,v60,z0,Tool0\WObj:=Wobj2;waitDI;work;resetwaitDIMoveJHome,v150,fine,Tool0\WObj:=Wobj2;ENDPROCPROCfixopen()SetDo_fixopen;ENDPROCPROCfixclose()ResetDo_fixclose;ENDPROCPROCWork()MOVEJA0v150,z10,Tool0\WObj:=Wobj2;fixopen;waittime2;MOVELA1v30,fine,Tool0\WObj:=Wobj2;fixclose;waittime2;MOVEJB0v150,z10,Tool0\WObj:=Wobj2;MOVEjB1v30,fine,Tool0\WObj:=Wobj2;fixopen;waittime2;MoveJPHome,v150,fine,Tool0\WObj:=Wobj2;ENDPROCABB机器人编程04程序解析:1、此程序是典型的ABB机器人官方编程思路与方法。2、思路清晰,结构编排明确,方便使用者阅读。3、此程序有一个亮点,就是有一个回等待点的例行程序rMoveHome,这个好处在于可以在手动状态下,就能方便的回到机器人的等待位置。4、有足够的写屏信息,很好地提示运行状态。PROCMain()rInitial;rMoveHome;WhileTrueDoVelset100,3000;AccSet70,70;rpickworkpiece;rplaceworkpiece;endwhileprocrpickworkpiece;ifworkpiece=falseMoveJpickup,v2000,z5,too10;A:TPErase;IFDI10_pickup=1THEN(pickup为PLC发来拾取信号)WaitTime0;ELSEIFDI10_pickup=0THENTPWritePLC-pickupsignalnoready.;GOTOA;ENDIFMoveJOffs(pickup,0,0,300),v500,z200,too10;SetDoDO10_pickup1,1;waittime1;workpiece=tureendifendprocprocrplaceworkpiece;ifworkpiece=tureMoveJplacemiddle,v2000,z5,too10;MoveJplaceworkpiece,v2000,z5,too10;MoveJOffs(placeworkpiece,0,0,300),v500,z200,too10;SetDoDO10_pickup1,0;A:TPErase;IFDI10_pickon=1THEN(pickon为PLC检测已放好信号)WaitTime0;ELSEIF