UR Script: Popup Messages

Also checkout the new CB3 forum

Popup messages send via Script from a PC.

The UR script manual mention this syntax.

universal-robots-zacobria-script_popup_messages-1

But as “ (apostrophe) is a protected character in Python  – then it is neseccary to insert in \ from of “ in order to actually send the “ when using Python.

Python program running on PC.

# Echo client program
import socket
import time

HOST = “192.168.0.9″    # The remote host
PORT = 30002              # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.send (“set_digital_out(2,True)” + “\n”)
time.sleep (1)

s.send (“popup(\”Messages\”, title=\”The Headline in the Blue box\”, blocking=True)” + “\n”)
time.sleep (1)

s.send (“set_digital_out(2,False)” + “\n”)
time.sleep (1)

data = s.recv(1024)

print “Good bye!”
Provides this result on the Robot.

universal-robots-zacobria-script_popup_messages-2

# Echo client program
import socket
import time

HOST = “192.168.0.9″    # The remote host
PORT = 30002              # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.send (“set_digital_out(2,True)” + “\n”)
time.sleep (1)

s.send (“popup(\”Messages\”, title=\”The Headline in the Blue box\”, warning=True, error=False)” + “\n”)
time.sleep (1)

s.send (“set_digital_out(2,False)” + “\n”)
time.sleep (1)

data = s.recv(1024)

print “Good bye!”
Provides this result on the Robot.

universal-robots-zacobria-script_popup_messages-3

# Echo client program
import socket
import time

HOST = “192.168.0.9″    # The remote host
PORT = 30002              # The same port as used by the server
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.send (“set_digital_out(2,True)” + “\n”)
time.sleep (1)

s.send (“popup(\”Messages\”, title=\”The Headline in the Blue box\”, warning=False, error=True)” + “\n”)
time.sleep (1)

s.send (“set_digital_out(2,False)” + “\n”)
time.sleep (1)

data = s.recv(1024)

print “Good bye!”
Provides this result on the Robot.

universal-robots-zacobria-script_popup_messages-4

Disclaimer: While the Zacobria Pte. Ltd. believes that information and guidance provided is correct, parties must rely upon their skill and judgement when making use of them. Zacobria Pte. Ltd. assumes no liability for loss or damage caused by error or omission, whether such an error or omission is the result of negligence or any other cause. Where reference is made to legislation it is not to be considered as legal advice. Any and all such liability is disclaimed.

If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.

Author:
By Zacobria Lars Skovsgaard
Accredited Universal Robots support Centre and Forum.

Also check out the CB3 forum



9 thoughts on “UR Script: Popup Messages

  1. tali

    Hi,
    I’m running two programs in parallel,
    1. Read full state message from 30001
    2. Send a small program:
    textmsg(“starting”)
    textmsg(“ending”)
    via port 30003.
    I can see the “ending” on the screen, but I never get “ROBOT_MESSAGE” package in the first program.
    (I get cartezian info, robot_mode_data and other packages)
    Why is that?
    Thanks.

    Reply
    1. zacopressadmin Post author

      Hi tali

      Thanks for the question.

      If you only run the first program to read from port 30001 – do you then get the message ?

      Author:
      By Zacobria Lars Skovsgaard
      Accredited Universal Robots support Centre and Forum.

      Also check out the CB3 forum



      Reply
      1. tali

        Hi,
        Although I fixed my mistake, I still don’t see all the debug messages I sent.
        I sent the program:

        $ 1 “messaging starting”
        textmsg(“starting)
        $ 2 “messaging ending”
        textmsg(“ending”)

        In polyscope I see

        Program textmsg started
        ending
        Program textmsg stopped

        In my program I sometimes get the same, sometimes only “ending”

        If I remove the textmsgs from the program, , then I get the label messages.

        Is there a way to use the lables or the textmsgs in order to debug a program? It seems that only part of the debug messages are sent by the controller.

        Reply
  2. GANESH P

    Hi Lars,
    Thanks for your valuable suggestions,here in the below program i am getting the following error in this line Receive_Data = socket_read_ascii_float(6) and the error is function did not find a solution.

    Init Variable
    Robot Program
    Move_To_Pos = Move_To_Pos
    Receive_Data = Receive_Data
    Point = Point
    socket_open(“192.169.100.101″, 30000)
    socket_send _string(“UR10″)
    wait:2.0
    Receive_Data = socket_read_ascii_float(6)
    wait:3.0
    Loop 6 times
    Move_To_Pos[Point] = Receive_Data[Point]
    Point = Point+1
    movej(Move_To_Pos)

    Thanks in Advance

    Regards
    GANESH P

    Reply
    1. zacopressadmin Post author

      Hi Ganesh

      There are two things that come to my mind.

      1.
      Are the format of the data you are sending from the host as six floats ?

      2.
      I assume you are trying to send cartisian cordinates as data for the robot to move. If the current position and the data for the next position involves a move the robot cannot do or if the data is an invalid pose then the robot cannot move. You can verify if the data is valid by inserting them to the pose editor in the GUI and see if the robot can move there. Also if the positions are far away from each other then you can considder to have more positions in between.

      Author:
      By Zacobria Lars Skovsgaard
      Authorised Universal-Robots Support Forum.

      Reply
  3. Jake Konrad

    Thank you for the response. Using the assignment works the only problem is a user can still cancel the program operation if they are not paying attention but I guess that is just something that will have to be dealt with if it happens.

    Thanks,
    Jake

    Reply
  4. Jake Konrad

    I was wondering if there is a way to create a third button on the popup to do a task other than continue or stop program?

    Thanks

    Reply
    1. zacopressadmin Post author

      Hi Jake

      Thanks for your question.

      You might consider to use the ”Assignment” of variable and choose ”Operator” input and then make the logic in your program react to the user input.

      Regards
      Lars

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>