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

Stopping a tool , if a programme stops -

  • M J
  • January 19, 2023 at 12:47 PM
  • Thread is Unresolved
  • M J
    Trophies
    1
    Posts
    16
    • January 19, 2023 at 12:47 PM
    • #1

    Hi all ,

    I have a problem with stopping a tool (extruder ) controlled by IOs . I use my KUKA as a 3d printer . we have a issue where if the robot stops itself because of an issue (like it crashed because the print has moved ) the robot stop , this is good but the extruder will keep pushing out plastic like nothing has happened . this is a big problem (i can show you the picture but its not pretty )

    Can anyone please help , i have tried the below but it did not work : SPS.sub

    IF NOT $ALARM_STOP THEN


          IF NOT haspulsed THEN


    haspulsed = TRUE


           PULSE (STOP_KILL, TRUE,2) ***stop the motor (not in the real code)****


           PULSE ($OUT[3], TRUE,2) **** (Stops the heater) *****


          ENDIF


       ELSE


    haspulsed = FALSE


       ENDIF

  • M J
    Trophies
    1
    Posts
    16
    • January 19, 2023 at 12:48 PM
    • #2

    Full SPS :

    Code
    &ACCESS  RVO
    
    &COMMENT PLC on control
    
    DEF  SPS ( )
    
      ;FOLD DECLARATIONS
    
      ;FOLD BASISTECH DECL
    
      ;Automatik extern
    
      DECL STATE_T STAT
    
      DECL MODUS_T MODE
    
      ;ENDFOLD (BASISTECH DECL)
    
      ;FOLD USER DECL
    
      ; Please insert user defined declarations
    
       DECL BOOL haspulsed
    
      ;ENDFOLD (USER DECL)
    
      ;ENDFOLD (DECLARATIONS)
    
      ;FOLD INI
    
      ;FOLD AUTOEXT INIT
    
      INTERRUPT DECL 91 WHEN $PRO_STATE1==#P_FREE DO RESET_OUT ()
    
      INTERRUPT ON 91
    
      $LOOP_MSG[]="                                                            "
    
      MODE=#SYNC
    
      $H_POS=$H_POS
    
      ;Automatik extern
    
      IF $MODE_OP==#EX THEN
    
        CWRITE($CMD,STAT,MODE,"RUN /R1/CELL()")
    
      ENDIF
    
      ;ENDFOLD (AUTOEXT INIT)
    
      ;FOLD BACKUPMANAGER PLC INIT
    
      BM_ENABLED = FALSE
    
      BM_OUTPUTVALUE = 0
    
      ;ENDFOLD (BACKUPMANAGER PLC INIT)
    
      ;FOLD TQM_INIT
    
        TorqueDefinitions()
    
      ;ENDFOLD (TQM_INIT)
    
      ;FOLD USER INIT
    
      ; Please insert user defined initialization commands
    
    
    
      ;ENDFOLD (USER INIT)
    
      ;ENDFOLD (INI)
    
    
    
    
    
       haspulsed = FALSE
    
    
    
      LOOP
    
        WAIT FOR NOT($POWER_FAIL)
    
        TORQUE_MONITORING()
    
        ;FOLD BACKUPMANAGER PLC
    
        IF BM_ENABLED THEN
    
          BM_OUTPUTSIGNAL = BM_OUTPUTVALUE
    
        ENDIF
    
        ;ENDFOLD (BACKUPMANAGER PLC)
    
        ;FOLD USER PLC
    
        ;Make your modifications here
    
       IF NOT $ALARM_STOP THEN
    
          IF NOT haspulsed THEN
    
             haspulsed = TRUE
    
           PULSE (STOP_KILL, TRUE,2)
    
           PULSE ($OUT[3], TRUE,2)
    
          ENDIF
    
       ELSE
    
        haspulsed = FALSE
    
       ENDIF
    
        ;ENDFOLD (USER PLC)
    
      ENDLOOP
    
      ;FOLD ;%{H}
    
      ;FOLD
    
    END
    
      ;ENDFOLD
    
    
    
    
    
    DEF  RESET_OUT ( )
    
      INT N
    
      MsgLoop(" ")
    
      IF REFLECT_PROG_NR == 1 THEN
    
        FOR N = 0 TO PGNO_LENGTH - 1
    
          $OUT[PGNO_FBIT_REFL + N] = FALSE
    
        ENDFOR
    
      ENDIF
    
      IF (PGNO_REQ>0) THEN
    
        $OUT[PGNO_REQ]=FALSE
    
      ELSE
    
        IF (PGNO_REQ<0) THEN
    
          $OUT[-PGNO_REQ]=TRUE
    
        ENDIF
    
      ENDIF
    
    END
    
    
    
    ;FOLD USER SUBROUTINE
    
    ; Integrate your user defined subroutines
    
    
    
    ;ENDFOLD (USER SUBROUTINE)
    
    ;ENDFOLD
    Display More
  • aknezevi.proton
    Reactions Received
    5
    Trophies
    1
    Posts
    73
    • January 19, 2023 at 1:01 PM
    • #3

    First of all, which controller and robot are you using?

    One solution could be to edit the interrupt 3 program which is always run when there is $ALARM_STOP = 1. Inside WorkVisual just find any program, probably the main running one should have it (the first one the sub calls). Then find the Global Interrupt declaration with priority 3. Inside that program you can always just put that it resets the $OUT[]'s which control the extruder and temperature.

    Another solution would be to put something like this inside the SPS.sub:
    IF $ALARM_STOP THEN
    $OUT[] = FALSE
    ...
    ENDIF
    but that depends on sub interpreter then, I prefer to use the interrupts and keep the SPS clean and with as little code as I possibly can, as the SPS.sub file's runtime depends even on the empty lines inside of it.

  • M J
    Trophies
    1
    Posts
    16
    • January 19, 2023 at 1:40 PM
    • #4

    Hardware : KRC4 8.3

    KR22 R1610

    Can seem to find :

    Quote

    interrupt 3 program

    if the ( IF $ALARM_STOP THEN $OUT[] = FALSE ) is used correctly should this send a signal if anything makes the robot stop due to an error ?

  • hermann
    Reactions Received
    403
    Trophies
    9
    Posts
    2,593
    • January 19, 2023 at 1:56 PM
    • #5

    I wouldn't use $alarm_stop but $pro_act to trigger the pulses. That works always when program stops, even with no alarm but a 'normal' stop.

  • panic mode
    Reactions Received
    1,262
    Trophies
    11
    Posts
    13,030
    • January 19, 2023 at 1:58 PM
    • #6

    No..... Read the documentation.

    $alarm_stop tells if emergency stop is ok.... That is one of many things that could be stopping program.

    If you want to know if program is stopped, check if - program is stopped.

    Edit - hermann beat me to it

    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

  • aknezevi.proton
    Reactions Received
    5
    Trophies
    1
    Posts
    73
    • January 19, 2023 at 1:58 PM
    • #7
    Quote from M J

    Can seem to find :

    The interrupt program declaration should be a line as follows, located in every .src file, namely in CELL.src, which for me is the main program running the robot movement commands

    Code
    GLOBAL INTERRUPT DECL 3 WHEN $STOPMESS==TRUE DO IR_STOPM ( )
    INTERRUPT ON 3 

    You might be able to edit the IR_STOPM() program in order to make it stop your extruder by running whatever stopping instruction you have.

    Quote from M J

    if the ( IF $ALARM_STOP THEN $OUT[] = FALSE ) is used correctly should this send a signal if anything makes the robot stop due to an error ?

    In my examples above I just assumed that $OUT[] == TRUE means that your extruder is ON, and the corresponding output being FALSE means that the extruder is OFF. That is logical to me, but however your extruder works you can simply replace the $OUT[]=FALSE (what I called resetting the output) with your stopping instruction for the extruder and anything else you want stopped. Also, my above post was wrong, it should read IF $ALARM_STOP==FALSE THEN ... (since the $ALARM_STOP==TRUE means that there is no alarm stop)

    Also this:

    Quote from hermann

    I wouldn't use $alarm_stop but $pro_act to trigger the pulses. That works always when program stops, even with no alarm but a 'normal' stop.

  • panic mode
    Reactions Received
    1,262
    Trophies
    11
    Posts
    13,030
    • January 19, 2023 at 3:30 PM
    • #8

    btw using EStop to stop program is brutal. it is like driving a car into a wall because you needed to stop.

    also when posting code, please use code tag. this makes thing much cleaner and allows us to comment on code by referring to line number.

    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

  • M J
    Trophies
    1
    Posts
    16
    • January 19, 2023 at 3:59 PM
    • #9

    Thank you all I will digest and do some testing !

  • M J
    Trophies
    1
    Posts
    16
    • January 19, 2023 at 4:56 PM
    • #10

    HI all ,

    I added a CELL.SRC file as suggested . Please see my coded I added :

    Code
      GLOBAL INTERRUPT DECL 3 WHEN $STOPMESS==TRUE DO IR_STOPM ( )
      INTERRUPT ON 3 
      BAS (#INITMOV,0 )
      
      IF $pro_act THEN 
         PULSE (STOP_KILL, TRUE,2)
         PULSE ($OUT[3], TRUE,2)
         
         Endif


    I as understood even if I cancelled/ stopped the programme $pro_act would run . After testing I could not get it to stop extrusion . Note is there a way to simulate a error ?


    Thanks guys I'm sure I'm missing something simple .

  • Carleton Hall
    Reactions Received
    1
    Trophies
    3
    Posts
    20
    • January 19, 2023 at 9:06 PM
    • #11

    You'll need to use IF NOT $PRO_ACT or  IF $PRO_ACT == FALSE , if you want the action to happen when a program is NOT running. See the screenshot below from the Operating and Programming manual.

  • panic mode
    Reactions Received
    1,262
    Trophies
    11
    Posts
    13,030
    • January 19, 2023 at 11:34 PM
    • #12

    and that should be done in submit interpreter, not CELL.SRC.

    see user section of KRC:\R1\System\SPS.SUB

    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

  • aknezevi.proton
    Reactions Received
    5
    Trophies
    1
    Posts
    73
    • January 20, 2023 at 11:24 AM
    • #13
    Quote from M J

    HI all ,

    I added a CELL.SRC file as suggested . Please see my coded I added :

    Code
      GLOBAL INTERRUPT DECL 3 WHEN $STOPMESS==TRUE DO IR_STOPM ( )
      INTERRUPT ON 3 
      BAS (#INITMOV,0 )
      
      IF $pro_act THEN 
         PULSE (STOP_KILL, TRUE,2)
         PULSE ($OUT[3], TRUE,2)
         
         Endif


    I as understood even if I cancelled/ stopped the programme $pro_act would run . After testing I could not get it to stop extrusion . Note is there a way to simulate a error ?


    Thanks guys I'm sure I'm missing something simple .

    Display More

    I see you have not understood me properly. I was talking about two different options for you:


    1. Edit the interrupt program IR_STOPM() (or whichever name it is on your machine, the 'it' being the interrupt program declared as global with priority 3, your main .src file, whichever its name be, must have such an interrupt, so go find it, and you yourself cannot declare interrupts with priority 3, that is not allowed). The edit would be to include the following lines of code for you (if I understand those are the lines of code which stop the heater and the extruder):

    Code
    PULSE (STOP_KILL, TRUE,2)
    PULSE ($OUT[3], TRUE,2)

    This way whenever there is a stop message on the robot, that is, an error, the extruder and the heater will stop.

    2. The second option is to add the lines of code which you have added (with a twist for adding NOT or ==FALSE) to the .sub program:

    Code
    IF $PRO_ACT==FALSE THEN
        PULSE (STOP_KILL, TRUE,2)
        PULSE ($OUT[3], TRUE,2)
    ENDIF

    This way whenever a process is not active on the robot, regardless of if there is an error, the extruder and the heater will receive your stop commands.

    These two options (1. and 2.) can be used at the same time, but that is not needed.

  • M J
    Trophies
    1
    Posts
    16
    • January 20, 2023 at 1:23 PM
    • #14

    Thank you all I now have this working !

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

Tags

  • KUKA
  • error
  • Program Control
  • Saftey
  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