Program cancel in KRC4

  • Hi!
    I'm doing an emergency program for my Kuka robot to get it to the HOME position. When it gets to the HOME position I want to CANCEL or RESET the program, so the operator of the robot cell has to activate starting sequence again in order to start the implementation of the program.
    What command do I have to use to do this?
    Can I do this inside the current program or do I have to implement this into the SPS? I would rather do this inside of a current program.
    I was watching the commands "CWRITE($CMD,STAT,MODE,"CANCEL 1")" or "CWRITE($CMD,STAT,MODE,"RESET 1")". Are they just for SPS implementation?


    Thanks. :icon_wink:

  • Place your Ad here!
  • Ok, thanks. I will set the output inside the program and then I will watch when it is set in SPS and use the $CMD command to RESET or CANCEL the program.


    :icon_wink:

  • Hi


    Is there any possibility to cancel actually chosen program?


    after INPUT i can do that

    "CWRITE($CMD,STAT,MODE,"CANCEL/r1/cell")" or "CWRITE($CMD,STAT,MODE,"CANCEL/r1/testprogram")"

    but i cant find solution to just CANCEL program that is actually running.

    I can just copy this function for all existing programs but simply 1 line code solution will look better


    Ok i just try some combinations and "CWRITE($CMD,STAT,MODE,"CANCEL"" is enough for cancel actual program. Anyway is there any manual ( except KSS 8.2, 8.3 CREAD/CWRITE V1) with all commands for $CMD channel ( or its only RUN RESET STOP CANCEL)?

    Edited 2 times, last by Adam.C ().

  • Quote

    Is there any possibility to cancel actually chosen program?


    yes... but... program must be first stopped,.. and then it can be cancelled.


    Quote

    CWRITE($CMD,STAT,MODE,"CANCEL/r1/cell")

    CWRITE($CMD,STAT,MODE,"CANCEL/r1/testprogram")

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

    they are all wrong... read the manual. correct line is

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


    note 1 after CANCEL. this means cancel program (any name) that is running in interpreter 1 (robot interpreter)


    Quote

    is there any manual ( except KSS 8.2, 8.3 CREAD/CWRITE V1) with all commands for $CMD channel ( or its only RUN RESET STOP CANCEL)?


    sure, other versions of the manual also exists, like KSS_VSS_82_87_CREAD_CWRITE_en which is newer

    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

  • Is there any possibility to cancel actually chosen program?

    No. The CWRITE Run/Stop/Cancel commands work on interpreters, not on programs. So "CANCEL 1" clears the entire active program stack in the Level 1 (Robot) Interpreter, the "foreground task" where your motion programs are executed. "CANCEL 0" clears the original SPS. On newer robots that have Multi-Submit, there are additional numbers available, one for each added interpreter.


    Note: as far as I'm aware, interpreters can CWRITE command each other, but not themselves. I'm not sure if Multi-Submit has any extra limits on this, as I never worked with it much.

  • I was able to stop and rest (cancel) a running program with


    ; Stop and cancel running robot program

    IF ($PRO_STATE1 <> #P_FREE) THEN

    MODE = #SYNC


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

    WAIT SEC 0.1


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

    WAIT SEC 0.1

    ENDIF


    NOW I want to (select) and run that program using something like this...


    IF ($PRO_STATE1 == #P_FREE) THEN

    MODE = #SYNC


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

    WAIT SEC 0.1


    ENDIF


    It is not doing it (restarting that is) it is stuck at 'R' gray color.


    Any ideas how I can select and run mySRCcode.src.


    THANKS,

    J

  • under /R1 paths are irrelevant and should not be specified.


    so instead of

    "RUN/R1/Program/mySRCcode()"

    try

    "RUN /R1/mySRCcode()"


    if i recall space after RUN is not required but i think it is neater.


    to really know what is going on (if it does not work), check STAT value

    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

  • Thanks...


    I put the sub code in the SPS file (instead of calling an SRC file for selecting and running the code ) for the stop and cancel I put the code in an SRC file and called it from the sps program (trying to keep it clean). In any case this time (after integrating the 'run...' lines in the sps program its self) I get the 'R' yellowed (reset status) ready to run but still not running.


    SO CLOSE...


    result of $PROG_INFO[] query


    {PROG_INFO: SEL_NAME[] "/R1/Welding", P_STATE #P_RESET, P_MODE #GO, PRO_IP_NAME[] "/R1/Welding.SRC", PRO_IP_SNR 13} {PROG_INFO: SEL_NAME[] "/R1/SPS", P_STATE #P_ACTIVE, P_MODE #GO, PRO_IP_NAME[] "/R1/SPS.SUB", PRO_IP_SNR 40} {PROG_INFO: SEL_NAME[] " ", P_STATE #P_FREE, P_MODE #GO, PRO_IP_NAME[] " ", PRO_IP_SNR 0} {PROG_INFO: SEL_NAME[] " ", P_STATE #P_FREE, P_MODE #GO, PRO_IP_NAME[] " ", PRO_IP_SNR 0} {PROG_INFO: SEL_NAME[] " ", P_STATE #P_FREE, P_MODE #GO, PRO_IP_NAME[] " ", PRO_IP_SNR 0} {PROG_INFO: SEL_NAME[] " ", P_STATE #P_FREE, P_MODE #GO, PRO_IP_NAME[] " ", PRO_IP_SNR 0} {PROG_INFO: SEL_NAME[] " ", P_STATE #P_FREE, P_MODE #GO, PRO_IP_NAME[] " ", PRO_IP_SNR 0} {PROG_INFO: SEL_NAME[] " ", P_STATE #P_FREE, P_MODE #GO, PRO_IP_NAME[] " ", PRO_IP_SNR 0} {PROG_INFO: SEL_NAME[] " ", P_STATE #P_FREE, P_MODE #GO, PRO_IP_NAME[] " ", PRO_IP_SNR 0}


    Thanks,

    J

  • actually this is selecting program.... to make program RUN other things need to be in place, including move enable, drives on, no stop messages....

    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

  • Hi Guys,


    I checked all the variables I could, and looks like there are no issues that I can figure out. FYI, the program is selected and ready to run and does RUN if I press the 'green' run forward button on the HMI. Any ideas. (PLEASE revisit my original question for reference).


    Thanks,

    J

  • that is how robot works...


    to run program you need to

    1. clear messages

    2. enable drives

    3. select program

    4 . start program


    all of this is REQUIRED each and every time...

    even though in different modes some of this is done differently


    for example enabling drives in T1/T2 requires pressing enabling switch, in AUT mode this requires user to manually turn on drives on smartPad screen. in EXT mode this is done by pulsing handshake signals configured in AutoExternal interface. but the point is that program will not run without drives enabled so deal with it....


    in this thread we discussed SELECTING program. normally this is done by user but obviously it can be also done from SPS as you just did.


    the "problem" you have is the final point (#4) which deals with issuing START command....

    if you read the manual you will find out how programs are started in different modes.

    in T1/T2/AUT this is done by user, pressing Start key.

    in EXT mode this is done by PLC, by pulsing robot input.

    so if you want to perform this without user, you have no other choice but to use EXT mode and do whatever it takes to control that input.

    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

  • do that... i am sure they will be thrilled to discuss it to pieces...


    btw, "RUN..." can be used to start program too. but... that is not expected or documented, hence it is pretty scary...

    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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now

Advertising from our partners