To use multiple tool center points you need to define these in your main code.
TCP1 = p[-0.00025, -0.20739, 0.13121, 1.3090, 0, 0]
TCP2 = p[-0.00152, 0.00074, 0.27498, 0, 0, 0]
First 3 number are your XYZ and the last 3 are the angels. To get these point you can use the build in function TCP found under installation and general in UR.
Then the switching in between the tcp’s is as easy as using the following code.
set_tcp(TCP1)
or set_tcp(TCP2)
And using a sleep before switching to make sure the robot is not moving.
UR Script Manual PolyScope 5 15.1.47
I Recommend moving to a standard position when changing the tcp where all the joint are in a neutral position, so you dont overextend your joints. Example code of this below.
standardpos = [1.57078,-1.57077,1.57082,-1.57078,-1.57078,0]
TCP1 = p[-0.00025,-0.20739,0.13121,1.3090,0,0]
TCP2 = p[-0.00152,0.00074,0.27498, 0,0,0]
set_tcp(TCP1)
# code using tcp1
MoveJ(standardpos) # make sure this is a MoveJ so you can control the joint rotation* `
sleep(0.5)
set_tcp(TCP2)`
# code using tcp2
MoveJ(standardpos)
In summary
- Define 2 TCP’s using ur’s build in feature
- Switch between them using
set_tcp(var)
and sleep - In between switching tcp’s move to standard position to avoid problems (not
necessary)