Skip to content

Send Custom Script

SUMMARY

Send Custom Script transmits an inline URScript program string directly to the robot controller over the RTDE control channel.

Use this skill to inject small, one-off URScript snippets — such as log messages, variable assignments, or lightweight test routines — without creating a separate script file.

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.send_custom_script(script='textmsg("hello")\n')

The Code

Example: Send an Inline URScript Message

Connect to the robot, send a single-line URScript string, and disconnect.

python
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)

script = 'textmsg("hello from custom script")\n'
robot.send_custom_script(script)
logger.success("Custom script sent to robot.")

# Disconnect
robot.disconnect()

The Explanation of the Code

send_custom_script passes a URScript program string directly to the robot controller. The string must be a valid URScript program — each statement should be terminated with a newline character (\n). The controller executes the script asynchronously; the call returns True on success. Use this for lightweight inline programs or diagnostic snippets that do not warrant a standalone .urscript file.

How to Tune the Parameters

ParameterTypeDefaultDescription
scriptstrA valid URScript program string. Each statement must end with \n.

Return Value

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

Where to Use the Skill

  • Lightweight test routines — Inject short URScript snippets during development without writing files
  • Diagnostic messages — Use textmsg() to log values to the PolyScope log
  • One-off variable assignments — Set global URScript variables from Python

When Not to Use the Skill

Do not use Send Custom Script when: