How to use two kinds of popups (Universal Robots)

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 pressed

Example 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.:smile:

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:

:grinning: U+1F600
:smiley: U+1F603
:smile: U+1F604
:grin: U+1F601
:sweat_smile: U+1F605
:laughing: U+1F606
:joy: U+1F602
:wink: U+1F609
:blush: U+1F60A
:innocent: U+1F607
:sunglasses: U+1F60E
:heart_eyes: U+1F60D
:heart_eyes: U+1F60D
:kissing_heart: U+1F618
:kissing: U+1F617
:smiling_face: U+263A
:kissing_closed_eyes: U+1F61A
:kissing_smiling_eyes: U+1F619
:yum: U+1F60B
:stuck_out_tongue: U+1F61B
:stuck_out_tongue_winking_eye: U+1F61C
:stuck_out_tongue_closed_eyes: U+1F61D
:neutral_face: U+1F610
:expressionless: U+1F611
:no_mouth: U+1F636
:smirk: U+1F60F
:unamused: U+1F612
:sleepy: U+1F62A
:sleeping: U+1F634
:relieved: U+1F60C
:pensive: U+1F614
:mask: U+1F637
:dizzy_face: U+1F635
:confused: U+1F615
:worried: U+1F61F
:frowning: U+2639
:open_mouth: U+1F62E
:hushed: U+1F62F
:astonished: U+1F632
:flushed: U+1F633
:frowning_with_open_mouth: U+1F626
:anguished: U+1F627
:fearful: U+1F628
:cold_sweat: U+1F630
:disappointed_relieved: U+1F625
:cry: U+1F622
:sob: U+1F62D
:scream: U+1F631
:confounded: U+1F616
:persevere: U+1F623
:disappointed: U+1F61E
:sweat: U+1F613
:weary: U+1F629
:tired_face: U+1F62B
:rage: U+1F621
:angry: U+1F620
:smiling_imp: U+1F608
:skull_and_crossbones: U+2620
:smiley_cat: U+1F63A
:smile_cat: U+1F638
:joy_cat: U+1F639
:heart_eyes_cat: U+1F63B
:smirk_cat: U+1F63C
:kissing_cat: U+1F63D
:scream_cat: U+1F640
:crying_cat_face: U+1F63F
:pouting_cat: U+1F63E
:heavy_heart_exclamation: U+2763
:heart: U+2764
:v: U+270C
:point_up: U+261D
:writing_hand: U+270D
:monkey_face: U+1F435
:cat: U+1F431
:cow: U+1F42E
:mouse: U+1F42D
:shamrock: U+2618
:coffee: U+2615

2 Likes

Love the bonus :slight_smile:

Great info! Thanks for sharing!