RobotStudio event

path recovery after e-stop was triggered

Hello all,

Using robot ware 5.16, path recovery option available.
Trying to program the robot to go to Service_pos  after E-stop was pressed and reset, and automatically go back and continue work where he left off.

Tried:
Configuration - I/O:
doEStopTriggered, digital output.


MODULE MainModule
..........
VAR errnum ERR_MY_ERR:=-1;
VAR robtarget p1;

PROC Path_10()
        Bookerrno Err_MY_err;
        IF DOutput(doEStopTriggered)=1 RAISE ERR_MY_ERR;
        ArcLStart Target_10,v1000,seam1,weld1,fine,Weldgun\WObj:=Workobject_1;
        ArcL Target_20,v1000,seam1,weld1,z10,Weldgun\WObj:=Workobject_1;
        ArcL Target_30,v1000,seam1,weld1,z10,Weldgun\WObj:=Workobject_1;
        ArcL Target_40,v1000,seam1,weld1,z10,Weldgun\WObj:=Workobject_1;
        ArcL Target_50,v1000,seam1,weld1,z10,Weldgun\WObj:=Workobject_1;
        ArcLEnd Target_50,v1000,seam1,weld1,fine,Weldgun\WObj:=Workobject_1;
    ERROR
        IF ERRNO=ERR_MY_ERR THEN
            StopMove;
            StorePath;
            SetDO doEStopTriggered,0;
            p1:=CRobT(\Tool:=weldgun\WObj:=Workobject_1);
            MoveL Service_Pos,V1000,z20,Weldgun\Wobj:=Workobject_1;
            MoveL p1,v1000,fine,Weldgun\Wobj:=Workobject_1;
            RestoPath;
            StartMoveRetry;
        ENDIF
    ENDPROC

System Modules (for the digital output)

MODULE Events(SYSMODULE)
       PROC QStopTriggered()
       SetDO doEStopTriggered,1;
       Exitcycle;
    ENDPROC
ENDMODULE

When i reset the E-stop, and press play the robot does the error correction but loops over and over inside off the error handler.
If instead of StartMoveRetry i use Return the robot starts welding from the beginning, and not where he left off.

Can you please help me, i am doing something wrong.

