The Primary Interface protocol allows URScript script lines to be sent to the robot for execution.
Script can only be executed if you are connected to port
PrimaryClient (default if not specified) or
You can send multiple script lines simultaneously.
You can also send script within a def function.
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
When the script is received, the program is paused and your script is executed. There is no feedback on whether or not it has been executed.
To avoid stopping the main program, you can send script within a dry block, which defines a secondary program. The secondary program does not interrupt the main script and runs in parallel. However, it does not allow you to move the robot or write global variables.
Read UR documentation : https://www.universal-robots.com/articles/ur/programming/secondary-program/
sec secondaryProgram(): set_digital_out(1, True) end
Script.Send() method of
PrimaryInterfaceClient class is used to send the script to the robot.
// Pause main program and execute scriptrobot.PrimaryInterface.Script.Send("movej([-1.5,-1.5,-2,-0.5,1.8,0],a=1.4, v=1.05, t=0, r=0)");// Send Secondary programrobot.PrimaryInterface.Script.Send(@"sec secondaryProgram():set_digital_out(1, True)end");
Please refer to the Script Manual to see all the functions you can remotely call : Download PDF Script Manual.
You can also send a local urp program file from your machine to the robot via SFTP : read SFTP documentation