网上有很多关于pos机器人,ABB机器人码垛程序详解的机B机知识,也有很多人为大家解答关于pos机器人的器人器人问题,今天乐刷官方代理商(www.zypos.cn)为大家整理了关于这方面的码垛知识,让我们一起来看下吧!
1、程序pos机器人
项目要求产生这样的详解效果:产品在输送链末端,随着输送链的机B机运动而运动,并且当产品运动到输送链末端时自动停止。器人器人此时机器人通过安装在法兰盘末端的码垛夹具夹取产品,放置在垛盘上。程序然后机器人回到初始位置等待下一个产品的详解到来,继续进行抓取放置在垛盘上。机B机
程序解析如下:
MODULE MainMoudle
程序模块
PERS wobjdata WobjPallet_L:=[FALSE,TRUE,"",[[-456.216,-2058.49,-233.373],[1,0,0,0]],[[0,0,0],[1,0,0,0]]];
定义左码盘工件坐标系
PERS wobjdata WobjPallet_R:=[FALSE,TRUE,"",[[-421.764,1102.39,-233.373],[1,0,0,0]],[[0,0,0],[1,0,0,0]]];
定义右码盘工件坐标系
PERS tooldata tGripper:=[TRUE,[[0,0,527],[1,0,0,0]],[1,[0,0,100],[1,0,0,0],0,0,0]];
定义工具坐标系数据
PERS loaddata LoadFull:=[20,[0,0,300],[1,0,0,0],0,0,0.1];
定义载荷数据
PERS wobjdata CurWobj;
定义工具坐标系数据
PERS jointtarget jposHome:=[[0,0,0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
定义关节点数据,器人器人各关节轴数据为零,码垛用于手动将机器人运动到各关节机械零位
CONST robtarget pPlaceBase0_L:=[[296.473529255,212.21064316,3.210904169],[0,0.70711295,-0.707100612,0],[-2,0,-3,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
左码盘,不旋转放置基准位置
CONST robtarget pPlaceBase90_L:=[[218.407102669,695.953395421,3.210997808],[0,-0.000001669,1,0],[-2,0,-2,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
左码盘,旋转90°放置基准位置
CONST robtarget pPlaceBase0_R:=[[296.473529255,212.21064316,3.210904169],[0,0.707221603,-0.70699194,0],[1,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
右码盘,不旋转放置基准位置
CONST robtarget pPlaceBase90_R:=[[218.407102669,695.953395421,3.210997808],[0,-0.00038594,0.999999926,0],[1,0,1,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
右码盘,旋转90°放置基准位置
CONST robtarget pPick_L:=[[1627.550991372,-426.974661352,-26.736921885],[0,0.707109873,-0.707103689,0],[-1,0,-2,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
左码盘,程序抓取位置
CONST robtarget pPick_R:=[[1611.055992534,442.364097921,-26.736584068],[0,0.707220363,-0.706993181,0],[0,0,-1,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
右码盘,详解抓取位置
CONST robtarget pHome:=[[1505.00,-0.00,878.55],[1.28548E-06,0.707107,-0.707107,-1.26441E-06],[0,0,-2,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
程序起点
PERS robtarget pPlaceBase0;
PERS robtarget pPlaceBase90;
PERS robtarget pPick;
PERS robtarget pPlace;
定义目标点数据,机器人当前使用的目标点
PERS robtarget pPickSafe;安全高度
PERS num nCycleTime:=3.332; 定义数字型数据,用于存储单次节拍的时间
PERS num nCount_L:=1;左码盘,定义数字型数据,用于计数
PERS num nCount_R:=1;右码盘,定义数字型数据,用于计数
PERS num nPallet:=1;定义数字型数据,利用TEST指令判断,当其为1,进行码垛
PERS num nPalletNo:=2;定义数字型数据,利用TEST指令判断,当其为2,进行码垛
PERS num nPickH:=300;定义数字型数据,抓取时的安全高度
PERS num nPlaceH:=400;定义数字型数据,放置时的安全高度
PERS num nBoxL:=605;定义数字型数据,产品的长
PERS num nBoxW:=405;定义数字型数据,产品的宽
PERS num nBoxH:=300;定义数字型数据,产品的高
VAR clock Timer1;定义时钟型数据,用于计时
PERS bool bReady:=FALSE;定义布尔型数据,判断是否满足码垛条件
PERS bool bPalletFull_L:=FALSE;定义布尔型数据,判断左码盘是否已满
PERS bool bPalletFull_R:=TRUE;定义布尔型数据,判断右码盘是否已满
PERS bool bGetPosition:=TRUE;定义布尔型数据,判断是否已计算出当前的取放位置
VAR triggdata HookAct;定义触发数据,夹具上钩爪的夹紧动作
VAR triggdata HookOff;定义触发数据,夹具上钩爪的松开动作
VAR intnum iPallet_L;定义中断型符,左码垛,复位操作
VAR intnum iPallet_R;定义数字型数据,右码垛,复位操作
PERS speeddata vMinEmpty:=[2000,400,6000,1000];
PERS speeddata vMidEmpty:=[3000,400,6000,1000];
PERS speeddata vMaxEmpty:=[5000,500,6000,1000];
PERS speeddata vMinLoad:=[1000,200,6000,1000];
PERS speeddata vMidLoad:=[2500,500,6000,1000];
PERS speeddata vMaxLoad:=[4000,500,6000,1000];
定义多种速度数据,分别对应空载时的高、中、低速和满载时的高、中、低速,便于对各个动作进行速度控制
PERS num Compensation{15,3}:=[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]];
定义,二维数组,用于各摆放位置的偏差调整;15组数据,对应15个摆放位置,每组数据3个数值,对应xyz的偏差值
PROC main()
主程序
rInitAll;
调用初始化子程序、包括复位、复位程序数据、初始化中断
WHILE TRUE DO
IF bReady THEN
rPick;
调用抓取程序
rPlace;
调用放置程序
ENDIF
rCycleCheck;
调用循环检测程序
ENDWHILE
ENDPROC
PROC rInitAll()
初始化程序
rCheckHomePos;
ConfL\\OFF;
ConfJ\\OFF;
nCount_R:=1;
nPallet:=1;
nPalletNo:=1;
bPalletFull_R:=FALSE;
bGetPosition:=FALSE;
Reset do00_ClampAct;
Reset do01_HookAct;
ClkStop Timer1;
ClkReset Timer1;
TriggEquip HookAct,100,0.1\\DOp:=do01_HookAct,1;
TriggEquip HookOff,100\\Start,0.1\\DOp:=do01_HookAct,0;
IDelete iPallet_R;
CONNECT iPallet_R WITH tEjectPallet_R;
ISignalDI di03_PalletInPos_R,0,iPallet_R;
ENDPROC
PROC rPick()
抓取程序
ClkReset Timer1;
ClkStart Timer1;
rCalPosition;
MoveJ Offs(pPick,0,0,nPickH),vMaxEmpty,z50,tGripper\\WObj:=wobj0;
MoveL pPick,vMinLoad,fine,tGripper\\WObj:=wobj0;
Set do00_ClampAct;
Waittime 0.3;
GripLoad LoadFull;
TriggL Offs(pPick,0,0,nPickH),vMinLoad,HookAct,z50,tGripper\\WObj:=wobj0;
MoveL pPickSafe,vMaxLoad,z100,tGripper\\WObj:=wobj0;
ENDPROC
PROC rPlace()
放置程序
MoveJ Offs(pPlace,0,0,nPlaceH),vMaxLoad,z50,tGripper\\WObj:=CurWobj;
TriggL pPlace,vMinLoad,HookOff,fine,tGripper\\WObj:=CurWobj;
Reset do00_ClampAct;
Waittime 0.3;
GripLoad Load0;
MoveL Offs(pPlace,0,0,nPlaceH),vMinEmpty,z50,tGripper\\WObj:=CurWobj;
rPlaceRD;
MoveJ pPickSafe,vMaxEmpty,z50,tGripper\\WObj:=wobj0;
ClkStop Timer1;
nCycleTime:=ClkRead(Timer1);
ENDPROC
PROC rCycleCheck()
周期循环检查
TPErase;
TPWrite "The Robot is running!";
TPWrite "Last cycle time is : "\\Num:=nCycleTime;
TPWrite "The number of the Boxes in the Right pallet is:"\\Num:=nCount_R-1;
IF (bPalletFull_R=FALSE AND di03_PalletInPos_R=1 AND di01_BoxInPos_R=1) THEN
bReady:=TRUE;
ELSE
bReady:=FALSE;
WaitTime 0.1;
ENDIF
ENDPROC
PROC rCalPosition()
计算位置程序
bGetPosition:=FALSE;
WHILE bGetPosition=FALSE DO
IF bPalletFull_R=FALSE AND di03_PalletInPos_R=1 AND di01_BoxInPos_R=1 THEN
pPick:=pPick_R;
pPlaceBase0:=pPlaceBase0_R;
pPlaceBase90:=pPlaceBase90_R;
CurWobj:=WobjPallet_R;
pPlace:=pPattern(nCount_R);
bGetPosition:=TRUE;
nPalletNo:=2;
ELSE
bGetPosition:=FALSE;
ENDIF
ULT:
TPERASE;
TPWRITE "The data \'nPallet\' is error,please check it!";
ENDWHILE
ENDPROC
FUNC robtarget pPattern(num nCount)
计算摆放位置功能程序,此程序为带参数的例行程序
VAR robtarget pTarget;
IF nCount>=1 AND nCount<=5 THEN
ELSEIF nCount>=6 AND nCount<=10 THEN
pPickSafe:=Offs(pPick,0,0,600);
ELSEIF nCount>=11 AND nCount<=15 THEN
pPickSafe:=Offs(pPick,0,0,800);
ENDIF
TEST nCount
CASE 1:
pTarget.trans.x:=pPlaceBase0.trans.x;
pTarget.trans.y:=pPlaceBase0.trans.y;
pTarget.trans.z:=pPlaceBase0.trans.z;
pTarget.rot:=pPlaceBase0.rot;
pTarget.robconf:=pPlaceBase0.robconf;
pTarget:=Offs(pTarget,Compensation{nCount,1},Compensation{nCount,2},Compensation{nCount,3});
CASE 2:
pTarget.trans.x:=pPlaceBase0.trans.x+nBoxL;
pTarget.trans.y:=pPlaceBase0.trans.y;
pTarget.trans.z:=pPlaceBase0.trans.z;
pTarget.rot:=pPlaceBase0.rot;
pTarget.robconf:=pPlaceBase0.robconf;
pTarget:=Offs(pTarget,Compensation{nCount,1},Compensation{nCount,2},Compensation{nCount,3});
CASE 3:
pTarget.trans.x:=pPlaceBase90.trans.x;
pTarget.trans.y:=pPlaceBase90.trans.y;
pTarget.trans.z:=pPlaceBase90.trans.z;
pTarget.rot:=pPlaceBase90.rot;
pTarget.robconf:=pPlaceBase90.robconf;
pTarget:=Offs(pTarget,Compensation{nCount,1},Compensation{nCount,2},Compensation{nCount,3});
CASE 4:
pTarget.trans.x:=pPlaceBase90.trans.x+nBoxW;
pTarget.trans.y:=pPlaceBase90.trans.y;
pTarget.trans.z:=pPlaceBase90.trans.z;
pTarget.rot:=pPlaceBase90.rot;
pTarget.robconf:=pPlaceBase90.robconf;
pTarget:=Offs(pTarget,Compensation{nCount,1},Compensation{nCount,2},Compensation{nCount,3});
CASE 5:
pTarget.trans.x:=pPlaceBase90.trans.x+2*nBoxW;
pTarget.trans.y:=pPlaceBase90.trans.y;
pTarget.trans.z:=pPlaceBase90.trans.z;
pTarget.rot:=pPlaceBase90.rot;
pTarget.robconf:=pPlaceBase90.robconf;
pTarget:=Offs(pTarget,Compensation{nCount,1},Compensation{nCount,2},Compensation{nCount,3});
CASE 6:
pTarget.trans.x:=pPlaceBase0.trans.x;
pTarget.trans.y:=pPlaceBase0.trans.y+nBoxL;
pTarget.trans.z:=pPlaceBase0.trans.z+nBoxH;
pTarget.rot:=pPlaceBase0.rot;
pTarget.robconf:=pPlaceBase0.robconf;
pTarget:=Offs(pTarget,Compensation{nCount,1},Compensation{nCount,2},Compensation{nCount,3});
CASE 7:
pTarget.trans.x:=pPlaceBase0.trans.x+nBoxL;
pTarget.trans.y:=pPlaceBase0.trans.y+nBoxL;
pTarget.trans.z:=pPlaceBase0.trans.z+nBoxH;
pTarget.rot:=pPlaceBase0.rot;
pTarget.robconf:=pPlaceBase0.robconf;
pTarget:=Offs(pTarget,Compensation{nCount,1},Compensation{nCount,2},Compensation{nCount,3});
CASE 8:
pTarget.trans.x:=pPlaceBase90.trans.x;
pTarget.trans.y:=pPlaceBase90.trans.y-nBoxW;
pTarget.trans.z:=pPlaceBase90.trans.z+nBoxH;
pTarget.rot:=pPlaceBase90.rot;
pTarget.robconf:=pPlaceBase90.robconf;
pTarget:=Offs(pTarget,Compensation{nCount,1},Compensation{nCount,2},Compensation{nCount,3});
CASE 9:
pTarget.trans.x:=pPlaceBase90.trans.x+nBoxW;
pTarget.trans.y:=pPlaceBase90.trans.y-nBoxW;
pTarget.trans.z:=pPlaceBase90.trans.z+nBoxH;
pTarget.rot:=pPlaceBase90.rot;
pTarget.robconf:=pPlaceBase90.robconf;
pTarget:=Offs(pTarget,Compensation{nCount,1},Compensation{nCount,2},Compensation{nCount,3});
CASE 10:
pTarget.trans.x:=pPlaceBase90.trans.x+2*nBoxW;
pTarget.trans.y:=pPlaceBase90.trans.y-nBoxW;
pTarget.trans.z:=pPlaceBase90.trans.z+nBoxH;
pTarget.rot:=pPlaceBase90.rot;
pTarget.robconf:=pPlaceBase90.robconf;
pTarget:=Offs(pTarget,Compensation{nCount,1},Compensation{nCount,2},Compensation{nCount,3});
CASE 11:
pTarget.trans.x:=pPlaceBase0.trans.x;
pTarget.trans.y:=pPlaceBase0.trans.y;
pTarget.trans.z:=pPlaceBase0.trans.z+2*nBoxH;
pTarget.rot:=pPlaceBase0.rot;
pTarget.robconf:=pPlaceBase0.robconf;
pTarget:=Offs(pTarget,Compensation{nCount,1},Compensation{nCount,2},Compensation{nCount,3});
CASE 12:
pTarget.trans.x:=pPlaceBase0.trans.x+nBoxL;
pTarget.trans.y:=pPlaceBase0.trans.y;
pTarget.trans.z:=pPlaceBase0.trans.z+2*nBoxH;
pTarget.rot:=pPlaceBase0.rot;
pTarget.robconf:=pPlaceBase0.robconf;
pTarget:=Offs(pTarget,Compensation{nCount,1},Compensation{nCount,2},Compensation{nCount,3});
CASE 13:
pTarget.trans.x:=pPlaceBase90.trans.x;
pTarget.trans.y:=pPlaceBase90.trans.y;
pTarget.trans.z:=pPlaceBase90.trans.z+2*nBoxH;
pTarget.rot:=pPlaceBase90.rot;
pTarget.robconf:=pPlaceBase90.robconf;
pTarget:=Offs(pTarget,Compensation{nCount,1},Compensation{nCount,2},Compensation{nCount,3});
CASE 14:
pTarget.trans.x:=pPlaceBase90.trans.x+nBoxW;
pTarget.trans.y:=pPlaceBase90.trans.y;
pTarget.trans.z:=pPlaceBase90.trans.z+2*nBoxH;
pTarget.rot:=pPlaceBase90.rot;
pTarget.robconf:=pPlaceBase90.robconf;
pTarget:=Offs(pTarget,Compensation{nCount,1},Compensation{nCount,2},Compensation{nCount,3});
CASE 15:
pTarget.trans.x:=pPlaceBase90.trans.x+2*nBoxW;
pTarget.trans.y:=pPlaceBase90.trans.y;
pTarget.trans.z:=pPlaceBase90.trans.z+2*nBoxH;
pTarget.rot:=pPlaceBase90.rot;
pTarget.robconf:=pPlaceBase90.robconf;
pTarget:=Offs(pTarget,Compensation{nCount,1},Compensation{nCount,2},Compensation{nCount,3});
DEFAULT:
TPErase;
TPWrite "The data \'nCount\' is error,please check it !";
stop;
ENDTEST
Return pTarget;
ENDFUNC
PROC rPlaceRD()
码垛产品计数程序
TEST nPalletNo
CASE 1:
Incr nCount_L;
IF nCount_L>15 THEN
Set do02_PalletFull_L;
bPalletFull_L:=TRUE;
nCount_L:=1;
ENDIF
CASE 2:
Incr nCount_R;
IF nCount_R>15 THEN
Set do03_PalletFull_R;
bPalletFull_R:=TRUE;
nCount_R:=1;
ENDIF
DEFAULT:
TPERASE;
TPWRITE "The data \'nPalletNo\' is error,please check it!";
Stop;
ENDTEST
ENDPROC
PROC rCheckHomePos()
检测机器人是否在Home
VAR robtarget pActualPos;
IF NOT CurrentPos(pHome,tGripper) THEN
pActualpos:=CRobT(\\Tool:=tGripper\\WObj:=wobj0);
pActualpos.trans.z:=pHome.trans.z;
MoveL pActualpos,v500,z10,tGripper;
MoveJ pHome,v1000,fine,tGripper;
ENDIF
ENDPROC
FUNC bool CurrentPos(robtarget ComparePos,INOUT tooldata TCP)
比较机器人的位置是否在给定目标点的偏差范围内
VAR num Counter:=0;
VAR robtarget ActualPos;
ActualPos:=CRobT(\\Tool:=TCP\\WObj:=wobj0);
IF ActualPos.trans.x>ComparePos.trans.x-25 AND ActualPos.trans.x<ComparePos.trans.x+25 Counter:=Counter+1;
IF ActualPos.trans.y>ComparePos.trans.y-25 AND ActualPos.trans.y<ComparePos.trans.y+25 Counter:=Counter+1;
IF ActualPos.trans.z>ComparePos.trans.z-25 AND ActualPos.trans.z<ComparePos.trans.z+25 Counter:=Counter+1;
IF ActualPos.rot.q1>ComparePos.rot.q1-0.1 AND ActualPos.rot.q1<ComparePos.rot.q1+0.1 Counter:=Counter+1;
IF ActualPos.rot.q2>ComparePos.rot.q2-0.1 AND ActualPos.rot.q2<ComparePos.rot.q2+0.1 Counter:=Counter+1;
IF ActualPos.rot.q3>ComparePos.rot.q3-0.1 AND ActualPos.rot.q3<ComparePos.rot.q3+0.1 Counter:=Counter+1;
IF ActualPos.rot.q4>ComparePos.rot.q4-0.1 AND ActualPos.rot.q4<ComparePos.rot.q4+0.1 Counter:=Counter+1;
RETURN Counter=7;
ENDFUNC
TRAP tEjectPallet_R
Reset do03_PalletFull_R;
bPalletFull_R:=FALSE;
ENDTRAP
PROC rMoveAbsj()
机器人回零。手动将机器人移动至各关节轴机械零点,在程序运行过程中不调用
MoveAbsJ jposHome\\NoEOffs, v100, fine, tGripper\\WObj:=wobj0;
ENDPROC
PROC rModPos()
MoveL pHome,v100,fine,tGripper\\WObj:=Wobj0;
MoveL pPick_L,v100,fine,tGripper\\WObj:=Wobj0;
MoveL pPick_R,v100,fine,tGripper\\WObj:=Wobj0;
MoveL pPlaceBase0_L,v100,fine,tGripper\\WObj:=WobjPallet_L;
MoveL pPlaceBase90_L,v100,fine,tGripper\\WObj:=WobjPallet_L;
MoveL pPlaceBase0_R,v100,fine,tGripper\\WObj:=WobjPallet_R;
MoveL pPlaceBase90_R,v100,fine,tGripper\\WObj:=WobjPallet_R;
ENDPROC
ENDMODULE
以上就是关于pos机器人,ABB机器人码垛程序详解的知识,后面我们会继续为大家整理关于pos机器人的知识,希望能够帮助到大家!
相关文章: