Home Programming

Discussion

Left ArrowBack to discussions page
mkoester2mkoester2 Posts: 7 Apprentice
I am programming a UR10 Universal Robot. A panel box has been fabricated, and includes a green LED-lit push button and a red LED light. On the 'Installation' tab on the teach pendant, there are 4 actions outputs can take inside the program. I am wanting to set up a constant pulse for the green pushbutton inside the program itself instead of having it set to 'Continuous Pulse While Running'. I am wanting to make the green light flash before the program is executed, make an operator push that green pushbutton when ready, then set it ON constant while the robot is executing its program. Is there anyway to do this inside of the program? 

Thanks 

Comments

  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,065 Handy
    You can simply have a thread that is running in the background with some conditions that start the thread so that when you want the light to flash you start a loop running where the light turns on, waits, turns off, waits.  When the opertor pushes the button you would just need to set whatever flag you are using to flash the light to false and then in the thread you would simply have an else statement where the light then goes solid.  

    Here is an example thread that you could use in the program
    thread_1():
      if (waitingOnOperator == True):
        set GreenLight High
        wait (0.5)
        set GreenLight Low
        wait (0.5)
      else:
        set GreenLight High
        wait (waitingOnOperator == True)
      end
      sync()
    end
    

    In your main program when you get to the point you are waiting on the operator to push the button you would have something like this

    waitingOnOperator = True
    wait (operatorButton) == High
    waitingOnOperator = False

    Then when you are waiting for the operator to press the button, line 2 above, you would trigger the thread to flash the light, as soon as the button is pressed the flag would be set low and the thread would advance to the else condition and then wait for the input to be needed again.

    In the new polyscope versions you can actually now set an output to flash using the set command so that could simplify the code as well.
  • mkoester2mkoester2 Posts: 7 Apprentice
    @matthewd92

    This worked as needed. Thanks again
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,065 Handy
    You're welcome
Sign In or Register to comment.
Left ArrowBack to discussions page