Skip to content

Get Safety Mode

SUMMARY

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

SUPPORTED ROBOTS

Currently supported only on Universal Robots.

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
"""
Read safety mode example for the Synapse SDK.

Returns the controller's safety mode (e.g. ``"NORMAL"``, ``"REDUCED"``,
``"PROTECTIVE_STOP"``, ``"SAFEGUARD_STOP"``).

Currently supported only for Universal Robots (UR10e).

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

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

    try:
        logger.success(f"Safety mode: {robot.get_safety_mode()}")
    finally:
        robot.disconnect()


if __name__ == "__main__":
    parser = argparse.ArgumentParser(description="Read safety 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_safety_mode reads the safety_mode field from the data stream. On Universal Robots the code maps to: 1 = NORMAL, 2 = REDUCED, 3 = PROTECTIVE_STOP, 4 = RECOVERY, 5 = SAFEGUARD_STOP, 6 = SYSTEM_EMERGENCY_STOP, 7 = ROBOT_EMERGENCY_STOP, 8 = VIOLATION, 9 = FAULT.

How to Tune the Parameters

This skill takes no input parameters.

Return Value

TypeDescription
strCurrent safety mode as a brand-specific integer code.

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: