Skip to content

Get Runtime State

SUMMARY

Get Runtime State returns the current execution state of the program running on the robot controller as a brand-specific code.

On Universal Robots, this corresponds to the RTDE runtime_state field (e.g. 2 = playing, 1 = stopped).

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
runtime_state = robot.get_runtime_state()

The Code

Example: Read and Log Runtime State

Connect to the robot and read its current runtime state.

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)

runtime_state = robot.get_runtime_state()
logger.success(f"Runtime state: {runtime_state}")

# Disconnect
robot.disconnect()

The Explanation of the Code

get_runtime_state reads the runtime_state field from the RTDE data stream. On Universal Robots the code maps to: 0 = STOPPING, 1 = STOPPED, 2 = PLAYING, 3 = PAUSING, 4 = PAUSED, 5 = RESUMING. Consult the UR RTDE Interface documentation for the full table.

How to Tune the Parameters

This skill takes no input parameters.

Return Value

TypeDescription
strCurrent program runtime state as a brand-specific code.

Where to Use the Skill

  • Program flow control — Check whether a controller program is running before issuing Python-side commands
  • State synchronization — Wait for the runtime state to reach STOPPED before reconnecting or restarting
  • Diagnostics — Log the runtime state alongside other telemetry during automated test runs

When Not to Use the Skill

Do not use Get Runtime State when: