程序样板%%%VERSION:1LANGUAGE:ENGLISH%%%MODULEmainprg程序模块名“存放数据”CONSTrobtargetpHome:=[[517.87,-0.01,708.53],[0.506292,-0.4935,0.509881,-0.490049],[-1,0,-1,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];PROCmain()主程序!*************************************!Mainprogramfor!*************************************Initall;调用Initall子程序WHILETRUEDO程序循环执行IFDI_StartBotton1=1THEN如果DI_StartBotton1=1则执行rP1子程序rP1;ELSEIFDI_StartBotton2=1THEN如果DI_StartBotton2=1则执行rP2子程序rP2;ENDIFWaitTime0.3;时间等待指令ENDWHILEENDPROCPROCInitall()子程序,用于初始化所有数据和状态AccSet100,100;加速度设定指令VelSet100,2000;速度设定指令rCheckHOMEPos;调用rCheckHOMEPos子程序ENDPROCPROCrCheckHOMEPos()子程序,用于判断机器人是否在等待位置IFNOTCurrentPos(pHome,tool0)THENTPErase;TPWriteRobotisnotintheWait-Position;TPWritePleasejogtherobotaroundtheWaitpositioninmanual;TPWriteAndexecutetheaHomeroutine.;WaitTime0.5;EXIT;ENDIFENDPROCFUNCboolCurrentPos(robtargetComparePos,INOUTtooldataTCP)功能,用于检测机器人是否在某个位置上VARnumCounter:=0;数据,只用于本功能的局部变量VARrobtargetActualPos;!!---------------------------------------------------------------------------------!Abstract:Functiontocomparecurrentmanipulatorpositionwithagivenposition!---------------------------------------------------------------------------------!ActualPos:=CRobT(\Tool:=tool0\WObj:=wobj0);IFActualPos.trans.xComparePos.trans.x-25ANDActualPos.trans.xIFActualPos.trans.yComparePos.trans.y-25ANDActualPos.trans.yIFActualPos.trans.zComparePos.trans.z-25ANDActualPos.trans.zIFActualPos.rot.q1ComparePos.rot.q1-0.1ANDActualPos.rot.q1IFActualPos.rot.q2ComparePos.rot.q2-0.1ANDActualPos.rot.q2IFActualPos.rot.q3ComparePos.rot.q3-0.1ANDActualPos.rot.q3IFActualPos.rot.q4ComparePos.rot.q4-0.1ANDActualPos.rot.q4RETURNCounter=7;ENDFUNCPROCaHome()子程序,机器人回等待位置用MoveJpHome,v30,fine,tool0;ENDPROCPROCrP1()子程序,存放工作轨迹指令!InsertthemovingroutinetohereENDPROCPROCrP2()子程序,存放工作轨迹指令!InsertthemovingroutinetohereENDPROCENDMODULE