Skip to content

Get TCP Force

SUMMARY

Get TCP Force returns the TCP wrench [Fx, Fy, Fz, Tx, Ty, Tz] - forces in N, torques in N·m, expressed in the robot base frame.

Reads from the manipulator state - live values when connected, zero-filled offline.

UNITS

Returns TCP wrench [Fx, Fy, Fz, Tx, Ty, Tz] - forces in N, torques in N·m.

The Skill

python
tcp_force = robot.get_tcp_force()

The Code

python
"""
Logs the live generalized force/torque at the TCP.

Supports Universal Robots (UR), Epson, virtual, and Isaac Sim.

Usage:
    python get_tcp_force.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:
    """Log the live TCP force/torque [N, N·m]."""

    #===================== Create Robot ==========================================
    robot = universal_robots.UniversalRobotsUR10E(name='UR10e')

    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 ============================================
        logger.success(f"tcp_force [N, N·m]: {robot.get_tcp_force()}")
    except (ConnectionError, OSError) as e:
        logger.error(f"Error occurred: {e}")
    finally:
        robot.disconnect()
        robot.shutdown()


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Read TCP force Synapse example")
    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 get_tcp_force.py
bash
python get_tcp_force.py --prim_path /World/ur10e
bash
python get_tcp_force.py --ip 192.168.1.100

For all options:

bash
python get_tcp_force.py --help

Parameter Configuration

This skill takes no input parameters.

Returns

TypeDescription
list[float]TCP wrench [Fx, Fy, Fz, Tx, Ty, Tz]. Forces in N, torques in N·m, expressed in the robot base frame. Payload-compensated on supported controllers. Zero-filled offline.

Where to Use the Skill

  • Contact detection - Detect unexpected contact by monitoring force magnitude.
  • Compliant control - Use force feedback for admittance or hybrid force-position control.
  • Assembly verification - Confirm insertion force profile matches expected values.

When Not to Use the Skill