ABB机器人程序实例.docx
《ABB机器人程序实例.docx》由会员分享,可在线阅读,更多相关《ABB机器人程序实例.docx(8页珍藏版)》请在冰豆网上搜索。
![ABB机器人程序实例.docx](https://file1.bdocx.com/fileroot1/2023-1/30/d9274541-02cb-4619-bbb9-da6ad7657bc5/d9274541-02cb-4619-bbb9-da6ad7657bc51.gif)
ABB机器人程序实例
MODULEMainModule
CONSTrobtargetpHome:
=[[1525.42,272.18,1873.69],[4.42963E-05,0.699969,-0.714173,-2.80277E-05],[0,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONSTrobtargetpPrePickMould:
=[[1653.99,272.19,1779.41],[5.83312E-05,0.69997,-0.714172,-3.47922E-05],[0,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONSTrobtargetpPrePickClapboard:
=[[2036.17,-741.24,1235.05],[0.678651,0.73435,-0.0119011,0.00467586],[-1,-2,2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONSTrobtargetpPickMould:
=[[1943.13,173.08,630.89],[4.66987E-05,0.699977,-0.714166,-3.24109E-05],[0,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONSTrobtargetpPickClapboard:
=[[1943.19,173.08,620.72],[1.61422E-05,0.699977,-0.714165,-7.62858E-06],[0,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONSTrobtargetpPrePlace:
=[[785.90,-957.40,1722.38],[0.00231652,0.0492402,-0.998779,-0.00310842],[-1,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONSTrobtargetpPrePlace10:
=[[-277.40,-1202.57,1621.17],[0.00183571,-0.0139794,-0.999895,-0.00341408],[-2,-1,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONSTrobtargetpPrePlace20:
=[[-491.18,-1082.85,1505.90],[0.000663644,0.69408,0.719887,0.00386364],[-2,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONSTrobtargetpPlaceMould:
=[[-92.13,-2580.19,1171.45],[0.000771646,0.713144,0.701007,0.00383692],[-2,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONSTrobtargetpPlaceClapboard:
=[[1585.08,1761.04,787.33],[0.00645323,-0.00552996,-0.726358,-0.687263],[0,1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONSTrobtargetpPrePlaceClapboard:
=[[1017.30,955.85,1443.17],[1.0621E-05,-0.00849593,-0.999964,4.01139E-05],[0,-1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONSTrobtargetpPrePickClapboard10:
=[[2257.17,-841.03,1579.56],[0.667517,0.74457,-0.00360206,0.00487631],[-1,-1,2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONSTrobtargetpPrePickMould10:
=[[530.24,-1703.27,1762.63],[5.07659E-05,0.96161,0.274421,2.37287E-05],[-1,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONSTnumnOffs:
=100;
PERSnumnCurOffs:
=100;
CONSTnumnLayer:
=0;
PERSnumnCurLayer:
=0;
CONSTnumnThickness:
=40;
VARboolbTimeOut:
=FALSE;
PERSboolbDryCycle:
=FALSE;
VARintnumiDryCycle;
VARintnumiResDryCycle;
VARintnumiVacuum;
PERStooldatatGripper:
=[TRUE,[[0,0,100],[1,0,0,0]],[88.5,[-3.7,-1.4,132.1],[1,0,0,0],5.5,17.831,25.067]];
PROCmain()
rInitAll;
WHILETRUEDO
IFsiDryCycle=1ornCurLayer<1then
rPickClapboard;
ELSE
rPickMould;
ENDIF
Waittime0.2;
ENDWHILE
ENDPROC
PROCrPickMould()
DIWaitdiMouldready,1,3,"entranceConveyer","readyforpick";
DIWaitdiPlaceReady,1,3,"exitConveyer","readyforremove";
MoveJpPrePickMould,v1500,z50,tGripper;
IFBitCheck(nCurlayer,1)THEN
nCurOffs:
=nOffs;
ELSE
nCurOffs:
=-nOffs;
ENDIF
MoveLoffs(pPickMould,0,nCurOffs,100+nCurLayer*nThickness),v1000,z50,tGripper;
MoveLoffs(pPickMould,0,nCurOffs,(nCurLayer-1)*nThickness),v200,fine,tGripper;
GripClose;
DecrnCurLayer;
MoveLoffs(pPickMould,0,nCurOffs,100+nCurLayer*nThickness),v200,z50,tGripper;
MoveJpPrePickMould,v1000,z50,tGripper;
DIWaitdiPlaceReady,1,3,"exitConveyer","readyforremove";
MoveJpPrePlace10,v1500,z10,tGripper;
MoveLoffs(pPlaceMould,0,0,100),v1500,z10,tGripper;
MoveLpPlaceMould,v200,fine,tGripper;
GripOpen;
MoveLoffs(pPlaceMould,0,0,100),v200,z10,tGripper;
MoveLpPrePlace10,v1500,z10,tGripper;
MoveJpPrePickMould,v1500,z10,tGripper;
PulseDO\PLength:
=2,doMouldPlaceOK;
ENDPROC
PROCrPickClapboard()
DIWaitdiMouldready,1,3,"entranceConveyer","readyforpick";
MoveLoffs(pPickClapboard,0,0,100),v1000,z50,tGripper;
MoveLpPickClapboard,v200,fine,tGripper;
GripClose;
MoveLoffs(pPickClapboard,0,0,100),v200,z50,tGripper;
MoveLoffs(pPickClapboard,0,0,500),v1000,z50,tGripper;
MoveLpPrePlaceClapboard,v1000,z10,tGripper;
DIWaitdiClapboardReady,1,3,"exitConveyer","readyforremove";
MoveLoffs(pPlaceClapboard,-700,-200,250),v1000,z10,tGripper;
MoveLoffs(pPlaceClapboard,00,-10,100),v1000,z10,tGripper;
MoveLpPlaceClapboard,v100,fine,tGripper;
GripOpen;
MoveLoffs(pPlaceClapboard,0,-50,100),v1000,z10,tGripper;
MoveLoffs(pPlaceClapboard,-700,-200,250),v1000,z10,tGripper;
MoveLpPrePlaceClapboard,v1000,z10,tGripper;
PulseDO\PLength:
=1.0,doClapboardPickOK;
MoveJpHome,v1500,fine,tGripper;
PulseDO\PLength:
=1.0,doUnStackOk;
WaitTime2;
DIWaitdiMouldready,0,3,"exitConveyer","readyforremove";
nCurLayer:
=nLayer;
ENDPROC
PROCrInitAll()
IFdiVacuum1=0THEN
WaitTime1;
ELSE
ErrWrite"TheRob1grippererror!
","Thegripperisnotopened!
"\RL2:
="Checkthegrippersignalpostion."\RL3:
="openthegrippermanuallyandtakeawaythepartfromgripper.";
Stop;
Exit;
ENDIF
rMoveHome;
nCurLayer:
=nLayer;
IDeleteiVacuum;
CONNECTiVacuumWITHtLostPart;
ISignalDIdiVacuum1,1,iVacuum;
ISleepiVacuum;
ENDPROC
ROCGripClose()
SetDOdoVacuum,1;
SetDOdoBlow,0;
WaitUntildiVacuum1=1\MaxTime:
=10\TimeFlag:
=bTimeOut;
IFbTimeOutTHEN
ErrWrite"RobGripperSignalerror!
","FatalerrorinGripper"\RL2:
="Checkthegrippersignalpostion."\RL3:
="changeanewsensor.";
Stop;
ENDIF
Waittime0.5;
IWatchiVacuum;
ENDPROC
PROCGripOpen()
ISleepiVacuum;
SetDOdoVacuum,0;
PulseDO\PLength:
=2.0,doBlow;
WaitUntildiVacuum1=0\MaxTime:
=5\TimeFlag:
=bTimeOut;
IFbTimeOutTHEN
ErrWrite"RobGripperSignalerror!
","FatalerrorinGripper"\RL2:
="Checkthegrippersignalpostion."\RL3:
="changeanewsensor.";
Stop;
ENDIF
Waittime0.5;
ENDPROC
PROCrMoveHome()
VARstringHomeOffset;
CONSTnumMinX:
=-500;
CONSTnumMaxX:
=500;
CONSTnumMinY:
=-500;
CONSTnumMaxY:
=500;
CONSTnumMinZ:
=500;
CONSTnumMaxZ:
=1200;
VARrobtargetActualPos;
VelSet100,500;
AccSet70,70;
IFbCurrentPos(pHome,tGripper,50)=TRUETHEN
MoveJpHome,v500,fine,tGripper\WObj:
=wobj0;
ENDIF
IFbCurrentPos(pPrePickMould,tGripper,50\wobj:
=Wobj0)=TRUETHEN
MoveJpHome,v500,fine,tGripper\WObj:
=wobj0;
ENDIF
IFbCurrentPos(pPrePickClapboard,tGripper,100\wobj:
=Wobj0)=TRUETHEN
MoveJpHome,v500,fine,tGripper\WObj:
=wobj0;
ENDIF
IFbCurrentPos(pPreplace,tGripper,100\wobj:
=Wobj0)=TRUETHEN
MoveJpHome,v500,fine,tGripper\WObj:
=wobj0;
ENDIF
IFbCurrentPos(pHome,tGripper,100)=FALSETHEN
!
Ifnoknownpositionisfound,checkiftherobotisinaspecified
!
windowandmovehimtothefirstpositionintheprogram
ActualPos:
=CRobT(\Tool:
=tGripper\WObj:
=wobj0);
IFActualPos.trans.xMaxXORActualPos.trans.yMaxYORActualPos.trans.zMaxZTHEN
HomeOffset:
="";
IFActualPos.trans.xHomeOffset:
=HomeOffset+"X:
"+NumToStr(MinX-ActualPos.trans.x,0)+"";
ELSEIFActualPos.trans.x>MaxXTHEN
HomeOffset:
=HomeOffset+"X:
"+NumToStr(MaxX-ActualPos.trans.x,0)+"";
ELSE
HomeOffset:
=HomeOffset+"X:
OK";
ENDIF
IFActualPos.trans.yHomeOffset:
=HomeOffset+"Y:
"+NumToStr(MinY-ActualPos.trans.y,0)+"";
ELSEIFActualPos.trans.y>MaxYTHEN
HomeOffset:
=HomeOffset+"Y:
"+NumToStr(MaxY-ActualPos.trans.y,0)+"";
ELSE
HomeOffset:
=HomeOffset+"Y:
OK";
ENDIF
IFActualPos.trans.zHomeOffset:
=HomeOffset+"Z:
"+NumToStr(MinZ-ActualPos.trans.z,0)+"";
ELSEIFActualPos.trans.z>MaxZTHEN
HomeOffset:
=HomeOffset+"Z:
"+NumToStr(MaxZ-ActualPos.trans.z,0)+"";
ELSE
HomeOffset:
=HomeOffset+"Z:
OK";
ENDIF
ErrWriteHomeOffset,"Moverobotmanuallynearhomeposition";
WHILEOpMode()<>OP_MAN_PROGDO
TPErase;
TPWrite"PleaseswitchrobottoManualmode";
!
TPErase;
Stop;
ENDWHILE
Stop;
MoveJpHome,v500,fine,tGripper;
!
npallet:
=4;
ActualPos:
=CRobT(\Tool:
=tGripper\WObj:
=wobj0);
WHILEOpMode()<>OP_AUTODO
TPErase;
TPWrite"PleaseswitchrobottoAUTOmode";
!
TPErase;
Stop;
ENDWHILE
ENDIF
ENDIF
VelSet100,3000;
ENDPROC
TRAPtLostPart
ErrWrite"Partlost!
","FatalerrorinGripper"\RL2:
="Checkthegripper."\RL3:
="checkthevacuum.";
Stop;
ENDTRAP
ENDMODULE
-----精心整理,希望对您有所帮助!