1. Home
    1. Dashboard
    2. Search
  2. Forum
    1. Unresolved Threads
    2. Members
      1. Recent Activities
      2. Users Online
      3. Team Members
      4. Search Members
      5. Trophys
  3. Articles
  4. Blog
  5. Videos
  6. Jobs
  7. Shop
    1. Orders
  • Login or register
  • Search
This Thread
  • Everywhere
  • This Thread
  • This Forum
  • Articles
  • Pages
  • Forum
  • Blog Articles
  • Products
  • More Options
  1. Robotforum - Support and discussion community for industrial robots and cobots
  2. Forum
  3. Industrial Robot Support and Discussion Center
  4. KUKA Robot Forum
Your browser does not support videos RoboDK Software for simulation and programming
Visit our Mainsponsor
IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Sponsored Ads

How to reset the running program automatically in Ext through PLC?

  • sky12138
  • March 13, 2018 at 3:10 AM
  • Thread is Resolved
  • sky12138
    Trophies
    3
    Posts
    1
    • March 13, 2018 at 3:10 AM
    • #1

    robot:KR10 R900 Sixx

    contorller:KRC4

    If the operator push emergency stop button while robot is working, after reset the button ,in standard,we need to make robot back to home position safe and then wait next start cycle,

    but how we can make robot jump out the program he is running and enter the cell program to wait PGNO ?

  • Go to Best Answer
  • hermann
    Reactions Received
    403
    Trophies
    9
    Posts
    2,593
    • March 13, 2018 at 9:07 AM
    • #2

    Use search function of the forum.
    A good starting point is Re: Cancel Program and Send Pointer to Cell.

  • zray133
    Reactions Received
    2
    Trophies
    3
    Posts
    17
    • October 29, 2020 at 6:19 PM
    • #3

    Updated link:

    Cancel Program and Send Pointer to Cell.

  • Knezo
    Reactions Received
    1
    Trophies
    3
    Posts
    7
    • October 30, 2020 at 9:06 AM
    • #4

    Code in SPS to auto RESET via PLC. I_RESET_PROGRAM signal from PLC, O_RESET_PROGRAM signal to PLC. RES1, RES2, RES3 markers.

    Code
    .;FOLD Auto RESET PROGRAMA.
                
                ;Auto RESET
                
                IF (( $PRO_STATE1==#P_ACTIVE) AND ( $MODE_OP==#EX ) AND ( NOT $PRO_MOVE ) AND ( I_RESET_PROGRAM )) THEN
                   CWRITE($CMD,STAT,MODE,"STOP /R1/BINPICKING_TPV()")
                   RES1=TRUE
                   O_RESET_PROGRAM=TRUE
                ENDIF
                
                IF (( $PRO_STATE1==#P_STOP ) AND ( RES1 ) AND ( $MODE_OP==#EX )) THEN
                   CWRITE($CMD,STAT,MODE,"RESET /R1/BINPICKING_TPV()")
                   RES2=TRUE
                ENDIF
                IF (( $PRO_STATE1==#P_RESET ) AND ( RES2 ) AND ( $MODE_OP==#EX )) THEN
                   CWRITE($CMD,STAT,MODE,"RUN /R1/BINPICKING_TPV()")
                   RES1=FALSE
                   RES2=FALSE
                   O_RESET_PROGRAM=FALSE
                ENDIF
                
                ;Auto RESET first START
                
                IF ((( $PRO_STATE1==#P_RESET ) OR ( $PRO_STATE1==#P_STOP )) AND ( $MODE_OP==#EX ) AND ( NOT $PRO_MOVE ) AND ( I_RESET_PROGRAM )) THEN
                   CWRITE($CMD,STAT,MODE, "STOP /R1/BINPICKING_TPV()")
                   RES3=TRUE
                   O_RESET_PROGRAM=TRUE
                ENDIF
                
                IF ((( $PRO_STATE1==#P_RESET ) OR ( $PRO_STATE1==#P_STOP )) AND ( RES3 ) AND ( $MODE_OP==#EX )) THEN
                   CWRITE($CMD,STAT,MODE, "RESET /R1/BINPICKING_TPV()")
                   RES3=FALSE
                   O_RESET_PROGRAM=FALSE
                ENDIF
                
                ;Auto select PROGRAM
                IF (( $PRO_STATE1==#P_FREE ) AND ( $MODE_OP==#EX )) THEN
                   CWRITE($CMD,STAT,MODE,"RUN /R1/BINPICKING_TPV()")
                ENDIF
                
     ;ENDFOLD
    Display More
  • zray133
    Reactions Received
    2
    Trophies
    3
    Posts
    17
    • October 30, 2020 at 2:39 PM
    • #5

    That looks like exactly what I'm trying to do. My question though is if the BINPICKING_TPV() is running on SPS.sub, how does the program know to reset if it gets stuck inside BINPICKING_TPV()? I thought the interpreter could only process what it's currently executing plus the advance run. Is it able to continue checking SPS.sub, or does this only get checked after you've finished running through BINPICKING_TPV()?

    I started looking into the TRIGGER method Hermann referenced, but I haven't figured out how to start over at the beginning of the main loop after triggering the reset code yet. Currently it triggers, runs the reset, and then resumes where it left off in the main loop instead of starting at the beginning.

  • Online
    SkyeFire
    Reactions Received
    1,038
    Trophies
    12
    Posts
    9,371
    • October 30, 2020 at 3:00 PM
    • #6
    Quote from zray133

    My question though is if the BINPICKING_TPV() is running on SPS.sub, how does the program know to reset if it gets stuck inside BINPICKING_TPV()? I thought the interpreter could only process what it's currently executing plus the advance run. Is it able to continue checking SPS.sub, or does this only get checked after you've finished running through BINPICKING_TPV()?

    That's not how this works. The SPS runs in the Level 0 interpreter, and the "normal" programs run in the Level 1 Interpreter. Each interpreter can issue $CMD Run/Cancel commands against the other interpreter, but not against itself.

    So when the SPS is triggered by some event to issue a $CMD RUN for BinPicking_TPV, that program gets loaded into the L1 Interpreter, and runs there. It is not run as a subroutine of the SPS, and if BinPicking_TPV gets hung waiting for something, the SPS keeps right on going.

    (or should -- a well-written SPS has no WAIT statements or "blocking", but runs as a state machine. A badly written SPS could be written in such a way that a WAIT in the BinPicking_TPV program could cause the SPS to hang)

    However, there are a few caveats: $CMD RUN does not actually start program execution -- it works more like the Select button on the teach pendant. The robot must still receive $EXT_START (for EXT mode) or have the start button on the pendant pressed (T1, T2, AUT modes).

    Also, issuing a $CMD RUN when the interpreter is already occupied won't work. That is why the example program uses $PRO_STATE and other $CMD commands, in proper sequence, to first Cancel the current program in the L1 interpreter, then load BinPicking_TPV.

  • panic mode
    Reactions Received
    1,262
    Trophies
    11
    Posts
    13,027
    • October 30, 2020 at 3:02 PM
    • #7

    read manual for CREAD/CWRITE about selecting/stopping program

    you can press START/STOP program manually or use these commands, does not matter what line of code instruction pointer are at.

    code shared by Hermann is correct. it still uses EXT mode as usual but has added feature tht program can be aborted. if you select program again, it is automatically reset. the thig to watch with any of this is that you really really need to know what you are doing to prevent collisions (there is no BCO in EXT mode). in other words the safe return to home must be programmed and called after each abort. example is covered in KUKA training Programming3

    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

  • panic mode
    Reactions Received
    1,262
    Trophies
    11
    Posts
    13,027
    • October 30, 2020 at 3:12 PM
    • #8

    actually there is more to it. i did some tests maybe 2 years ago and CWRITE can start and run program without $EXT_START (checked on 8.3 and 8.5). drives are on and move enable is on, "RUN PROG()" does both select and start functions. also in this case $DRIVES_OFF did not work either. if i recall the only thing that did work as expected (and all the time) was move enable...

    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

  • hermann
    Reactions Received
    403
    Trophies
    9
    Posts
    2,593
    • October 30, 2020 at 8:58 PM
    • #9
    Quote from zray133

    I started looking into the TRIGGER method Hermann referenced, but I haven't figured out how to start over at the beginning of the main loop after triggering the reset code yet. Currently it triggers, runs the reset, and then resumes where it left off in the main loop instead of starting at the beginning

    It doesn't resume in the main loop, but in the mainprogram, because the interrupt is declared in mainprogram, and so you have a complete restart except the declaration of the interrupt. And by the way, you don't have any problem with the advance pointer.

    You really need a bulletproof strategy to move the robot to home (grundstellung) with that method, or at least a check, if he is in home before starting a new task.

  • Online
    SkyeFire
    Reactions Received
    1,038
    Trophies
    12
    Posts
    9,371
    • October 30, 2020 at 9:29 PM
    • #10
    Quote from panic mode

    actually there is more to it. i did some tests maybe 2 years ago and CWRITE can start and run program without $EXT_START (checked on 8.3 and 8.5). drives are on and move enable is on, "RUN PROG()" does both select and start functions. also in this case $DRIVES_OFF did not work either. if i recall the only thing that did work as expected (and all the time) was move enable...

    Something that can bypass $DRIVES_OFF? Yikes! Did the robot move, or were you only able to execute non-motion programs?

    Starting without $EXT_START could be handy, but also high-risk.

    I'm assuming that test was the SPS issuing the $CMD RUN command to L1? Because having the L1 program issue one select&run the SPS would not be remarkable, regardless of Drives status.

  • panic mode
    Reactions Received
    1,262
    Trophies
    11
    Posts
    13,027
    • October 30, 2020 at 10:08 PM
    • Best Answer
    • #11

    the first one when i saw the issue was a palletizer. and yes it moved very quickly, everyone who saw it was stunned. yes it is behind the fence and safety is on but... it was unexpected and very fast motion not too far from the fence. and of course that is where everyone was.

    then i did some test in OL and saw the same thing. so when i got back to our shop i decided to test it on a another robots with different controllers. first one was Agilus and second one was Quantec with big servogun (i think KR210). checked both KSS8.3 and 8.5. Sure enough they too, took of like a bullet...

    the issue is that command like

    CWRITE($CMD,STAT, MODE, "RUN PROG()")

    does not just select program, it actually runs it too if conditions are right (intermediate circuit energized and no faults). and if the conditions are not right (move enable off for more than 1sec or so), then yes, it would only Select program. Since safety still need to be correct, this was not too bad,.. unless someone used home version of a jumper plug. The orange X11 jumper plugs from KUKA have button that need to be pressed and held to test AUT mode. DIY jumper plugs have operator safety bridged as well... it is not rare that some cell ends up operating like that... so be very careful

    until then i would routinely set move enable and $DRIVES_OFF to true when in EXT mode, etc and wait for external start... but not any more.

    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

  • Knezo
    Reactions Received
    1
    Trophies
    3
    Posts
    7
    • November 2, 2020 at 7:51 AM
    • #12

    Like panic mode and SkyeFire said be very careful about reset. I always in the begining of the program check if the robot is in home position and if it's posible to return to home (if the application allows that).

    Example In the program BinPicking_TPV() i can return to home if i'm in the workspace of the bins. I easily go -200 Z in tool direction and return to home position the same path.

    We are using reset because of the PLC programming. Our firm has strict PLC program requirements. If the application stops at any reason we must to carryout reset of the whole application (included robots).

  • Emben22
    Reactions Received
    1
    Trophies
    3
    Posts
    43
    • November 2, 2020 at 12:38 PM
    • #13
    Quote from sky12138

    robot:KR10 R900 Sixx

    contorller:KRC4

    If the operator push emergency stop button while robot is working, after reset the button ,in standard,we need to make robot back to home position safe and then wait next start cycle,

    but how we can make robot jump out the program he is running and enter the cell program to wait PGNO ?

    Try this.

    IF $MODE_OP==#EX THEN

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

    ENDIF

    IF $IN[n]==FALSE THEN ;SAFETY GATE

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

    ENDIF

    IF $IN[n]==TRUE THEN ;PROGRAM RESET

    CWRITE($CMD,STAT,MODE,"RESET")

    ENDIF

    just always have fail safe on all your programs.

    hope this helps you

  • zray133
    Reactions Received
    2
    Trophies
    3
    Posts
    17
    • November 6, 2020 at 3:47 PM
    • #14

    The reset works beautifully! I meant to thank you earlier, but my son was born shortly after implementing these changes, and things got a bit hectic.

    I see what you're saying about the robot automatically starting without waiting for operator input. I have some ideas I can try to make sure the robot doesn't take off without operator input.

    As far as the reset goes, I'm fortunate to have a relatively simple layout with very few obstructions. I wrote a really neat reset program using FK to determine the safest path home. It may not be the prettiest piece of code (I think there are some existing functions I could have used but didn't know about), but it's stood up to all our testing.

    Again, thank you very much for your help! I learned a lot about how SPS works.

  • Mehrdad_ala
    Trophies
    1
    Posts
    61
    • April 27, 2023 at 10:11 AM
    • #15

    Hello

    Can you please teach me step by step how to reset the robot program with plc?

  • Online
    SkyeFire
    Reactions Received
    1,038
    Trophies
    12
    Posts
    9,371
    • April 27, 2023 at 4:18 PM
    • #16
    Quote from Mehrdad_ala

    Hello

    Can you please teach me step by step how to reset the robot program with plc?

    Just read this thread.

Advertising from our partners

IRBCAM
Robotics Channel
Robotics Training
Advertise in robotics
Advertise in Robotics
Advertise in Robotics

Job Postings

  • Anyware Robotics is hiring!

    yzhou377 February 23, 2025 at 4:54 AM
  • How to see your Job Posting (search or recruit) here in Robot-Forum.com

    Werner Hampel November 18, 2021 at 3:44 PM
Your browser does not support videos RoboDK Software for simulation and programming

Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000

Thread Tag Cloud

  • abb
  • Backup
  • calibration
  • Communication
  • CRX
  • DCS
  • dx100
  • dx200
  • error
  • Ethernet
  • Ethernet IP
  • external axis
  • Fanuc
  • help
  • hmi
  • I/O
  • irc5
  • IRVIsion
  • karel
  • kawasaki
  • KRC2
  • KRC4
  • KRC 4
  • KRL
  • KUKA
  • motoman
  • Offset
  • PLC
  • PROFINET
  • Program
  • Programming
  • RAPID
  • robodk
  • roboguide
  • robot
  • robotstudio
  • RSI
  • safety
  • Siemens
  • simulation
  • SPEED
  • staubli
  • tcp
  • TCP/IP
  • teach pendant
  • vision
  • Welding
  • workvisual
  • yaskawa
  • YRC1000
  1. Privacy Policy
  2. Legal Notice
Powered by WoltLab Suite™
As a registered Member:
* You will see no Google advertising
* You can translate posts into your local language
* You can ask questions or help the community with your knowledge
* You can thank the authors for their help
* You can receive notifications of replies or new topics on request
* We do not sell your data - we promise

JOIN OUR GREAT ROBOTICS COMMUNITY.
Don’t have an account yet? Register yourself now and be a part of our community!
Register Yourself Lost Password
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on Google Play
Robotforum - Support and discussion community for industrial robots and cobots in the WSC-Connect App on the App Store
Download