Skip to content

Get Robot Mode

SUMMARY

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

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
"""
Logs the controller's high-level robot mode.

Supports Universal Robots (UR).

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 | None) -> None:
    """Log the current robot mode."""

    #===================== Create Robot ==========================================
    robot = universal_robots.UniversalRobotsUR10E(name='UR10e')

    try:
        #===================== Connect Robot ==========================================
        if ip:
            robot.connect(ip=ip)

        # ==================== Run Skill ============================================
        logger.success(f"Robot mode: {robot.get_robot_mode()}")
    except (ConnectionError, OSError) as e:
        logger.error(f"Error occurred: {e}")
    finally:
        robot.disconnect()
        robot.shutdown()


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Read robot mode Synapse example")
    parser.add_argument("--ip", type=str, default=None,
                         help="UR robot IP address for real hardware, e.g. 192.168.1.100")
    args = parser.parse_args()

    main(ip=args.ip)

Running the Example

bash
python get_robot_mode.py --ip 192.168.1.100

For all options:

bash
python get_robot_mode.py --help

Parameter Configuration

This skill takes no input parameters.

Returns

TypeDescription
strCurrent robot mode as a brand-specific integer code, returned as a human-readable string. On Universal Robots the underlying integer maps to "NO_CONTROLLER", "DISCONNECTED", "CONFIRM_SAFETY", "BOOTING", "POWER_OFF", "POWER_ON", "IDLE", "BACKDRIVE", "RUNNING", or "UPDATING_FIRMWARE".

Raises

ExceptionCondition
RuntimeErrorThe robot is not connected. Call connect() before reading the mode.
NotImplementedErrorCalled on a manipulator brand other than Universal Robots, where this getter is not yet implemented.

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: