I have a minor function in my robot where if it is idle for a set amount of time, it will do a little dance, log an error message with the total idle time, then continue waiting at the HOME position. Sounds silly, but we have reasons for it.
I originally wrote it as a timed interrupt, but kept getting errors because I wasn't using StorePath first. (Robot is sitting at the home position with no planned motion, so I thought that wouldn't be necessary.) It works as intended in RobotStudio, but I am getting a separate error message for each of the move instructions in the "idle dance".
I shifted over to an error handler in my MAIN routine, and played around until it ran with no errors. What I have is copied below, but based on examples in the Instructions, Functions, and Data Types manual, this seems excessive. Is there a cleaner way to do this??
PROC main()
...
WaitUntil di1=1\MaxTime:=5;
...
ERROR
IF ERRNO=ERR_WAIT_MAXTIME THEN
SkipWarn;
RestoPath;
StopMove;
ClearPath;
StorePath;
...
ErrWrite\W,"Idle time alert.";
FOR i FROM 1 TO 3 DO
MoveJ pIdleCheck1,v200,z50,tool0;
MoveJ pIdleCheck2,v200,z50,tool0;
ENDFOR
...
MoveAbsJ jt_HomePos,v200,fine,tGripper_0Deg;
RestoPath;
StartMoveRetry;
ENDIF
ENDPROC
Display More
If I don't have all of the commands in RED, I get several errors, including Path Limitation (40649), Execution Error (40223), and Missing Error Handler (40357).
The end result is working exactly how I want, it just seems very clunky. And I would like to get it back to an Interrupt to keep my MAIN module a little cleaner.