RobotStudio event

CalcJointT catch ERR_OUTSIDE_REACH

Hi,

I am trying to catch movement errors before they happen so that I can avoid the system crashing. Currently I have found that I should be able to use CalcJointT to detect if the target position is outside of reach. There is a \ErrorNumber parameter that expects a persistent variable, but I cant get it to work. It has no syntax errors if I pass any num value in, but doesnt trigger the error, and ERRNO doesnt change. I cant seen to pass an errnum such as ERROR_OUTSIDE_REACH without syntax errors. Does anybody have a suggestion of how to use this function to raise an error?

    FUNC string Test(robtarget rPos, num vector{*})    
        LOCAL robtarget tPos;
        tPos := CRobT(\Tool:=cTool, \WObj:=cObj);
        tPos.trans := [vector{1},vector{2},vector{3}]; 
        jointpos := CalcJointT(tPos, cTool, \WObj:=cOb, \ErrorNumber:= ERROR_OUTSIDE_REACH); 
        RETURN "Success";
    ERROR
        RETURN "Failed,"+ValToStr(ERRNO); 
    ENDFUNC

Comments

  • Hi,

    There is a good example in the Rapid Instructions, Function and Data types manual under the CalcJointT function. I haven't used this function before but according to the manual if you want to use an error handler then do not use the \ErrorNumber. The \ErrorNumber is for you to pass an ErrNum typed variable that you define which will be returned with the error number.
  • Thanks for the quick reply. Does that mean that the ERROR isnt raised, but instead passed in to the variable? Then it's best to simple do an IF statement to check the condition?