Skip to content

Direct Torque

SUMMARY

Direct Torque sends joint torque commands directly to the robot controller at each control cycle. This skill enables torque-level control of the robot, bypassing the position and velocity controllers.

It must be called at the controller's cycle rate (typically 500 Hz) to maintain stable control. Use Get Step Time to retrieve the control cycle period.

SUPPORTED ROBOTS

This skill is currently supported on Universal Robots only. Calling this method on other robot brands will raise a NotImplementedError.

The Skill

python
robot.direct_torque(torques=[0.0, 0.0, 0.0, 0.0, 0.0, 0.0], friction_comp=True)

The Code

Example: Send Zero Torques for 10 Control Steps

Retrieve the step time and send zero torques for 10 control cycles.

python
import time
from loguru import logger
from telekinesis.synapse.robots.manipulators import universal_robots

robot_ip = "192.168.1.2"  # replace with your robot's IP

robot = universal_robots.UniversalRobotsUR10E()
# Connect
robot.connect(ip=robot_ip)

dt = robot.get_step_time()

zero_torques = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
for _ in range(10):
    robot.direct_torque(zero_torques)
    time.sleep(dt)

logger.success("Sent 10 direct torque commands.")

# Disconnect
robot.disconnect()

The Explanation of the Code

direct_torque sends a 6-element torque vector directly to the joint controllers for the current control cycle. When friction_comp=True (default), the controller adds friction compensation to the commanded torques. This skill must be called at every control step — missing a step during torque control may cause unexpected motion. Use get_step_time() to determine the correct sleep interval between calls. Returns True on success.

How to Tune the Parameters

ParameterTypeDefaultDescription
torqueslist[float]6-element joint torque vector [t1…t6] [Nm].
friction_compboolTrueIf True, the controller adds friction compensation on top of the commanded torques.

Return Value

TypeDescription
boolTrue if the torque command was accepted by the controller, False otherwise.

Where to Use the Skill

  • Impedance control — Implement custom impedance or admittance controllers at the torque level
  • Gravity compensation experiments — Feed custom torque profiles and observe robot response
  • Research and advanced control — Any application requiring direct access to the joint torque commands

When Not to Use the Skill

Do not use Direct Torque when:

  • Standard position or velocity control is sufficient — use Set Joint Positions or Speed Joint instead
  • You cannot maintain the required call rate — torque control requires a stable high-frequency loop; instability at the commanded rate will cause erratic motion