Home Programming

Discussion

Left ArrowBack to discussions page
fihcncfihcnc Posts: 8 Apprentice
Is there any way to check if the robot has paused execution of the main thread due to a prompt or popup?
Obviously I can set a bool to true before the popup and low afterwards, but this gets really tedious when the program gets long.
Tagged:

Comments

  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,261 Handy
    There’s currently not a way to do this but you could create a function that does this and then when you want a pop up you would simply use that function instead of the pop up node in polyscope. 

    You could do something like this:

    Make an assignment in the Before Start section of the program and name the variable popupShowing and set it to False

    Create a script file with the following code:
    def my_popup(msg, title="Popup"):
      popupShowing = True
      popup(msg,title, False,False, True)
      popupShowing=False
    end
    Then when you call this the variable will go True, once the user acknowledges the popup the variable will go False.

    In the function definition you will see that one of the arguments, title, has a default value.  You can call the function with either just a message (msg) or with a message and a title such as

    my_popup("This will use the default title")
    my_popup("This uses a custom title", "Custom Title")
    You can learn more about scripts with UR by downloading the script manual from the help site.
  • fihcncfihcnc Posts: 8 Apprentice
    There’s currently not a way to do this but you could create a function [...]
    Create a script file with the following code:
    def my_popup(msg, title="Popup"):
      popupShowing = True
      popup(msg,title, False,False, True)
      popupShowing=False
    end
    [...]
    my_popup("This will use the default title")
    my_popup("This uses a custom title", "Custom Title")
    You can learn more about scripts with UR by downloading the script manual from the help site.
    Thank you.
    How could I do this for operator prompts requiring either bool or int input?
  • matthewd92matthewd92 Founding Pro, Tactile Sensor Beta Testers Posts: 1,261 Handy
    You could do something like this:

    request_boolean_from_primary_client(msg)
      popupShowing = False
      return answer
    enddef getBooleanFromOperator(msg):
      popupShowing = True
      local answer = 
    You would then use it like this:

    yesOrNo = getBooleanFromOperator("Do you want to continue operation") # The message would be what is displayed on the pendant

    The available commands are 
    request_boolean_from_primary_client(msg)
    request_integer_from_primary_client(msg)
    request_float_from_primary_client(msg)
    request_string_from_primary_client(msg)

  • fihcncfihcnc Posts: 8 Apprentice
    Thank you!
Sign In or Register to comment.
Left ArrowBack to discussions page