Get Safety Status Bits
SUMMARY
Get Safety Status Bits returns the current safety system state as a packed integer bitmask. Each bit corresponds to a specific safety state. Use bitwise operations to check individual safety conditions.
This is the most granular way to inspect the safety system state programmatically, giving more detail than the higher-level Get Safety Mode skill.
UNITS
Returns an integer bitmask (no units). Each bit encodes a safety flag - see the bit layout in the explanation.
The Skill
bits = robot.get_safety_status_bits()The Code
Example: Read and Decode the Safety Status Bitmask
Connect to the robot, read the safety status bits, and log them.
"""
Logs the controller's raw safety status bitmask.
Supports Universal Robots (UR).
Usage:
python get_safety_status_bits.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 raw safety status bitmask."""
#===================== Create Robot ==========================================
robot = universal_robots.UniversalRobotsUR10E(name='UR10e')
try:
#===================== Connect Robot ==========================================
if ip:
robot.connect(ip=ip)
# ==================== Run Skill ============================================
logger.success(f"safety_status_bits: {robot.get_safety_status_bits():#013b}")
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 status bits 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
python get_safety_status_bits.py --ip 192.168.1.100For all options:
python get_safety_status_bits.py --helpParameter Configuration
This skill takes no input parameters.
Returns
| Type | Description |
|---|---|
int | Safety system status bitmask. Bits 0-10 correspond to individual safety states. |
Bit layout:
| Bit | Safety Condition |
|---|---|
| 0 | Normal mode active |
| 1 | Reduced mode active |
| 2 | Protective stopped |
| 3 | Recovery mode active |
| 4 | Safeguard stopped |
| 5 | System emergency stop |
| 6 | Robot emergency stop |
| 7 | Emergency stop |
| 8 | Violation |
| 9 | Fault |
| 10 | Stopped due to safety |
Raises
| Exception | Condition |
|---|---|
RuntimeError | The robot is not connected. Call connect() before reading the safety status bits. |
NotImplementedError | Called on a manipulator brand other than Universal Robots, where this getter is not yet implemented. |
How to Tune the Parameters
get_safety_status_bits takes no parameters, but reading the result correctly requires bitwise decoding: use bits & (1 << n) to test whether a specific bit from the layout above is set, since multiple safety conditions can be active at once.
Where to Use the Skill
- Safety monitoring - Log full safety state in each control cycle for post-hoc diagnostics
- Condition-specific handling - Detect individual safety states and trigger appropriate recovery procedures
When Not to Use the Skill
Do not use Get Safety Status Bits when:
- A high-level summary is sufficient - use Get Safety Mode for a simpler integer safety mode code