Best Answers

  • matti
    matti
    Answer ✓
    Try a "long jump":
    Main()
    ...  
       BookErrNo err_move_stop;
       IDelete intETriggered;
       CONNECT intETriggered WITH stop_weld;
       ISignalDO doEStopTriggered,0,intETriggered;
      TRAP stop_weld
            StopMove\Quick;
            RAISE err_move_stop;
        ERROR
            RAISE ;
        ENDTRAP

    PROC Path_10()
    ...
      ArcLStart *,V100,smh,wld_h30n0\Weave:=wv_h30n0,fine,tool_w50022 \Wobj:=BT1\Track:=track_h\SeamName:="seam1";
      ...
      ArcLEnd *,V200,smh,wld_h30n0\Weave:=wv_h30n0,fine,tool_w50022 \Wobj:=BT1\Track:=track_h;
    ...
    ERROR (err_move_stop)
      IF ERRNO=err_move_stop THEN
        err_coll_routine;
        RETRY;
      ENDIF
    ENDPROC

    Your E-Stop will stop the robot(if it is a emergency stop as I understood). If you reset (doEStopTriggered=0) an interrupt will be activated which
    calls a trap-routine that generates an error. The error is handed over to the error handler of the current procedure. There your handler routine (here replaced by err_coll_routine) will be executed and
    the controller will continue with the current instruction (retry).


  • matti
    matti
    Answer ✓
    OK, but after start he should write trap and enter the error-section?
  • matti
    matti
    Answer ✓
    Ha, I forgot: Instead of just ERROR for the error-section it must be ERROR(Err_MY_err) !!!


  • IstvanSzabo
    Answer ✓
    it writes Trap when i start path_10
    where should i put the Error(Err_My_err)?
  • matti
    matti
    Answer ✓
    In path_10, instead ERROR you put Error(Err_My_err). This is necessary to catch a raised error.
  • IstvanSzabo
    Answer ✓
    the same, continues where he left off, with out entering the gun cleaning routine 
  • matti
    matti
    Answer ✓
    He writes "trap"?

  • lemster68
    lemster68 ✭✭✭
    Answer ✓
    I neglected to mention that the trap can execute after e-stop if it is set to safe.
    Lee Justice
  • matti
    matti
    Answer ✓
    Good tip. Because we stopp, the interrupt might be ignored.
    So change the command to ISignalDO \SingleSafe,doEStopTriggered,1,intETriggered;

  • lemster68
    lemster68 ✭✭✭
    Answer ✓
    Yes
    Lee Justice
  • IstvanSzabo
    Answer ✓
    i start the program, it starts welding, i press the E-stop and reset it, press play, does the error recovery goes to service position, the robot goes back where he left off, the pointer moves back to path_10 where he left off,  and gives an error : 50359: Path Recorder on StorePath level not allowed, and stops the program execution 
  • IstvanSzabo
    Answer ✓
    if i use  PathRecStop; in the error handler, then the program execution stops with: 10020: Execution error state
    Description
    The program execution in task T_ROB1 has been stopped due to a spontaneous error.
  • IstvanSzabo
    Answer ✓
    ERROR (ERR_MY_ERR)
            IF ERRNO=ERR_MY_ERR THEN
                StopMove;
                PathRecStop;
                StorePath;
                SetDO doEStopTriggered,0;
                p1:=CRobT(\Tool:=weldgun\WObj:=Workobject_1);
                MoveL Service_Pos,V1000,z20,Weldgun\Wobj:=Workobject_1;
                ArcLStart p1,v1000,seam1,weld1,fine,Weldgun\WObj:=Workobject_1;
                RestoPath;
                StartMoveRetry;
            ENDIF

    so i wrote it like this , and it works like a charm, but only once! if i pres the E-stop again, it just starts where it left off, does not enter the error handler 
  • IstvanSzabo
    Answer ✓
    MODULE Event(SYSMODULE)
        PROC QStopTriggered()
            SetDO doEStopTriggered,1;
        ENDPROC
    ENDMODULE


    PROC main()
            IDelete intETriggered;
            CONNECT intETriggered WITH stop_now;
            ISignalDO\SingleSafe,doEStopTriggered,1,intETriggered;
            Path_10;
    ENDPROC


    PROC Path_10()
    ArcLStart Target_10,v1000,seam1,weld1,fine,Weldgun\WObj:=Workobject_1;
            ArcL Target_20,v1000,seam1,weld1,z10,Weldgun\WObj:=Workobject_1;
            ArcL Target_30,v1000,seam1,weld1,z10,Weldgun\WObj:=Workobject_1;
            ArcL Target_40,v1000,seam1,weld1,z10,Weldgun\WObj:=Workobject_1;
            ArcL Target_50,v1000,seam1,weld1,z10,Weldgun\WObj:=Workobject_1;
            ArcLEnd Target_50,v1000,seam1,weld1,fine,Weldgun\WObj:=Workobject_1;
     ENDPROC

    TRAP stop_now
            VAR robtarget stop_pos;
            StopMove;
            PathRecStop;
            StorePath;
            GetSysData Weldgun;
            GetSysData Workobject_1;
            stop_pos:=CRobT(\Tool:=Weldgun\WObj:=Workobject_1);
            MoveL Offs(stop_pos,0,0,20),v50,fine,Weldgun\WObj:=Workobject_1;
            MoveL Service_Pos,V1000,z20,Weldgun\Wobj:=Workobject_1;
            MoveL stop_pos,v1000,fine,Weldgun,\WObj:=Workobject_1;
            SetDO doEStopTriggered,0;
            RestoPath;
            StartMove;
        ENDTRAP
    ENDMODULE

    i also wrote it like this and it works perfect, but only once, if i press e-stop again than it wont enter the trap routine, it just start welding from where  it left of like after a normal e-stop
  • IstvanSzabo
    Answer ✓
    so we are on the right path, but not quit there yet :)),  why cant i find this information in any rapid manual? am i not looking in the right manuals? all the examples that i find in the manuals are for normal error handling nothing related to E-stop. How do other users handle an E-stop trigger by accident (like walking into light curtains, or opening the safety door by force, or just pressing the E-stop by accident)
    Thank you so much for your help guys!!!!
  • nicolahinssen
    edited April 2023 Answer ✓
    It works only once because of the line that enables the interrupt for the digital output:
    ISignalDO\SingleSafe,doEStopTriggered,1,intETriggered;

    The "\SingleSafe" argument makes it possible to activate the interrupt after resuming the program (exactly what you were looking for). However the Single part means the interrupt will only be triggered once. From the technical reference manual (3HAC050917-001) about the Single argument:

    Specifies whether the interrupt is to occur once or cyclically. If the argument Single is set, the interrupt occurs once at the most. If the Single and SingleSafe arguments is omitted, an interrupt will occur each time its condition is satisfied.

    To work around this, you can delete and reconnect the interrupt at the top of your TRAP routine (stop_now), like this:

    IDelete intETriggered;
    CONNECT intETriggered WITH stop_now;
    ISignalDO\SingleSafe,doEStopTriggered,1,intETriggered;

    About the question for good RAPID documentation, check the RAPID Overview manual (3HAC050947-001)

  • IstvanSzabo
    edited April 2023 Answer ✓
    Thank you Nicola!

    Just read about the singlesafe, found it in the rapid manual
    If i set it like you sad then after the trap routine start path 10 all over again , does not start where it left off

    Had an exitcycle at the end of the trap routine (was experimenting with it) that is why it started path 10 from begining.
    Deleted the exitcycle, and now it works 100% every time i pres E-Stop does the trap routine then returns from where it left off.

    Thank you guys for your help !!!!!!!!!!!!!!!!!
  • matti
    matti
    Answer ✓
    Hallo, thats right. You have to use  \singlesafe switch to have the interrupt working after a quick stop.
    But it will work only once, so you have to reconnect in the trap-routine.
    Your case is special, because you intend to go to a cleaning position after the e-stop.
    Usually you just continue bei pressing start. Especially when welding, the robot will perform a restart a little bit backwards automatically (if configured in the error handler).
    A description of the method you will find in Technical reference Manual-Rapid Kernel 3HAC16585-1, , Revision G
    Controller software IRC5 RobotWare 5.12.


  • nicolahinssen
    edited April 2023 Answer ✓
    And if you modify the TRAP routine like this?.

    TRAP stop_now
        VAR robtarget stop_pos;
        StopMove;
        PathRecStop;
        StorePath;
        IDelete intETriggered;
        SetDO doEStopTriggered, 0;
        GetSysData Weldgun;
        GetSysData Workobject_1;
        stop_pos := CRobT(\Tool:=Weldgun\WObj:=Workobject_1);
        MoveL Offs(stop_pos,0,0,20), v50, fine, Weldgun \WObj:=Workobject_1;
        MoveL Service_Pos, v1000, z20, Weldgun \Wobj:=Workobject_1;
        MoveL stop_pos, v1000, fine, Weldgun, \WObj:=Workobject_1;
        RestoPath;
        CONNECT intETriggered WITH stop_now;
        ISignalDO \SingleSafe, doEStopTriggered, 1, intETriggered; 
        StartMove;
    ENDTRAP



    EDIT: Nevermind, I see that it's working now, super!
