Dear colleagues,
I am quite new to RAPID programming, so I apologize if my question is too trivial.
I need a mechanism to catch kinematic errors if they happen and continue execution of the program. Example:
MODULE MyModule
VAR bool error_flag := FALSE;
PROC MyProc()
! The following line generates error 50065 “Kinematic error”
MoveAbsJ somewhere_out_of_reach, speed, zone, tool;
! I want the execution to continue here after the error
TPWrite “The show must go on!”, \Bool=error_flag;
@VictorAx I tried adding SkipWarn as you suggest, but it does not change the behavior of the program. The program simply stops with the “Kinematics error” message, and the ERROR handler is never called (also no “Hello from error handler!” message on FlexPendant). What am I missing?
If configuration is not a concern you can turn use ConfJ\Off for singularity issues, for out of reach positions I would verify that the robot can reach the points in RobotStudio prior to execution.
Verifying the motion prior to execution is always a good idea. But what I want to do here is to handle unexpected motion errors and notify a supervising PC than an error has happened.
Actually, the CalcJointT function should error if the calculated Jointtarget is out of reach. If you still do not see it passing into your error handler you might try the RAISE instruction.
@xerim your example is very similar to what I wrote in my first post. The problem is that it works for division by 0 but does not work for kinematic error.
You could try to configure a virtual analog output that is connected to the execution error you are experiencing, then create a procedure which restarts the system in the background when that signal is set to high.
Change your Error handler handler to what follows, more or less.
TEST ERRNO
CASE 50065:
TPWrite “blah blah”;
TRYNEXT;
DEFAULT
Stop;
! Look in program data for ERRNO value, match it with predefined Error numbers
! This helps in finding unanticipated errors
ENDTEST
That is because you don’t have it set up in the way lemster has suggested. Compare the example code he provided to the code you have in your original post.
I did mention in an earlier post that you may need to use the RAISE instruction for the error. Also, the best way to troubleshoot such things is to single step forward one line at a time instead of pressing the start button. Then you can see how the logic evaluates both TRUE or FALSE.
I did not look at the values for those variables. There is no CalcJointT function there, which should throw an error if it is out of range. I would normally use the step forward button on the virtual TP.