How to define and switch between multiple TCPs on a UR robot

Based on contributions by Sem.db.

If one end-effector has more than one working point (e.g. two different tool tips, or a tool used in two orientations), define multiple tool center points (TCPs) and switch between them in your program instead of using a single fixed TCP.

What you need

  • A Universal Robot with PolyScope (script manual reference: PolyScope 5, §15.1.47 set_tcp).
  • Each TCP already defined using the built-in TCP configuration tool: Installation → General → TCP.

Steps

1. Define each TCP

Use the built-in TCP tool under Installation → General → TCP to find the pose of each tool point. A TCP pose has the format p[x, y, z, rx, ry, rz]: the first three values are the XYZ offset in meters, the last three are the rotation (axis-angle) in radians.

TCP1 = p[-0.00025, -0.20739, 0.13121, 1.3090, 0, 0]
TCP2 = p[-0.00152,  0.00074, 0.27498, 0,      0, 0]

2. Switch the active TCP with set_tcp()

set_tcp(TCP1)
# ... code using TCP1 ...

set_tcp(TCP2)
# ... code using TCP2 ...

Add a short sleep() before switching TCPs to make sure the robot isn’t moving when the change takes effect.

3. (Recommended) Move to a neutral position before switching

Switching TCP effectively changes where the tool point is and how it’s oriented. If you switch while the joints are in an extreme position, the new TCP’s motion can overextend a joint. Move to a neutral, standard joint position first:

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)   # go to a neutral joint position before switching TCP
sleep(0.5)
set_tcp(TCP2)
# ... code using TCP2 ...

movej(standardpos)

This step is not strictly necessary, but it avoids joint-limit problems when the two TCPs have very different orientations.

Common mistakes

  • Switching TCP while the robot is still moving — always add a sleep() before set_tcp().
  • Using movel instead of movej for the move to the neutral position — movej gives you direct control over joint rotation, which is what you want when recovering from an extreme pose.
  • Forgetting that set_tcp() changes are stateful: any motion command after set_tcp() uses the new TCP until you switch again.

Related


Rewritten and consolidated (Sept 2026) from the original student how-to’s: How to use multiple tool center points on a UR robot.