Switching outputs on/off on path

  • Hello everyone,



    My next task is to programme an UR - a dosing application.



    I have read through a lot so far and understand to some extent how the programming works.



    Now I have the question of how to switch the output for my dosing valve on or off on the web without triggering an exact stop?



    Ideally, this should be dependent on, for example, a distance to a start or end point.



    Unfortunately, I haven't found much on this yet. Does anyone have any experience that they can share with me?



    From other manufacturers I know own commands for such things and hope that the UR can also do this...



    Best regards

  • There is no "distance before" command option that I'm aware of. If you add a blend radius to the motion I know that the code looks ahead to find where the next point is, so you could try using that with an intermediary point; although, I'm pretty sure that will result in choppy movement.


    To really achieve your goal, I think you'll need to use a Thread in your program to manage turning on and off your dosing valve. Depending on your application, this could be as simple as turning on a signal before your motion that tells the Thread to wait a certain amount of time before turning on your output to the dosing valve. If you truly need to turn your signal on based on position you may need to have your thread monitor the position of the robot and turn on your signal when it gets to a certain point.

  • Hi Rob,


    My input here would be using a "THREAD" to control when to turn on your digital output.


    Threads are programming blocks in the cobot program that run in parallel with the main robot program. They are typically used for I/O monitoring (at least that is what I use them for a lot).


    Within this thread I suggest doing the following:

    • Monitor the current position of the Cobot EOAT
      • First, declare a current position pose in your "Before Start": cur_eoat_pos := p[0,0,0,0,0,0]
      • Then, set that positon to the current position in the thread.
        • I believe there is a SCRIPT function for this is: cur_eoat_pos := get_actual_tcp_pose()
        • UR Script manual reference: LINK
    • Use an IF statement to control the ON/OFF of the DO based on the Cobot EOAT Position
      • You would need to know the midpoint between the two points
      • Example (P1.X = 0, P2.X = 100):

    IF (cur_eoat_pos.X >= (P1.X + P2.X)/2 AND cur_eoat_pos.X <= P2.X) THEN

    DO := ON

    ELSE

    DO := OFF

    END_IF


    Sometimes threads have trouble synchronizing with the robot program, so throw the UR Script, "sync()" at the start of the thread.

  • Hi guys, you are great!


    The suggestion with the thread sounds good! Thanks for the idea - I will try it and give feedback soon.


    Best regards

Advertising from our partners