Controlling external machine and robot at same time from KRL

  • We have a robot cell where we have integrated a Kuka KR60-HA with a custom-designed dual extruder. Think of the dual extruder as an alternating dual piston system: the first piston goes forward a certain distance, hits a limit switch and while it is retracting the second piston moves forward until it hits its limit switch and vice-versa. The integrator has given us the flags and commands to run the dual extruder (named extruder1 and extruder2). So for example, we can issue:



    My question is how can I combine the above with the movement of the robot so that I get the following logic:


    1. Start Program
    2. Extruder 1 starts moving forward. At the same time, the robot starts moving
    3. While robot is moving, if extruder 1 hits extended limit switch, retract until it hits retracted limit switch and at same time set extruder2 to move forward
    4. While robot is moving, if extruder 2 hits its extended limit switch, retract it until it hits its retracted limit switch and at same time set extruder 1 to move forward


    Is there a way I can recognise the above events (e.g. I_Ext1ExtendedLimitSw) becoming TRUE at any point in the program and take action while the robot continues to move?

    Thanks

  • Interrupts or the SPS. My knee-jerk preference is for the SPS, but I don't think either approach has a major advantage over the other, here.


    Either way, you want to avoid any WAITs.


    For the SPS, I would create a global variable that the motion program would set to indicate to the SPS that an extrusion was in progress. Probably also deliberately "reset" the extruder to a known state (say, Extruder 1 retracted and Extruder 2 extended) before beginning an extrusion path. Then, inside the SPS loop, something like:

  • as previous posts say there are different ways to do this. interrupts are great but require advanced knowledge of KRL. also they are limited resource and testing is not as simple as with running plain program.


    so for beginners, the simplest solution is to have some magic solution that can start or stop each extruder regardless if robot program is selected or running. this would rely on making extruder code run in the background (using submit). also add the switching variables to variable overview so you can see the state and make it convenient to manually turn it off if needed (Run_Extruder1, Run_Extruder2). this start/stop then could also be done from your actual robot program - simply turns extruder on/off as needed, without considering extruder present and next state.


    btw, i don't really like adding lengthy code into submit... this is messy and inconvenient to test or troubleshoot.


    i find it is far better to write all code (and test...) as a robot program(s). once the code works as wanted, just deselect it, and add call to your SRC from SPS loop. this way SPS stays clean - there is just one line that calls subprogram, easy to comment out if needed. and if you want to do some troubleshooting of verify code. comment that line out or stopping submit is enough to allow you to run and test the program as regular robot program.


    here is one idea to implement that, just create new Expert module called Extruders. Expert module does not contain any initial code (no INI and no motions). then modify DAT and SRC files to look something like this:


    EXTRUDERS.DAT

    Code
    DEFDAT Extruders PUBLIC
      ENUM EXTRUDER_T run_fwd, run_rev, dwell
      DECL EXTRUDER_T extruder1_state = #run_fwd
      DECL EXTRUDER_T extruder2_state = #run_fwd
      DECL INT extruder1_timer = 21
      DECL INT extruder2_timer = 22
      DECL GLOBAL Run_Extruder1 = FALSE
      DECL GLOBAL Run_Extruder2 = FALSE
    ENDDAT

    EXTRUDERS.SRC


    and as mentioned - once you have this working the way you like, simply add in your SPS program loop


    Code
    Extruders()

    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