Skip to content

Set Custom Script File

SUMMARY

Set Custom Script File configures a .urscript file as the persistent main control script on the robot controller. Unlike Send Custom Script File, which executes a program once, this skill sets the script that the controller will use as its main control program going forward.

Use this skill when deploying a custom URScript control loop as the primary runtime program.

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.set_custom_script_file(file_path="/path/to/control_program.urscript")

The Code

Example: Set a Custom Control Script File

Connect to the robot, set the persistent control script, 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
script_file = "/path/to/control_program.urscript"

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

robot.set_custom_script_file(script_file)
logger.success(f"Custom control script file set to '{script_file}'.")

# Disconnect
robot.disconnect()

The Explanation of the Code

set_custom_script_file sets file_path as the main control script on the robot controller. This is distinct from send_custom_script_file, which executes a program one time. Once set, the controller uses this script as its primary control program. Returns None on completion.

How to Tune the Parameters

ParameterTypeDefaultDescription
file_pathstrAbsolute or relative path to the .urscript file to use as the main control script.

Return Value

TypeDescription
NoneReturns when the script file has been set.

Where to Use the Skill

  • Custom control loops — Deploy a URScript control program as the controller's main runtime
  • Factory applications — Install a production URScript program on startup

When Not to Use the Skill

Do not use Set Custom Script File when: