Skip to content

Get Robot Mode

SUMMARY

Get Robot Mode returns the current operating mode of the robot as a brand-specific integer code.

SUPPORTED ROBOTS

Currently supported only on Universal Robots.

UNITS

Returns a string code, e.g. "RUNNING", "IDLE".

The Skill

python
mode = robot.get_robot_mode()

The Code

Example: Read and Log Robot Mode

Connect to the robot and read its current mode.

python
"""
Read robot mode example for the Synapse SDK.

Returns the controller's high-level robot mode (e.g. ``"RUNNING"``,
``"IDLE"``, ``"POWER_OFF"``).

Currently supported only for Universal Robots (UR10e).

Usage:
    python get_robot_mode.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 robot mode."""

    # Create and connect to the robot
    robot = universal_robots.UniversalRobotsUR10E()
    robot.connect(ip=ip)

    try:
        logger.success(f"Robot mode: {robot.get_robot_mode()}")
    finally:
        robot.disconnect()


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Read robot mode 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_robot_mode reads the robot_mode field from the controller's data stream. On Universal Robots, the integer maps to a documented mode table (e.g., 7 = RUNNING, 5 = IDLE, 0 = DISCONNECTED).

How to Tune the Parameters

This skill takes no input parameters.

Return Value

TypeDescription
strCurrent robot mode as a brand-specific integer code (returned as a string).

Where to Use the Skill

  • Pre-motion checks - Verify the robot is in RUNNING mode before commanding motion
  • Diagnostics - Log the mode when diagnosing unexpected stops or state transitions
  • Conditional logic - Branch program flow based on the current robot mode

When Not to Use the Skill

Do not use Get Robot Mode when: