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.
SUPPORTED ROBOTS
Currently supported only on Universal Robots.
UNITS
Returns a string code (no units), e.g. "PLAYING", "STOPPED", "PAUSED".
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
"""
Read runtime state example for the Synapse SDK.
Returns the controller's program runtime state (e.g. ``"PLAYING"``,
``"PAUSED"``, ``"STOPPED"``).
Currently supported only for Universal Robots (UR10e).
Usage:
python get_runtime_state.py --ip <ROBOT_IP>
"""
import argparse
from loguru import logger
from telekinesis.synapse.robots.manipulators import universal_robots
def main(ip: str):
"""Log the current runtime state."""
# Create and connect to the robot
robot = universal_robots.UniversalRobotsUR10E()
robot.connect(ip=ip)
try:
logger.success(f"Runtime state: {robot.get_runtime_state()}")
finally:
robot.disconnect()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Read runtime state Synapse example")
parser.add_argument("--ip", type=str, required=True, help="UR robot IP address")
args = parser.parse_args()
main(ip=args.ip)The Explanation of the Code
get_runtime_state reads the runtime_state field from the data stream. On Universal Robots the code maps to: 0 = STOPPING, 1 = STOPPED, 2 = PLAYING, 3 = PAUSING, 4 = PAUSED, 5 = RESUMING.
How to Tune the Parameters
This skill takes no input parameters.
Return Value
| Type | Description |
|---|---|
str | Current 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:
- You only need a boolean - use Is Program Running for a simple
True/Falseanswer

