KUKA机器人保养ABB安全区域和中断一起连用案例解析

MODULE XXXX

!定义临时全局区域数据

VAR wztemporary conveyor;

!定义全局区域形状数据

VAR shapedata volume;

!定义中断识别号

VAR intnum empty;

!定义全局区域形状设定数据位置点1和点2

pers pos corner1:=[363.41,41.87,317.67];

pers pos corner2:=[613.41,-258.13,567.67];

!定义计算位置示教点

VAR

robtarget AnQua:=[[363.41,41.87,317.67],[0.261461,0.63764,0.229939,0.687155],[0,0,1,1],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];

!定义左右移动位置点

TASK

VAR

robtarget Zuo_AnQuanDian:=[[444.89,-401.76,501.87],[0.0966565,0.923747,0.326119,0.176057],[-1,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];

TASK

VAR

robtarget You_AnQuanDian:=[[444.90,-164.34,501.86],[0.0966831,0.923746,0.32611,0.176061],[-1,0,1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];

!安全区域定义

PROC AnQuanQuYu_CheShi()

!计算安全区域大小

corner1.x:=AnQua.trans.x;

corner1.y:=AnQua.trans.y;

corner1.z:=AnQua.trans.z;

corner2.x:=AnQua.trans.x+250;

corner2.y:=AnQua.trans.y-300;

corner2.z:=AnQua.trans.z+250;

!定义一个箱形全局区域

WZBoxDef \Outside, volume, corner1, corner2;

!启用全局区域限制监控

!WZLimSup \Temp, conveyor, volume;

!启用全局区域,设置数字信号输出

WZDOSet \Temp, conveyor, \Before, volume, ZhongDuan1,1;

!停用临时全局区域监控

!WZDisable conveyor;

!重新启用临时全局区域监控

!WZEnable conveyor;

!擦除临时全局区域监控

!WZFree conveyor;

!调用中断例行程序

ZhongDuan;

 

!移动左示教点(在安全区外,会触发安全区)

Movej Zuo_AnQuanDian,v500,fine,tool0\WObj:=wobj0;

!Movej You_AnQuanDian,v500,fine,tool0\WObj:=wobj0;

!Movej Qian_AnQuanDian,v500,fine,tool0\WObj:=wobj0;

!Movej Hou_AnQuanDian,v500,fine,tool0\WObj:=wobj0;

ENDPROC

 

!中断例行程序

PROC ZhongDuan()

!将中断与软中断程序相连

CONNECT empty WITH QianHou_ZhongDuan;

!当中断识别号ZhongDuan1置为1时,自动执行软中断程序(QianHou_ZhongDuan)。

ISignalDO ZhongDuan1, 1, empty;

ENDPROC

!软中断程序

TRAP QianHou_ZhongDuan

!定义中断发生时的保存位置的程序点

VAR robtarget p1;

!停止机械臂的移动

StopMove;

! 发生中断时,存储路径

StorePath;

!读取中断发生的位置保存给p1

p1:=CRobT();

!中断发生后执行网右走程序

Movej Hou_AnQuanDian,v500,fine,tool0\WObj:=wobj0;

!中断结束后移动到发生中断时的位置

MoveL p1,v500,fine,tool0\WObj:=wobj0;

!中断之后,恢复路径(继续从中断点移动到Zuo_AnQuanDian示教点)

RestoPath;

!重启机械臂移动

StartMove;

!完成程序的执行

RETURN;

ENDTRAP

 

来源:广科智能 转载注明出处