Skip to content

Servo Cartesian

SUMMARY

Servo Cartesian streams a target TCP pose to the robot controller at high frequency. It is designed to be called repeatedly in a tight loop for real-time Cartesian teleoperation or custom trajectory streaming.

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.servo_cartesian(
    pose=target_pose,
    speed=0.1,
    acceleration=0.5,
    time=0.002,
    lookahead_time=0.1,
    gain=300,
)

The Code

Example: Servo Cartesian in a High-Frequency Control Loop

Hold the current TCP pose and stream it at 500 Hz for 1 second.

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)

pose_target = robot.get_cartesian_pose()
dt = 0.002
duration = 1.0
t_start = time.perf_counter()

while time.perf_counter() - t_start < duration:
    robot.servo_cartesian(
        pose=pose_target,
        speed=0.1,
        acceleration=0.5,
        time=dt,
        lookahead_time=0.1,
        gain=300,
    )
    time.sleep(dt)

robot.servo_stop()
logger.success("Servo Cartesian loop complete.")

# Disconnect
robot.disconnect()

The Explanation of the Code

servo_cartesian streams a TCP pose target to the controller. pose is [x, y, z, rx, ry, rz] in meters and degrees. speed is in m/s, acceleration in m/s². time overrides speed if non-zero. lookahead_time (range [0.03, 0.2] s) smooths the trajectory. gain (range [100, 2000]) sets the proportional gain. Always call servo_stop() after the loop exits.

How to Tune the Parameters

ParameterTypeDefaultDescription
poselist[float]Target TCP pose [x, y, z, rx, ry, rz]. Position in meters, orientation in degrees.
speedfloatTCP linear speed in m/s.
accelerationfloatTCP linear acceleration in m/s².
timefloatCommand execution time in seconds. Overrides speed if non-zero.
lookahead_timefloatSmoothing horizon in seconds, range [0.03, 0.2].
gainfloatProportional gain, range [100, 2000].

Return Value

ValueDescription
NoneThis skill returns nothing.

Where to Use the Skill

  • Real-time Cartesian teleoperation.
  • Streaming poses from a motion planner or human input device at high frequency.

When Not to Use the Skill

Use a different skill instead in these cases: