Skip to content

Get Safety Mode

SUMMARY

Get Safety Mode returns the current safety state of the robot as a brand-specific integer code.

UNITS

Returns a string code (no units), e.g. "NORMAL", "REDUCED", "PROTECTIVE_STOP".

The Skill

python
safety_mode = robot.get_safety_mode()

The Code

Example: Read and Log Safety Mode

Connect to the robot and read its current safety mode.

python
"""
Logs the controller's safety mode.

Supports Universal Robots (UR).

Usage:
    python get_safety_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 safety mode."""

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

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

        # ==================== Run Skill ============================================
        logger.success(f"Safety mode: {robot.get_safety_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 safety 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_safety_mode.py --ip 192.168.1.100

For all options:

bash
python get_safety_mode.py --help

Parameter Configuration

This skill takes no input parameters.

Returns

TypeDescription
strCurrent safety mode as a brand-specific integer code, returned as a human-readable string. On Universal Robots the underlying integer maps to "NORMAL", "REDUCED", "PROTECTIVE_STOP", "RECOVERY", "SAFEGUARD_STOP", "SYSTEM_EMERGENCY_STOP", "ROBOT_EMERGENCY_STOP", "EMERGENCY_STOP", "VIOLATION", "FAULT", or "STOPPED_DUE_TO_SAFETY".

Raises

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

Where to Use the Skill

  • Pre-motion safety checks - Confirm the robot is in NORMAL mode before issuing motion commands
  • Fault detection - Poll the safety mode to detect and react to protective stops
  • Operator dashboards - Surface the safety state in monitoring UIs

When Not to Use the Skill

Do not use Get Safety Mode when: