Secondary program - 17257

SecondaryProgram - How to send a secondary program to controller

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


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)

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)

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.

Want to get notified about updates?

You are welcome to sign up for notifications about new relevant information and articles that could be interesting for you.

Need help?

Did you find what you needed on this site? For additional information please contact one of our distributors.