Good morning,
I am interfacing a Kuka robot with a PLC. I would like to be able to restart the Cell program in case of an emergency or just want to start over. I would like to be able to restart the Cell program in case of an emergency or just want to start over. I have one solution that is based on an interrupt and it looks like this. I found in one topic that someone does it similarly and for him to work. Here's code for my solution. Please do not judge not using Kuka's PGNO mechanism to inflict programs. This is the universal standard of my company that we use to handle robots of different companies.
QuoteDisplay MoreDEF CELL ( )
INTERRUPT DECL 1 WHEN InSig_bRestart == TRUE DO CellInterrupt()
INTERRUPT OFF 1
WAIT SEC 0.012
INTERRUPT ON 1
WAIT SEC 0.012
labelStartMain:
MainCell()
GOTO labelStartMain
END
DEF MainCell()
labelStart:
IF InSig_bExecute THEN
SWITCH InSig_nActionNumber ; Select with Programnumber
CASE 10
P10_BaseCheck()
CASE 20
P20_ClampsCheck()
CASE 30
P30_Welding()
CASE 40
P40_Cleaning()
CASE 100
P100_Homing()
CASE 110
P110_ServicePos()
CASE 120
P120_DisassemblyPos()
CASE 130
P130_TcpCheckPos()
CASE 140
P140_VisionCheck()
CASE 150
P150_Cleaning()
DEFAULT
GOTO labelEnd
ENDSWITCH
WAIT FOR InSig_bExecute==FALSE
OutSig_nActionNumber = 0
labelEnd:
ENDIF
OutSig_bDone = FALSE
OutSig_bBusy = FALSE
OutSig_nActionNumber = 0
WAIT SEC 0
GOTO labelStart
END
GLOBAL DEF CellInterrupt()
INTERRUPT OFF 1
BRAKE
INTERRUPT ON 1
WAIT SEC 0.1
RESUME
END
This solution works very well when the robot is in some sub program such as p10. It restarts the program and I can start working again. But only when we have MoveEnable signals etc. given, that is, the robot is in external automation mode. But what if I don't have these signals. There is a situation that the automatic mode of the machine from the PLC level is turned off which means the robot, also does not have the automatic on. I want to be able to restart Cell when I don't have MoveEnable, ExtStart etc signals. How to make the interrupt active when the robot is not running? Maybe the MoveEnable signal alone without DrivesOn and ExtStart is enough? Is the only option left is to restart the program from SPS with CWRITE commands(STOP>CANCEL>RUN)?
;Restart cell.src
IF InSig_bRestart AND NOT sps_bRestart THEN
sps_bRestart = TRUE
ENDIF
IF NOT InSig_bRestart THEN
sps_bEndRestartSeq = FALSE
ENDIF
IF sps_bRestart AND NOT sps_bEndRestartSeq THEN
CWRITE($CMD,s,m,"STOP 1")
WAIT SEC 0.1
CWRITE($CMD,s,m,"CANCEL 1")
WAIT SEC 0.1
CWRITE($CMD,STAT,MODE,"RUN /R1/CELL()")
WAIT SEC 0.1
sps_bRestart = FALSE
sps_bEndRestartSeq = TRUE
ENDIF
Display More
I'm testing this in KukaSIM, but it doesn't work. The simulation stops after a stop, and further when I start it again, the Cell does not restart and the program continues.