ABB机器人:单或双传送链的教程和实例程序
MainModule!主模块
TASK PERS tooldata tool:=[TRUE,[[99.70, 170.37 ,1216.55],[1,0,0,0]],[1,[0,1,1],[1,0,0,0],0,0,0]];!工具数据是可变量,true表示是否安装在机器人上,下面三个参数表示xyz的方向,在后面的数据表示位置,质量,重心负载等等
PERS loaddata LoadEmpty:=[0.01,[0,0,1],[1,0,0,0],0,0,0];
负载数据
PERS loaddata LoadFull:=[40,[0,0,50],[1,0,0,0],0,0,0];
PERS robtarget pPick1:=[[733.54,336.34,-302.61],[1.77512E-06,-7.45058E-09,-1,3.53584E-07],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
机器人**个拾取点的位置,须使用线性移动将机器人移动到想要的位置,然后选择示教器定点
PERS robtarget pPlace:=[[248.31,-641.89,-734.02],[3.03194E-07,5.96046E-08,-1,-1.78442E06],[-1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
CONST robtarget pBase1_0:=[[38.31,-641.89,-824.02],[3.03194E-07,5.96046E-08,-1,-1.78442E-06],[-1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
PERS robtarget pBase1_90:=[[38.31,-641.89,-824.02],[3.03194E-07,5.96046E-08,-1,-1.78442E-06],[-1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
PERS speeddata MinSpeed:=[1000,3000,5000,1000];
PERS speeddata MidSpeed:=[2500,500,5000,1000];
PERS speeddata MaxSpeed:=[5000,5000,5000,1000];
PERS bool bPalletFull1:=FALSE;
PERS num nCount1:=6;
CONST robtarget phome:=[[738.42,340.74,-142.25],[1.77372E-06,8.41591E-18,-1,3.60555E-07],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
PERS robtarget pPick2:=[[758.60,993.00,-302.61],[1.30672E-06,2.63893E-18,-1,1.25242E-06],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
!主程序
PROC Main()
rInitAll;
Set doStartCNV ;
Set doStartCNV2 ;
WHILE TRUE DO
IF diboxinpox=1 AND bPalletFull1=FALSE THEN
rPick1;
rPlace1;
rPick2;
rPlace1;
ENDIF
WaitTime 0.1;
ENDWHILE
ENDPROC
!初始化程序
PROC rInitAll()
Reset doStartCNV ;
Reset doStartCNV2 ;
MoveJ pHome,MaxSpeed,fine,tool;
bPalletFull1:=FALSE;
nCount1:=1;
ENDPROC
!拾取位置1:将机器人移动到拾取位置的上方
PROC rPick1()
MoveJ Offs(pPick1,0,0,50),MaxSpeed,z50,tool;
MoveL pPick1,MaxSpeed,fine,tool;
Set doGrip;
WaitTime 0.3;
GripLoad LoadFull;
MoveL Offs(pPick1,0,0,50),MinSpeed,z50,tool;
ENDPROC
!拾取位置2:将机器人移动到拾取位置的上方
PROC rPick2()
MoveJ Offs(pPick2,0,0,50),MaxSpeed,z50,tool;
MoveL pPick2,MaxSpeed,fine,tool;
Set doGrip;
WaitTime 0.3;
GripLoad LoadFull;
MoveL Offs(pPick2,0,0,50),MinSpeed,z50,tool;
ENDPROC
!放置函数
PROC rPlace1()
rPosition1;
MoveJ Offs(pPlace,0,0,50),MaxSpeed,z50,tool\WObj:=wobj0;
MoveL pPlace,MaxSpeed,fine,tool\WObj:=wobj0;
Reset doGrip;
WaitTime 0.3;
GripLoad LoadEmpty;
MoveL Offs(pPlace,0,0,50),MidSpeed,z50,tool\WObj:=wobj0;
MoveJ Offs(pPick1,0,0,50),MaxSpeed,z50,tool\WObj:=wobj0;
nCount1:=nCount1+1;
IF nCount1>15 THEN
bPalletFull1:=TRUE;
ENDIF
ENDPROC
!放置的位置,根据基准放置点的偏移量,进行放置
PROC rPosition1()
TEST nCount1
CASE 1:pPlace:=Offs(pBase1_0,0,0,0);
CASE 2:pPlace:=Offs(pBase1_0,200+10,0,0);
CASE 3:pPlace:=Offs(pBase1_0,400+10,0,0);
CASE 4:pPlace:=Offs(pBase1_0,0,0,90);
CASE 5:pPlace:=Offs(pBase1_0,200+10,0,90);
CASE 6:pPlace:=Offs(pBase1_0,400+10,0,90);
CASE 7:pPlace:=Offs(pBase1_0,0,0,170);
CASE 8:pPlace:=Offs(pBase1_0,200+10,0,170);
CASE 9:pPlace:=Offs(pBase1_0,400+10,0,170);
CASE 10:pPlace:=Offs(pBase1_0,0,0,250);
CASE 11:pPlace:=Offs(pBase1_0,200+10,0,250);
CASE 12:pPlace:=Offs(pBase1_0,400+10,0,250);
CASE 13:pPlace:=Offs(pBase1_0,0,0,340);
CASE 14:pPlace:=Offs(pBase1_0,200+10,0,340);
CASE 15:pPlace:=Offs(pBase1_0,400+10,0,340);
DEFAULT:
TPErase;
TPWrite "the Counter of line 1 is error,please check it!";
Stop;
ENDTEST
ENDPROC
!修正模块
PROC rModify()
MoveJ pHome,MinSpeed,fine,tool\WObj:=wobj0;
MoveJ pPick1,MinSpeed,fine,tool\WObj:=wobj0;
MoveJ pBase1_0,MinSpeed,fine,tool\WObj:=wobj0;
MoveJ pBase1_90,MinSpeed,fine,tool\WObj:=wobj0;
ENDPROC
ENDMODULE
PROC Main()
rInitAll;
Set doStartCNV ;
Set doStartCNV2 ;
WHILE TRUE DO
IF diboxinpox=1 AND bPalletFull1=FALSE THEN
rPick1;
rPlace1;
rPick2;
rPlace1;
ENDIF
WaitTime 0.1;
ENDWHILE
ENDPROC
!初始化程序
PROC rInitAll()
Reset doStartCNV ;
Reset doStartCNV2 ;
MoveJ pHome,MaxSpeed,fine,tool;
bPalletFull1:=FALSE;
nCount1:=1;
ENDPROC
!拾取位置1:将机器人移动到拾取位置的上方
PROC rPick1()
MoveJ Offs(pPick1,0,0,50),MaxSpeed,z50,tool;
MoveL pPick1,MaxSpeed,fine,tool;
Set doGrip;
WaitTime 0.3;
GripLoad LoadFull;
MoveL Offs(pPick1,0,0,50),MinSpeed,z50,tool;
ENDPROC
!拾取位置2:将机器人移动到拾取位置的上方
PROC rPick2()
MoveJ Offs(pPick2,0,0,50),MaxSpeed,z50,tool;
MoveL pPick2,MaxSpeed,fine,tool;
Set doGrip;
WaitTime 0.3;
GripLoad LoadFull;
MoveL Offs(pPick2,0,0,50),MinSpeed,z50,tool;
ENDPROC
!放置函数
PROC rPlace1()
rPosition1;
MoveJ Offs(pPlace,0,0,50),MaxSpeed,z50,tool\WObj:=wobj0;
MoveL pPlace,MaxSpeed,fine,tool\WObj:=wobj0;
Reset doGrip;
WaitTime 0.3;
GripLoad LoadEmpty;
MoveL Offs(pPlace,0,0,50),MidSpeed,z50,tool\WObj:=wobj0;
MoveJ Offs(pPick1,0,0,50),MaxSpeed,z50,tool\WObj:=wobj0;
nCount1:=nCount1+1;
IF nCount1>15 THEN
bPalletFull1:=TRUE;
ENDIF
ENDPROC
!放置的位置,根据基准放置点的偏移量,进行放置
PROC rPosition1()
TEST nCount1
CASE 1:pPlace:=Offs(pBase1_0,0,0,0);
CASE 2:pPlace:=Offs(pBase1_0,200+10,0,0);
CASE 3:pPlace:=Offs(pBase1_0,400+10,0,0);
CASE 4:pPlace:=Offs(pBase1_0,0,0,90);
CASE 5:pPlace:=Offs(pBase1_0,200+10,0,90);
CASE 6:pPlace:=Offs(pBase1_0,400+10,0,90);
CASE 7:pPlace:=Offs(pBase1_0,0,0,170);
CASE 8:pPlace:=Offs(pBase1_0,200+10,0,170);
CASE 9:pPlace:=Offs(pBase1_0,400+10,0,170);
CASE 10:pPlace:=Offs(pBase1_0,0,0,250);
CASE 11:pPlace:=Offs(pBase1_0,200+10,0,250);
CASE 12:pPlace:=Offs(pBase1_0,400+10,0,250);
CASE 13:pPlace:=Offs(pBase1_0,0,0,340);
CASE 14:pPlace:=Offs(pBase1_0,200+10,0,340);
CASE 15:pPlace:=Offs(pBase1_0,400+10,0,340);
DEFAULT:
TPErase;
TPWrite "the Counter of line 1 is error,please check it!";
Stop;
ENDTEST
ENDPROC
!修正模块
PROC rModify()
MoveJ pHome,MinSpeed,fine,tool\WObj:=wobj0;
MoveJ pPick1,MinSpeed,fine,tool\WObj:=wobj0;
MoveJ pBase1_0,MinSpeed,fine,tool\WObj:=wobj0;
MoveJ pBase1_90,MinSpeed,fine,tool\WObj:=wobj0;
ENDPROC
ENDMODULE
注:务必使用虚拟示教器来确定需要定义的点,否则的话很容易出现错误。
更多信息请咨询:ABB机器人
- 下一篇:ABB机器人紧急停止、自动停止等详情
- 上一篇:ABB机器人程序指令解读