Delete TCP
SUMMARY
delete_tcp removes a previously-registered named TCP frame. If the deleted TCP was active, the robot falls back to its default_tcp, pushing the change to the controller when connected.
The Skill
python
robot.delete_tcp(name="new_tool")The Code
0:00 / 0:00
python
"""
Registers a custom TCP frame, then removes it.
Supports Universal Robots (UR), Epson, virtual, and Isaac Sim.
Usage:
python delete_tcp.py [--ip <ROBOT_IP>] [--prim_path <PRIM_PATH>]
"""
import argparse
from loguru import logger
from telekinesis.synapse.robots.manipulators import universal_robots
def main(ip: str | None, prim_path: str | None) -> None:
"""Add and delete a custom TCP, observing the active TCP before and after."""
#===================== Create Robot ==========================================
robot = universal_robots.UniversalRobotsUR10E(name='UR10e')
# ==================== Visualization (Optional) =============================
robot.visualize_rerun(live=True)
try:
#===================== Connect Robot ==========================================
if ip:
robot.connect(ip=ip)
elif prim_path:
robot.connect(simulation_prim_path=prim_path)
robot.set_joint_positions(robot.default_joint_configuration)
# ==================== Run Skill ============================================
new_tcp_pose_in_default_tcp_frame = [0.0, 0.0, 0.1, 0.0, 0.0, 0.0] # 100 mm along Z-axis
robot.add_tcp(name="new_tool",
transform=new_tcp_pose_in_default_tcp_frame,
set_active=True)
logger.info(f"Active TCP after add_tcp(): {robot.active_tcp}"
f" \nActive TCP transform: {robot.get_active_tcp_transform()}"
f" \n TCP pose: {robot.get_cartesian_pose()}")
robot.delete_tcp(name="new_tool")
logger.info(f"Active TCP after delete_tcp(): {robot.active_tcp}"
f" \nActive TCP transform: {robot.get_active_tcp_transform()}"
f" \n TCP pose: {robot.get_cartesian_pose()}")
except (ConnectionError, OSError) as e:
logger.error(f"Error occurred: {e}")
finally:
robot.disconnect()
robot.shutdown()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Add and then delete a custom TCP on the robot.")
parser.add_argument("--ip", type=str, default=None,
help="UR robot IP address for real hardware, e.g. 192.168.1.100")
parser.add_argument("--prim_path", type=str, default=None,
help='Isaac Sim articulation prim path, e.g. "/World/ur10e"')
args = parser.parse_args()
main(ip=args.ip, prim_path=args.prim_path)Running the Example
bash
python delete_tcp.pybash
python delete_tcp.py --prim_path /World/ur10ebash
python delete_tcp.py --ip 192.168.1.100For all options:
bash
python delete_tcp.py --helpParameter Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
name | str | required | Name of the custom TCP frame to remove. Cannot be default_tcp. |
Returns
| Type | Description |
|---|---|
None | delete_tcp removes the TCP as a side effect. Read robot.active_tcp to confirm which TCP is active afterward (it will be default_tcp if the deleted TCP was active). |
Raises
| Exception | Condition |
|---|---|
TypeError | name is not a str |
ValueError | name equals default_tcp, or no TCP named name exists |
ConnectionError / OSError | The connection to the physical controller fails or drops while pushing the fallback active TCP (Universal Robots only) |
Where to Use the Skill
- Tool teardown - Remove a TCP once its associated tool (gripper, sensor, custom end-effector) is permanently removed from the flange.
- Cleaning up temporary frames - Delete TCPs that were registered for a one-off calibration or test, keeping Get TCPs output tidy.
When Not to Use the Skill
- You just need to switch away from a TCP temporarily - use Change Active TCP instead; deleting discards the frame entirely, while switching keeps it registered for later use.
- You want to change the TCP's offset, not remove it - use Update TCP to modify an existing TCP's transform in place.
- You need the TCP's current transform before removing it - read it first with Get TCPs or Forward Kinematics, since it's unavailable once deleted.