Articles Download Safety & Security Forum myUR Go to Main Site

Universal Robots A/S
Energivej 51
DK-5260 Odense S

T: +45 8993 8989
sales@universal-robots.com

 
  • Articles
  • Download
  • Safety & Security
  • Forum
  • myUR
  • Go to Main Site
  • Support
  • Articles
  • Secondary program

Secondary program

How to send a secondary program to controller

Last modified on Jan 29, 2025

How to use secondary programs

Here it is shown how secondary programs can be used on Universal Robots.

What is a secondary program?

  • A secondary program is like a normal script program that can be sent to the Universal Robots controller via a TCP/IP connection to port 30002
  • A secondary program can be executed while the controller is executing a primary program (which e.g. moves the robot between waypoints)
  • A secondary program must follow the same script syntax as normal robot programs
  • A secondary program must be defined using the keyword "sec"
  • A secondary program may not take any physical time to execute

Example

Imagine the controller is executing this primary program:

def primaryProgram():
  while (True):
    movej([0.9434381127910002, -1.3082063255028469, 2.2063341418137945, -2.6507188134210273, -1.081363649387086, 4.80585136204575], a=1.3962634015954636, v=1.0471975511965976)
    movej([0.9433155477260482, -1.014172108307441, 2.246293286726412, -2.9852336083709154, -1.0813798520591593, 4.805802742045307], a=1.3962634015954636, v=1.0471975511965976)
  end
end

It is then possible to send this secondary program to the controller while the robot continues to move between the two waypoints in the primary program:

sec secondaryProgram():
  set_digital_out(1, True)
end

Since the example secondary program does not use any physical time to execute, the controller will handle turning digital output 1 on while still executing the primary program.

Interpreter Mode

If there is a need for physical time during execution, please consider the interpreter mode. Alternatively, there is an option to make use of the incognito program functionality.

Incognito Program

An incognito program is a program similar to a primary program. But it does not add a start/stop message to the log. In addition it does not change the state of the play/pause button in Polyscope. The incognito program is created just by naming the program “inkognito” please notice the spelling.

It is strongly recommended not to have any “global” variables in an incognito program. If they are added the variable list will be cleared when they are initialized in the program. An example is showed below:

def inkognito():
  sleep(2)
  set_digital_out(1, True)
end

logo

Product

  • UR3e Robot
  • UR5e Robot
  • UR10e Robot
  • UR16e Robot
  • UR20 Robot
  • UR+ Products

Company

  • About us
  • Contact us
  • Careers We're hiring
  • UR merchandise

Training / Resources

  • Academy
  • Technical Resources
  • Articles
  • FAQ

Insights

  • Blog
  • Case stories
  • Content library
  • News centre
  • Podcast
  • Webinars & Events

Get in touch

  • Ask an Expert
  • Schedule a no-cost assessment
  • Find a distributor
  • Customer support

Connect with us

  • LinkedIn
  • Facebook
  • Twitter
  • YouTube
  • Instagram
  • Universal Robots A/S
  • Energivej 51
  • DK-5260 Odense S
  • T: +45 89 93 89 89
  • sales@universal-robots.com
  • US Corporate Office
  • 27-43 Wormwood St.
  • 02210 Boston, MA.
  • +1-844-GO-COBOT
  • ur.na@universal-robots.com
  • Copyright @ Universal Robots 2025
  • Cookie policy
  • Privacy policy
  • Universal Robots A/S
  • Energivej 51
  • DK-5260 Odense S
  • T: +45 89 93 89 89
  • sales@universal-robots.com
  • US Corporate Office
  • 27-43 Wormwood St.
  • 02210 Boston, MA.
  • +1-844-GO-COBOT
  • ur.na@universal-robots.com

Copyright © Universal Robots 2025

Cookie policy
Privacy policy