How to use secondary programs
Here it is shown how secondary programs can be used on Universal Robots.
- 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:
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:
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.
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.
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: