Kuka Resume Program after Estop

  • KRC4

    KSS 8.5.8




    So IM curious to see if there is a way to have the robot just continue its program after an estop was hit. As of now it always restarts the call. I attached the SPS and the Cell Program.



    If you have any ideas let me know


    thanks


    Sps


    Cell.src

  • "Restarts the call"? What does this mean?


    Normal KUKA behavior is to resume from where it was stopped by any event, barring "fatal" errors like encoder loss, safety zone violation, etc.


    This code in the SPS is bad:

    IF($IN[63] == TRUE) THEN

    CWRITE($CMD,STAT,MODE,"RUN /R1/CELL()")

    ENDIF


    A $CMD RUN command should never be triggered without checking that $PRO_STATE1==#P_FREE. And if $IN[63] is supposed to "reset" the program pointer back to CELL, it needs to properly trigger a $CMD STOP first, followed by a $CMD CANCEL, using $PRO_STATE1 to prevent "hammering" those commands.

  • Thanks for the reply



    To clarify further that $in[63] Is mapped from my $EXT_Start bit. Should i use the same bit to launch the command $CMD STOP Followed by a $CMD Cancel. Or should those be separate bits


    Also can you clarify what a $Pro_State1 means?

  • To clarify further that $in[63] Is mapped from my $EXT_Start bit. Should i use the same bit to launch the command $CMD STOP Followed by a $CMD Cancel. Or should those be separate bits

    Okay, no. The system signals like $EXT_START should never be used like this, unless you really know exactly what you're doing. For one thing, $EXT_START should never be sent to the robot unless all faults have been cleared, and the motors have been turned on, and the program to run has already been selected. That's what the commented-out part of your SPS is for -- it's set up to select CELL during boot, if someone reboots the robot while it's in EXT mode. This is written out in great detail in the manuals.


    I should note that the $CMD RUN command does not "run" a program -- it's the equivalent of manually using Select on the teach pendant. There is no way to start a program executing from the SPS -- that requires the pendant Step Forward button (T1, T2, and AUT modes) or $EXT_START (EXT Mode).

    Also can you clarify what a $Pro_State1 means?

    It's the state of the Level 1 Interpreter (Robot Interpreter) -- basically, L1 is the interpreter that executes "normal" robot programs. Level 0 is where the SPS runs, and cannot control robot motion.


    $PRO_STATE1 reports the state of the Level 1 interpreter -- the details are in the system variables manual, but basically, you can use it to tell if the interpreter is selected or cancelled, executing, or on the first or last lines of the selected program.


    "Selection Active" error after using CWRITE $CMD RUN

  • Thanks again


    The manual you're referencing is that the one with all of the start charts?


    Also for the CMD_Stop, CMD_Cancel and CMD Run. These should probably have different bits for each one correct? Is there a manual to read further on the function of each of these actions?

  • The manual you're referencing is that the one with all of the start charts?

    Yes. You need to look at them carefully, because there are several different versions depending on your specific AUTO-EXTERN configuration.

    Also for the CMD_Stop, CMD_Cancel and CMD Run. These should probably have different bits for each one correct? Is there a manual to read further on the function of each of these actions?

    Honestly, they should not be controlled from external signals at all, not directly.


    The sample SPS code in the link I posted above contains a working example from a production system. Once the "reset" Boolean flag goes true, the sequencing of $CMD commands is autonomous.

  • So Something more like this?


    IF($IN[26] == TRUE) THEN

    CWRITE($CMD,STAT,MODE,"RUN /R1/CELL()")

    ENDIF


    IF($IN[27] == TRUE) THEN

    CWRITE($CMD,STAT,MODE,"STOP 1")

    ENDIF


    IF($IN[28] == TRUE) THEN

    CWRITE($CMD,STAT,MODE,"CANCEL 1")

    ENDIF




    Where IN[26] is cycle start

    In[27] = Stop/Estop

    In[28] Cancel




    What I'm confused about how this pauses the program and makes it resume when an operator hits cycle start after an estop.

  • So IM curious to see if there is a way to have the robot just continue its program after an estop was hit. As of now it always restarts the call. I attached the SPS and the Cell Program.

    If you want to continue the program from the point it was stopped by the E-stop, just delete the cwrite statement in your first version of Sps.sub, attach in[63] to ext_start, and you are done.

    This cwrite thing you only need if you want to restart the program from beginning.

  • If you want to continue the program from the point it was stopped by the E-stop, just delete the cwrite statement in your first version of Sps.sub, attach in[63] to ext_start, and you are done.

    This cwrite thing you only need if you want to restart the program from beginning.

    Really then how does it call the program externally so it can run?

  • The program that was selected during Estop will be continued by a signal change from 0 to 1 at $in[63].

    There is no need to select it again.

    The estop only stops the program, he doesn't cancel it.

  • The program that was selected during Estop will be continued by a signal change from 0 to 1 at $in[63].

    There is no need to select it again.

    The estop only stops the program, he doesn't cancel it.

    Okay Yeah that makes sense but when in good practice should that program be called or selected to run. Should it be from an external or something else.

    I guess i'm confused because no matter what a normal start up would call the program. Unless I could have it so anytime the Robot goes in EXT mode it calls the program automatically. Then I use the same cycle start principle to run the program.

  • What are you trying to accomplish? Normally, Cancelling an active program and re-selecting the "main" program (to begin running from the first line) is pretty rare, except under special circumstances.


    The robot is designed to operate without any of these $CMD commands in the SPS. If you remove all the $CMD commands from your SPS, then when the robot is E-Stopped, it will perform a controlled stop, and will resume the program once the robot receives the remote start signal again. The general practice is to write each program CELL calls in such a way that, when they end, the robot is in a safe location and condition (typically at Home position) that any other CELL-called program is safe to begin.


    Using $CMD commands in the SPS to forcibly "reset" the robot is risky, and requires some very careful programming. Since the SPS can fire a $CMD at any time, it's very easy for the robot to be in a condition that is difficult to recover from. Every robot I've ever worked on that used this technique required large amounts of complex "recovery" programming to determine and execute safe return-to-Home paths autonomously. This is usually reserved for special circumstances.

  • What are you trying to accomplish? Normally, Cancelling an active program and re-selecting the "main" program (to begin running from the first line) is pretty rare, except under special circumstances.

    The robot is tending a mold so all I want to do is make sure the robot doesnt ram into the mold by trying to restart the program completely. So I totally agree that what I'm doing is not what I want it to do.

    CELL calls in such a way that, when they end, the robot is in a safe location and condition (typically at Home position) that any other CELL-called program is safe to begin.

    As of right now this is how I programmed it.



    Pretty much all I want to know how is the best practice to call the Cell of the Robot in the First go. Does something need to be done in the SPS to actually run Cell or will it always just pick Cell. If not I think the best way of doing that is to call the main Cell program is to anytime it turned to EXT run mode it calls that program. Then I send the remote start signal to actually run the program when the user presses start on the HMI.

  • Pretty much all I want to know how is the best practice to call the Cell of the Robot in the First go.

    You mean, after a cold boot? That's what the commented-out section of your SPS is for.


    The "Init" section of the SPS only runs once, when the robot boots (or when someone cancels and then re-starts the SPS from the pendant). The IF $MODE_OP==#EX checks to see if the robot is being booted in Automatic External mode, and if it is, then it uses $CMD RUN to select CELL.SRC. This way, if the robot was rebooted in Teach mode, CELL does not get selected automatically.


    That said, if the robot cold-booted while inside a mold (say, the plant had a power failure), then simply resetting to CELL is probably not a good idea, unless CELL has been configured to refuse to start unless the robot is physically at Home, in order to force someone to pick up the pendant and manually move the robot Home.

  • The "Init" section of the SPS only runs once, when the robot boots (or when someone cancels and then re-starts the SPS from the pendant). The IF $MODE_OP==#EX checks to see if the robot is being booted in Automatic External mode, and if it is, then it uses $CMD RUN to select CELL.SRC. This way, if the robot was rebooted in Teach mode, CELL does not get selected automatically.


    Okay and if it was booted up in Automatic External it calls it, But when im switching from T1 to Automatic External it doesnt call it. In that case I could send a signal from my PLC and have it call it to act in the same way.


    And I have it in place that it doesn't run unless its at 1 of the Home positions. I'm more worried about Estops since it's more likely that an operator would hit one of those than a power failure.

  • Okay and if it was booted up in Automatic External it calls it, But when im switching from T1 to Automatic External it doesnt call it. In that case I could send a signal from my PLC and have it call it to act in the same way.

    The $CMD in the INIT section of the SPS is only for reboot scenarios.


    If you want the robot to automatically select CELL whenever you switch from T1 to EXT, you can put code for that into the SPS. It doesn't need PLC signals, although that would work too. You would probably want to protect against it happening at a random location, though -- if someone is T1-stepping through the program, and is inside the mold, you probably want the robot to continue from where the operator left it, as opposed to jumping back to Line 1 of CELL. So, create a memory latch that detects when the robot is switched from Teach to Auto, b/c you only want to fire the $CMD once. Then put the trigger code into the SPS's main loop:

    Code
    IF $IN_HOME AND Previous_Mode==#T1 AND $MODE_OP==#EX AND $PRO_STATE1==#P_FREE THEN
      CWRITE($CMD,STAT,MODE,"RUN /R1/CELL()")
    ENDIF
    Previous_Mode = $MODE_OP ; update memory 
  • If you want the robot to automatically select CELL whenever you switch from T1 to EXT ....

    In my opinion this is not a good idea. Every time I see such a program I get high blood pressure, In case of optimization or reteaching some positions it is impossible to switch between operating modes without resetting the whole station. For me that is a nogo.

  • In my opinion this is not a good idea. Every time I see such a program I get high blood pressure, In case of optimization or reteaching some positions it is impossible to switch between operating modes without resetting the whole station. For me that is a nogo.

    Yeah I decided to go with an external PLC sending the signal so its in External Run mode and Home it calls the Cell

  • keep in mind that operating robot in EXT mode means there is no BCO. blindly selecting and running program will make robot move... but if robot is not at home or in safe position this can and will cause serious damage. this is why default is to select program manually (even if it is CELL) and do BCO in T1 and then change to EXT mode.

    of course it is possible to automate anything and i have done so on many projects but... this requires knowing what you are doing and creating routine that will safely bring robot back to a known point such as home.... automatically... and from anywhere in the cell.... regardless which tool is used, if it holds a part or not...

    as said this is doable but it is not trivial. be careful with automatically selecting and starting programs. this is very different from simply issuing another start after robot was already executing something but was stopped.

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

Advertising from our partners