How to use two kinds of popups (Universal Robots)
1. Introduction
This guide will help you choose the right type of popup to display on the Universal Robots teaching pendant, and format it to bring accross the right message.
There are two kinds of popups available to display messages on the universal robots teaching pendant depending on your case and software version
Examples in this guide are made on e-Series 5.16
2. Which popup do I use
2.1. Standard popup
The standard popup for user intervention. (As described in the URS cript manual)
Link to UR’s article: Create a popup 15431 - UR Support
Availability (software version)
CB2 Software version: 1.8.16941
CB3 Software version: 3.1.17779
e-Series Software version: All versions
*Blocking is supported since CB 3.14.x.x
Pro’s and cons
+ Multiple styles (Info, Warning, error)
+ User decides whether process is suspended or not
- User might accidentally press ‘stop program’
- Other on-screen buttons cannot be pressed until the popup has been closed
2.2. Informative popup
The more difficult informative popup that does not intervene.
Link to UR’s article: Create informational popups in run screen 15382 - UR Support
Availability (software version)
CB2 Software version: 1.8.1694
CB3 Software version: 3.1.17779
e-Series Software version: All versions
Pro’s and cons
+ User cannot interfere with the process
- Can only be formatted as informational
- Other on-screen buttons cannot be pressed until the popup has been closed
3. How to create popups
3.1. Create a standard popup
The standard popup can be created on-screen by including the popup()
function in your code. The usage differs between software versions and can be found in the script manual for your version.
15.1.32. popup(s, title=’Popup’, warning=False, error=False, blocking=False)
Display popup on GUI
Display message in popup window on GUI.Parameters
s
: message string
title
: title string
warning
: warning message?
error
: error message?
blocking
: if True, program will be suspended until “continue” is pressedExample command: popup(“here I am”, title=“Popup #1”,blocking=True)
• Example Parameters:
• s popup text is “here I am”
• title popup title is “Popup #1”
• blocking* = true → popup must be cleared before other actions will be performed.
Source: UR script manual 5.16:
3.2. Create an informative popup
The informative popup takes a bit more code to set up, they are created by communicating with the internal Dashboard server of the UR Controller. The following script explains the process.
# intialize connection to dashboard server for popups
socket_open("127.0.0.1",29999,"internal")
# "127.0.0.1" = internal dashboard IP
# 29999 = port
# "internal" = portname
# Create a popup using this script:
socket_send_string("popup The text I want","internal")
socket_send_byte(10,"internal")
# string: “The text I want” = the message to be displayed,
# byte: 10 = necessary “return” character.
# Kill the popup using these script lines:
socket_send_string("close popup","internal")
socket_send_byte(10,"internal")
When you often need popups, it might be useful to define a function. This example always formats text input text as a header:
# kill current on-screen msg (if it exists) and show a new one
def newmsg(text):
# Close existing popup
socket_send_string("close popup","internal")
socket_send_byte(10,"internal")
# concat and create new popup
text = str_cat("popup <h1>",text)
text = str_cat(text, "</h1>")
socket_send_string(text,"internal")
socket_send_byte(10,"internal")
end
4. How to format popups using HTML
Both methods support basic HTML formatting. For an extensive explanation on HTML go see: HTML Tutorial. URScript at least supports semantics, formatting, styles and some emojis to spice things up.
Concatenation
Depending on your case, concatenation using str_cat("a","b")
might be useful to include variables in a message. This function concatenates just two variables as strings, but they can be stacked like this:
newmsg(str_cat(str_cat(
"Replace tube <br><br> kitlevel = ", kit_percentage), "%")
)
Emojis
As a bonus to this article. These are some emojis from the utf-8 char set that I’ve brute force checked for polyscope compatibility:
U+1F600
U+1F603
U+1F604
U+1F601
U+1F605
U+1F606
U+1F602
U+1F609
U+1F60A
U+1F607
U+1F60E
U+1F60D
U+1F60D
U+1F618
U+1F617
U+263A
U+1F61A
U+1F619
U+1F60B
U+1F61B
U+1F61C
U+1F61D
U+1F610
U+1F611
U+1F636
U+1F60F
U+1F612
U+1F62A
U+1F634
U+1F60C
U+1F614
U+1F637
U+1F635
U+1F615
U+1F61F
U+2639
U+1F62E
U+1F62F
U+1F632
U+1F633
U+1F626
U+1F627
U+1F628
U+1F630
U+1F625
U+1F622
U+1F62D
U+1F631
U+1F616
U+1F623
U+1F61E
U+1F613
U+1F629
U+1F62B
U+1F621
U+1F620
U+1F608
U+2620
U+1F63A
U+1F638
U+1F639
U+1F63B
U+1F63C
U+1F63D
U+1F640
U+1F63F
U+1F63E
U+2763
U+2764
U+270C
U+261D
U+270D
U+1F435
U+1F431
U+1F42E
U+1F42D
U+2618
U+2615