Universal Robots Forum

Changing TCP Position programmatically

hey,
I’m trying to make the Robot do a circular path relative to a point (a gripped Object) which is different from the TCP of the robot. I was wondering if it is somehow possible to change the Robots Tcp online so that the MoveP command would move the way i want or if i have to handle the transformation on my side.
thanks

You can use set_tcp() function. Just give your new TCP data as parameter. You can look it up in script manual.

would this have an impact on the performance of the robot since the new tcp is only a virtual one and won’t be in the centre of mass of the actual tool?

Depends if you use this function:

set_payload(m, CoG)

Set payload mass and center of gravity
Alternatively one could use set_payload_mass and
set_payload_cog.

Sets the mass and center of gravity (abbr. CoG) of the payload.
This function must be called, when the payload weight or weight
distribution changes - i.e when the robot picks up or puts down a
heavy workpiece.

The CoG argument is optional - if not provided, the Tool Center Point
(TCP) will be used as the Center of Gravity (CoG). If the CoG argument
is omitted, later calls to set_tcp(pose) will change CoG to the new TCP.
The CoG is specified as a vector, [CoGx, CoGy, CoGz], displacement,
from the toolmount.

Parameters
m: mass in kilograms
CoG: Center of Gravity: [CoGx, CoGy, CoGz] in meters.
Optional.
Example command: set_payload(3., [0,0,.3])
• Example Parameters:
m = 3 → mass is set to 3 kg payload
CoG = [0,0,.3] → Center of Gravity is set to x=0 mm, y=0 mm,
z=300mm from the center of the tool mount in tool
coordinates

To be honest it is a bit complicated, so best if you search the forum and script manual yourself to understand how it works. I wouldn’t want to mix it up.

The TCP is set independently of the CoG and payload, so you shouldn’t have any issues changing the tcp with set_tcp().

If I understand it correctly, if you call set_payload at least once it changes the way set_tcp behaves. Is that right?
If I call set_payload(4), then set_tcp(0,0,0.050) will put CoG at new TCP.

Yes that appears to be what the manual says but I haven’t tested this behavior. I’d recommend always calling set_payload() with a CoG argument to avoid this.

Also note, that there are two new sub-functions to set_payload(m, CoG) which respectively are set_payload_mass(m) and set_payload_cog(cog) that you could use, to avoid the confusion.