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 |
---|---|
safety_mode |
Safety mode for the safety measures
TYPE:
|
SafetyLevel |
Enum for safety levels - DEBUG (int): Safety mode that logs the function call [0] - DELAY (int): Safety mode that waits for a few seconds before executing.[3] - SUPERVISED (int): Safety mode that requires user input before executing. [-10]
TYPE:
|
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
SafetyLevel
Bases: IntEnum
Enum for safety levels
DELAY
class-attribute
instance-attribute
Safety mode that waits for a few seconds before executing. Defaults to 3.
get_safety_level
Get the current safety level
RETURNS | DESCRIPTION |
---|---|
int | None
|
int|None: current safety level |
get_safety_mode
Get the effective safety mode
PARAMETER | DESCRIPTION |
---|---|
mode
|
safety mode
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
int
|
effective safety mode
TYPE:
|
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 SafetyLevel.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:
|
RETURNS | DESCRIPTION |
---|---|
Callable
|
wrapped function
TYPE:
|
set_safety_level
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:
|