Trying to expand the error handling on a robot that was programmed by a coworker who recently left. He and I were both new to Fanuc, but he was able to spend a lot more time on the project than I was.
I am trying to set an alarm ID register when I request an image using VISION RUN_FIND, and a result is not obtained. (Essentially a VISION TIMEOUT alarm). My only examples are the existing code that was written, but when I try to duplicate it, the TP doesn't accept my changes. We don't have RoboGuide, and are limited to the pendant or the browser editor.
Here is an example of how errors are handled throughout the system. "JMP" is appended to a line of code, then the associated LBL sets an AlarmID and StatementID.
CALL IRVWAITLOG
VISION RUN_FIND SR[1]
VISION GET_NFOUND SR[1] R[3]
IF (R[3:QtyFound]=1) THEN
--eg:SCREW FOUND, GET VR
VISION GET_OFFSET SR[1] VR[1] JMP LBL[1]
--eg:STORE MES VALUES
R[22]=VR[1].MES[1]
R[23]=VR[1].MES[2]
R[24]=VR[1].MES[3]
R[25]=VR[1].MES[4]
--eg:CHECK CIRCULARITY
IF (R[25:CircularityRef]>R[103:CircularityMax]),JMP LBL[2]
.......
--eg:GET VR FAILED
LBL[1]
R[2:AlarmID]=5
--eg:SET NEXT STATE TO ALARM HANDLER
R[1:StatementID]=7
--eg:JUMP OUT OF PROGRAM
JMP LBL[999]
--eg:CIRCULARITY FAILED
LBL[2]
R[2:AlarmID]=4
DO[147]=PULSE,1.0sec
--eg:SET NEXT STATE TO ALARM HANDLER
R[1:StatementID]=7
--eg:JUMP OUT OF PROGRAM
JMP LBL[999]
Display More
Then there is a separate program, ALARM_HANDLER which does any number of things depending on the AlarmID set elsewhere.
- Call other programs (such as GO_HOME)
- Set UALM register
- Set a DO
- PAUSE the program
So how can can I cause a camera communication/vision timeout error to trigger a JUMP then call the ALARM_HANDLER program?