«1

Answers

  • Thank you for your reply, i tried it , and it does not do anything 
  • Your e-stop is a emergency stop of the robot where you set doEStopTriggered to 1 automatically?
  • This is how i get the digital output: doEStopTriggered to become 1, when the Emergency stop button is pressed 

    MODULE Events(SYSMODULE)
        PROC QStopTriggered()
            SetDO doEStopTriggered,1;
           Exitcycle;
        ENDPROC
    1. Controller configuration, type Event routine.
    2. Right click to create a new event routine.
      • Routine: QStopTriggered
      • Event: QStop
      • Sequence number: 0
      • Task: T_ROB1
      • All tasks: No
      • All motion tasks: NO

    1. I understand. Let's skip trap and try something simple.

      VAR errnum err_move_stop:=-1;
      ...
      ! your event routine
      PROC QStopTriggered()
              RAISE err_move_stop;
              ERROR
              RAISE;
          ENDPROC

      Main()
      ...  
         BookErrNo err_move_stop;
      ...
      ! your welding routine
      PROC Path_10()
      ...
        ArcLStart *,V100,smh,wld_h30n0\Weave:=wv_h30n0,fine,tool_w50022 \Wobj:=BT1\Track:=track_h\SeamName:="seam1";
        ...
        ArcLEnd *,V200,smh,wld_h30n0\Weave:=wv_h30n0,fine,tool_w50022 \Wobj:=BT1\Track:=track_h;
      ...
      ERROR (err_move_stop)
        IF ERRNO=err_move_stop THEN
          err_coll_routine;! your error routine
          RETRY;
        ENDIF
      ENDPROC

      Event routine contains no exitcycle.
    2. i get an error in the event routine: unhandled error
    3. The ERROR(err_move_stop)- section must be in all routines where a QStop can happen.
    4. i put the error(err_move_stop) section in all the routines,
      and now i have an error when i press the e_stop: Task: T_ROB1
      The program is executing in an EVENT routine. It is not allowed to execute the instruction MoveL in an EVENT routine.


    5. mmh, I checked the code as above on my controller and it runs. Your event-routine contains only the code from my example ? - there should be anything else in.
      So when you make your MoveL you have already left Proc QStopTriggered.
    6. This is what i have found in the Technical reference manual
      RAPID Instructions, Functions and Data types:

      RestoPath cannot be executed in a RAPID routine connected to any of following special
      system events: PowerOn, Stop, QStop, Restart or Step.

      Can i use anything else to store and restore the interrupted path ?
    7. Yes the restriction is like that. But in your event-routine there is no movement or restopath, it just generates an error and leaves. What is your RW version?

    8. 5.16
    9. yes but i have in the gun cleaning procedure store and resto path
    10. Ok, you have to do so when interrupting a path. I do not quite understand why the controller is announcing that he is still in the event-routine when it is already finished (after its error-statement).

      Try to go back to the first proposal with interrupt and trap.
      But do the trigger not on low but on high : ISignalDO doEStopTriggered,1,intETriggered;



    11. its the same, loops inside the gun_cleaning process 
    12. But you have removed :     IF DOutput(doEStopTriggered)=1 RAISE ERR_MY_ERR; from your welding routine?
    13. if i remove that, then it continues the welding from the beginning , and does not do the gun cleaning process :(
    14. Its because of ExitCycle I suppose, where it uses the error-section inside main. A "Retry" there will call Path_10 again. Loop inside the gun-cleaning means there is another error which end up always there.
      Your code should look like that now:

      MODULE Events(SYSMODULE)
             PROC QStopTriggered()
             SetDO doEStopTriggered,1;
             ENDPROC
      ENDMODULE

      Main()
      ...
        IDelete intETriggered;
         CONNECT intETriggered WITH stop_weld;
         ISignalDO doEStopTriggered,1,intETriggered;
      ....
        TRAP stop_weld
              StopMove\Quick;
              RAISE ERR_MY_ERR;
          ERROR
              RAISE ;
          ENDTRAP
      ...
      path_10;
      ....
      ENDPROC


      PROC Path_10()
              Bookerrno Err_MY_err;
              ArcLStart Target_10,v1000,seam1,weld1,fine,Weldgun\WObj:=Workobject_1;
              ArcL Target_20,v1000,seam1,weld1,z10,Weldgun\WObj:=Workobject_1;
              ArcL Target_30,v1000,seam1,weld1,z10,Weldgun\WObj:=Workobject_1;
              ArcL Target_40,v1000,seam1,weld1,z10,Weldgun\WObj:=Workobject_1;
              ArcL Target_50,v1000,seam1,weld1,z10,Weldgun\WObj:=Workobject_1;
              ArcLEnd Target_50,v1000,seam1,weld1,fine,Weldgun\WObj:=Workobject_1;
          ERROR
              IF ERRNO=ERR_MY_ERR THEN
                  StopMove;
                  StorePath;
                  SetDO doEStopTriggered,0;
                  p1:=CRobT(\Tool:=weldgun\WObj:=Workobject_1);
                  MoveL Service_Pos,V1000,z20,Weldgun\Wobj:=Workobject_1;
                  MoveL p1,v1000,fine,Weldgun\Wobj:=Workobject_1;
                  RestoPath;
                  StartMoveRetry;
              ENDIF

      The error-section muste be in all path_ii.
    15. i cant put the Trap routine in the PROC MAIN () it says syntax error
    16. so i put it after PROC MAIN ()
    17. and it does nothing, i press the emergency stop, the robot stops, when i release it it continues the welding from where it left off, and the doEstopTriggered stays 1
    18. i wrote everything as you said 
    19. its like is not executing the Trap routine 
    20. OK, so it is not entering the error section. Add "SetDO doEStopTriggered,0;"
      after the bookerrno and a TPWrite "Trap"; in the trap routine that we can check if it is executed.
    21. writes on the teach pendant Trap when i start the program and sets doEstopTriggered to 0 at the beginning of path_10, it does not enter the gun cleaning routine .
    22. lemster68
      lemster68 ✭✭✭
      When the E-stop is pressed, program execution stops.  A trap will not execute unless it is in a background task.
      Lee Justice
    23. When you activate e-stop in the middle of welding, what happens?
    24. the robot stops
    25. the pointer remains in Path_10
    26. if i add exitcycle or return to the event routine the pointer jumps to main