Universal Robots Forum

URcap from script?


I am sending script code via ethernet to my robot. Can I call a URCap function (Specifically RG2(0) for the OnRobot gripper) from the script?

I have tried:

def myProg():

but that doesnt work.

I have also manually entered a script in polyscope, with only the command “RG2(0)”, and tried to call that script from my own ethernet script. That doesn’t work either.

Any advice?


Hi Søren,

In this case, the RG2(x) function, is a script function, that is defined in the pre-amble of the script from OnRobots URCap.
So when you are “only” running the function, the controller does not know what it means, since the script function is not defined in that scope.
Try to take a look at the script file outputted from a program using this function, to see what is actually contained in its definition.
Then this code, would be what you should substitute the RG2(0) commands with.