Sending TCP position through socket and URscripts

Hi All !

I have a UR5e and I want to control it via a C# application. I know already that I need to use socket communication via port 30000.
I also know that I need to have a special UR script running on the controller to interpret the socket commands.

My goal is to send directly the TCP coordinates to the controller and get the TCP position afterward.
However I haven’t found any useful documentation on how to send directly the TCP position to the controller (p[X, Y, Z, Rx, Ry, Rz])… and to get TCP coordinate.

Do I have to create my own UR script ? if yes, how ?

I’m sorry if it is an already asked question or obvious question… I’m very new to UR robot and still trying to figure out how Polyscope and scripts are working…

Perhaps a sample UR program would help.

Hi Pho,

Thank you for the example. So if I understand the x, y, rx values in your example are the TCP position, correct ?
If I want to send all translation and rotation, I need to increase the number of variable to 6, correct ?

But after receiving the data and having put them in a variable, how do I get the robot to move to this position ?

Hi Emmanuel,

movel(pose, a=1.2, v=0.25, t=0, r=0) or movej(q, a=1.4, v=1.05, t=0, r=0) where q can be a pose. (see script manual for detaild information.

pose is a variable, variable= P[x,y,z,rx,ry,rz]

so in this example you could insert eg: movel(P[x,y,0,0,0,rz], a=1.2, v=0.25, t=0, r=0) for the cobot to move to that location

or what i like is
var1 = P[x,y,0,0,0,rz]
movel( var1, a=1.2, v=0.25, t=0, r=0)

Corné

one slight correction

var1 = p[x,y,z,rx,ry,rz]

Hi Corné,

Thank you for the explanation, I understand better how it works !
So the variable= P[x,y,z,rx,ry,rz] refers to TCP coordinates, right ?
And a pose is a point coordinate in space alone, or along a path, right ?

sorry to ask, but I cannot find any confirmation about it…

I thougt var1 = P[x,y,0,0,0,rz] because z,Rx and Ry aren’t given in the example. so it would occur in an error where z,Rx and Ry are not defined. :see_no_evil: but indeed it is better to define z,Rx and Ry :innocent:

almost, P[x,y,z,rx,ry,rz] is a pose in base coördinates and you tell the cobot to move the tcp to that location(x,y,z) and in that oriantation (Rx,Ry and Rz are the rotation). to create a path you need to move from pose 1 to pose 2.

take al look in this thread: Robot theory and how to use it in UR robots

Corné

Super !

Thank you both for the explanations, it is clear for me now !

Take care guys,

Emmanuel

2 Likes