RobotStudio event

Program never enters my error handler

I have a function where I do a searchL operation just to see if a certain part is missing or not. If the searchL fails I just want to return FALSE else return TRUE. But the problem I'm having is that the program never enters my error handler at all. The code is as follows:

MODULE program
PROC program()

PERS BOOL contact;
contact:=TRUE;
contact:=contact_func();
  IF contact=TRUE THEN
    weld something...
  ELSE
    dont weld, just continue to the end...
  ENDIF

ENDPROC

FUNC BOOL contact_func()
VAR BOOL value;
value:=TRUE;
MoveJ
FRO_SearchL 
RETURN value;
ERROR
  IF ERRNO=ERR_WHLSEARCH THEN
    value:=FALSE;
    TRYNEXT;
  ENDIF
ENDFUNC

ENDMODULE


When the searchL fails the robot just stops and gives me the error "80001 part is missing" but I want to continue from that state. Any ideas what I'm doing wrong?

Best Answer

  • Tompanhuhu
    Tompanhuhu ✭✭
    Answer ✓


    Here is an example of how it could look. 
    Systemintegrator - Web / C# / Rapid / Robotstudio

    If I helped, please press Vote Up  :smile:

Answers

  • I do not see a search instruction there (unless you have abbreviated it with FRO_SearchL).  Or is that a procedure call which actually does the search?
    Lee Justice
  • You cant declare 
    PERS BOOL contact;
    within a proc
    Systemintegrator - Web / C# / Rapid / Robotstudio

    If I helped, please press Vote Up  :smile:
  • True, it should be like this:
    MODULE program
    PERS BOOL contact:=TRUE;
    PROC program()


    Lee Justice
  • My bad, I don't have the PERS BOOL in the proc.
    FRO_search does the search. I'm new to this and trying to learn as much as possible, could someone give me an example code of a FUNC like mine that actually works so I might see what I'm doing wrong.
  • Marcus_D said:
    My bad, I don't have the PERS BOOL in the proc.
    FRO_search does the search. I'm new to this and trying to learn as much as possible, could someone give me an example code of a FUNC like mine that actually works so I might see what I'm doing wrong.
    Can you share your code so we can see what you have tried? Feels like you tried to censor (protect?) your code but it just makes it harder to help.

    Like lemster68 said there is no search function in your proc.
    Systemintegrator - Web / C# / Rapid / Robotstudio

    If I helped, please press Vote Up  :smile:
  • Sorry, for that, I tried to only post the relevant parts. Obviously, I failed.
    The FUNC looks like this:

    FUNC BOOL contact_func()
    VAR BOOL value;
    value:=TRUE;
    MoveJ [[x,x,x],[x,x,x,x],[x,x,x,x],[x,x,x,x,x]],v1000,fine,tWeldGun\WObj:=obSide1;
    !Set doFr1FeedRetract;
    !WaitTime 1;
    !Reset doFr1FeedRetract;
    ResetSearch;
    FRO_SearchL [[x,x,x],[x,x,x,x],[x,x,x,x],[x,x,x,x,x,x]],[[x,x,x],[x,x,x,x],[x,x,x,x],[x,x,x,x,x,x]],45,25,v300,v20,10,tWeldGun\WObj:=obSide1;

    MoveL [[-289.41,580.85,802.01],[0.360314,0.551548,0.710097,0.248456],[-1,-2,1,0],[9E+09,51.8991,-86.2131,9E+09,9E+09,9E+09]],v300,z50,tWeldGun\WObj:=obSide1;

    !FRO_SearchL [[x,x,x],[x,x,x,x],[x,x,x,x],[x,x,x,x,x,x]], [[x,x,x],[x,x,x,x],[x,x,x,x],[x,x,x,x,x,x]], 30, 25, v300, v20, 10, tWeldGun\WObj:=obSide1;
    !pdisp17 := C_PROGDISP;
    ResetSearch;
    MoveJ [[x,x,x],[x,x,x,x],[x,x,x,x],[x,x,x,x,x,x]],v1000,z100,tWeldGun\WObj:=obSide1;
    !Stop;
    RETURN value;

    ERROR
      IF ERRNO=ERR_WHLSEARCH THEN
        value:=FALSE;
        TRYNEXT;
      ENDIF
    ENDFUNC


    I inherited the code from old coworkers and I just know that the FRO_SearchL does the search but there's no PROC in the module with that name so I actually don't know how that works, I just use the code and trying to add an error handler so we don't have to manually handle it all the time.

    And thanks for that example tompanhuhu, I will try to do it like that.
  • Marcus_D said:
    Sorry, for that, I tried to only post the relevant parts. Obviously, I failed.
    The FUNC looks like this:


    I inherited the code from old coworkers and I just know that the FRO_SearchL does the search but there's no PROC in the module with that name so I actually don't know how that works, I just use the code and trying to add an error handler so we don't have to manually handle it all the time.

    And thanks for that example tompanhuhu, I will try to do it like that.
    Well if you can't find the FRO_SearchL proc in another module it might be encoded.
    In that case you won't have much luck trying to error handle it because the ERR_WHLSEARCH will most likely only be triggered within FRO_SearchL and not be raised to your func.

    Maybe you can rework it with a regular SearchL to get the extra functionality.
    Good luck!
    Systemintegrator - Web / C# / Rapid / Robotstudio

    If I helped, please press Vote Up  :smile: