Skip to content

Get Joint Torques

SUMMARY

Get Joint Torques returns the net torque at each joint after gravity and friction compensation, in N·m, ordered base to wrist. Non-zero values on a stationary robot indicate an externally applied load. Reads from the manipulator state - live values when connected, zero-filled offline.

UNITS

Returns joint torques in N·m, ordered base to wrist.

The Skill

python
joint_torques = robot.get_joint_torques()

The Code

python
"""
Logs the manipulator's live net joint torques.

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

Usage:
    python get_joint_torques.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 joint torques [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"joint_torques [N·m]: {robot.get_joint_torques()}")
    except (ConnectionError, OSError) as e:
        logger.error(f"Error occurred: {e}")
    finally:
        robot.disconnect()
        robot.shutdown()


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Read joint torques 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_joint_torques.py
bash
python get_joint_torques.py --prim_path /World/ur10e
bash
python get_joint_torques.py --ip 192.168.1.100

For all options:

bash
python get_joint_torques.py --help

Parameter Configuration

This skill takes no input parameters.

Returns

TypeDescription
list[float]Net joint torques in N·m, one value per joint, ordered base to wrist. Gravity and friction are compensated. Zero-filled offline.

Raises

get_joint_torques reads from robot.state and does not raise under normal use; the backend simply reports zero-filled torques when it does not provide them.

Where to Use the Skill

  • External load monitoring - Detect contact forces or unexpected loads without a dedicated F/T sensor.
  • Compliant control - Use torque feedback for admittance or impedance control.
  • Collision detection - Trigger a safe stop when a joint torque exceeds a configured threshold.

When Not to Use the Skill

  • You need TCP-frame forces - use Get TCP Force for the wrench at the tool center point.