Skip to content

Safety

This module contains the functions and decorator for implementing safety measures in the robot. The decorator function is used to create guardrails for functions and functions, especially involving movement. The module also contains functions to set and reset the safety level for the safety measures.

ATTRIBUTE DESCRIPTION
DEBUG

Safety mode that logs the function call

TYPE: int

DELAY

Safety mode that waits for a few seconds before executing. Defaults to 3.

TYPE: int

SUPERVISED

Safety mode that requires user input before executing

TYPE: int

safety_mode

Safety mode for the safety measures

TYPE: int

FUNCTION DESCRIPTION
guard

Decorator for creating guardrails for functions and functions, especially involving movement

set_level

Set the safety level for the safety measures

reset_level

Reset the safety level to None

Documentation last updated: 2025-06-11

DEBUG module-attribute

DEBUG = 0

Safety mode that logs the function call

DELAY module-attribute

DELAY = 3

Safety mode that waits for a few seconds before executing. Defaults to 3.

SUPERVISED module-attribute

SUPERVISED = -10

Safety mode that requires user input before executing

safety_mode module-attribute

safety_mode = None

Safety mode for the safety measures

guard

guard(mode: int = DEBUG) -> Callable

Decorator for creating guardrails for functions and functions, especially involving movement

PARAMETER DESCRIPTION
mode

mode for implementing safety measure. Defaults to DEBUG. - DEBUG (0): logs the function call - DELAY (>=1): waits for a few seconds before executing. Defaults to 3. - SUPERVISED (-10): requires user input before executing

TYPE: int DEFAULT: DEBUG

RETURNS DESCRIPTION
Callable

wrapped function

TYPE: Callable

reset_level

reset_level()

Reset the safety level to None

set_level

set_level(mode: int)

Set the safety level for the safety measures

PARAMETER DESCRIPTION
mode

safety mode - DEBUG (0): logs the function call - DELAY (>=1): waits for a few seconds before executing. Defaults to 3. - SUPERVISED (-10): requires user input before executing

TYPE: int