KUKA程序写法案例分享
换抢盘抓抓手程序:
DEF Q1_PICKGRPPER( ) :程序名称
INI :系统初始化
PTP HOME Vel= 100 % DEFAULT :HOME原点
OUT 272 'Grip2_Bracket_Open' State=TRUE :输出272抓手2防尘盖打开信号为真
OUT 271 'Grip2_Bracket_Cls' State=FALSE :输出271抓手2防尘盖关闭信号为假
WAIT FOR ( IN 272 'Grip2_Bracket_Opened' ) :等待抓手2防尘盖打开到位输入信
号272
WAIT FOR ( NOT IN 263 'ATC_Face' ) :等待换抢盘面接触输入信号263为非
WAIT FOR ( IN 265 'Grip2_In_Place' ) :等待抓手2在位输入信号265
PTP P4 CONT Vel=100 % PDAT2 Tool[0] Base[0]
PTP P3 CONT Vel=50 % PDAT1 Tool[0] Base[0]
LIN P2 CONT Vel=0.2 m/s CPDAT2 Tool[0] Base[0]
LIN P1 Vel=0.1 m/s CPDAT1 Tool[0] Base[0]
WAIT FOR ( IN 263 'ATC_Face' ) :等待换抢盘面接触输入信号263
OUT 261 'ATC_LOCK' State=TRUE :输出换抢盘锁紧信号261为真
OUT 262 'ATC_UNLOCK' State=FALSE :输出换抢盘松开信号262为假
WAIT FOR ( IN 261 'ATC_Locked' ) :等待换抢盘锁紧到位输入信号261
RET=IOCTL("PNIO-CTRL",50,3) :恢复与抓手阀岛的通讯指令
WAIT Time=1 sec :等待1S
Harder2=true :将Harder2置位为真
LIN P6 Vel=0.2 m/s CPDAT4 Tool[3]:GRIPPER2 Base[0]
LIN P5 CONT Vel=0.2 m/s CPDAT3 Tool[3]:GRIPPER2 Base[0]
WAIT FOR ( NOT IN 265 'Grip2_In_Place' ) : 等待抓手2在位输入信号265为假
LIN P8 CONT Vel=1 m/s CPDAT6 Tool[3]:GRIPPER2 Base[0]
LIN P7 CONT Vel=1 m/s CPDAT5 Tool[3]:GRIPPER2 Base[0]
PTP P9 CONT Vel=100 % PDAT4 Tool[3]:GRIPPER2 Base[0]
END
换抢盘放抓手程序
DEF Q1_PUTGRPPER( ) :程序名称
INI :系统初始化
OUT 271 'Grip2_Bracket_Cls' State=FALSE
OUT 272 'Grip2_Bracket_Open' State=TRUE
WAIT FOR ( IN 272 'Grip2_Bracket_Opened' )
WAIT FOR ( IN 269 'Grip1_Bracket_Closed' ) :等待抓手2防尘盖打开到位输入信号269
PTP P7 CONT Vel=100 % PDAT3 Tool[3]:GRIPPER2 Base[0]
PTP P3 CONT Vel=100 % PDAT1 Tool[3]:GRIPPER2 Base[0]
LIN P2 CONT Vel=0.2 m/s CPDAT2 Tool[3]:GRIPPER2 Base[0]
LIN P1 Vel=0.1 m/s CPDAT5 Tool[3]:GRIPPER2 Base[0]
WAIT FOR ( IN 265 'Grip2_In_Place' )
Harder2=false :将Harder2置位为假
Repeat :循环指令
RET=IOCTL("PNIO-CTRL",60,3) :断开与抓手阀岛的通讯指令
until (RET==0) :循环结束指令
WAIT FOR ( IN 263 'ATC_Face' )
OUT 261 'ATC_LOCK' State=FALSE
OUT 262 'ATC_UNLOCK' State=TRUE
WAIT FOR ( IN 262 'ATC_Unlocked' )
WAIT Time=1 sec
LIN P4 Vel=0.1 m/s CPDAT3 Tool[0] Base[0]
WAIT FOR ( NOT IN 263 'ATC_Face' )
LIN P5 CONT Vel=0.5 m/s CPDAT4 Tool[0] Base[0]
PTP P6 CONT Vel=100 % PDAT2 Tool[0] Base[0]
PTP P8 CONT Vel=100 % PDAT4 Tool[0] Base[0]
PTP HOME Vel= 100 % DEFAULT
OUT 271 'Grip2_Bracket_Cls' State=TRUE
OUT 272 'Grip2_Bracket_Open' State=FALSE
WAIT FOR ( IN 271 'Grip2_Bracket_Closed' )
OUT 271 'Grip2_Bracket_Cls' State=FALSE
END
抓手抓件程序:
DEF Q1_Pick_part( )
INI
$CYCFLAG[11]=$IN[357] OR $IN[359] :定义循环旗标
INTERRUPT DECL 101 WHEN $CYCFLAG[11] DO INT_101() :中断声明
INTERRUPT Off 101 :关中断101
PTP P1 Vel=100 % PDAT1 Tool[3]:GRIPPER2 Base[0]
OUT 349 'Vac1_ON' State=FALSE :输出真空信号249为假
UnClamp1 :抓手夹具打开
$ADVANCE=0
OUT 348 'unclamp' State=TRUE CONT:输出抓手打开信号348为真
OUT 347 'clamp' State=FALSE CONT:输出抓手夹紧信号347为假
$TIMER_STOP[6]=TRUE
$TIMER[6]=-10000
$TIMER_STOP[6]=FALSE
WAIT FOR ( $TIMER_FLAG[6]==TRUE ) OR (( NOT $IN[351] ) AND ( $IN[349] ))
WAIT FOR ( $TIMER_FLAG[6]==TRUE ) OR (( NOT $IN[355] ) AND ( $IN[353] ))
IF $TIMER_FLAG[6]==TRUE THEN
$TIMER_STOP[6]=TRUE
$OUT[76]=TRUE :输出抓手报警信号76为真
MsgQuit("Check If All Clamps Are Opened!", "Grip")
HALT
WAIT FOR ( NOT $IN[351] ) AND ( $IN[349] ):等待抓手打开到位输入信号349
WAIT FOR ( NOT $IN[355] ) AND ( $IN[353] ):等待抓手打开到位输入信号353
$OUT[76]=FALSE:输出抓手报警信号76为假
ENDIF
$ADVANCE=3
PinShift1:抓手定位销伸出
$ADVANCE=0
OUT 346 'pin_unshift' State= FALSE CONT:输出定位销缩回信号346为假
OUT 345 'pin_shift' State= TRUE CONT:输出定位销伸出信号345为真
$TIMER_STOP[6]=TRUE
$TIMER[6]=-10000
$T