Skip to content

feat: Add SafetyMonitorProvider for robot safety monitoring and emergency stop #1933

@Vt01nft

Description

@Vt01nft

Problem Statement

OM1 currently lacks a centralized safety monitoring system. Robots operating autonomously need:

  • Emergency stop capability when unsafe conditions are detected
  • Real-time monitoring of critical system parameters
  • Safety alerts before dangerous situations occur
  • Audit logging of all safety events

Without this, robots may:

  • Continue operating with critically low battery (risking damage)
  • Overheat and damage hardware
  • Collide with obstacles without proper alerts
  • Have no way to trigger emergency stops

Proposed Solution

Create a SafetyMonitorProvider that provides:

Core Safety Features

Feature Description
Emergency Stop Immediate halt capability with callback system
Battery Monitoring Critical/low/normal thresholds with alerts
Temperature Monitoring CPU/system temp with overheat protection
Collision Prevention Proximity alerts from sensor data
Safety Zones Define restricted areas robot shouldn't enter
Watchdog Timer Detect system hangs, auto-recovery
Safety Event Logging Full audit trail of safety events

Integration Points

  • Works with existing TeleopsStatusProvider for battery data
  • Integrates with rplidar_provider for proximity data
  • Uses singleton pattern like other providers
  • Provides callbacks for actions to respond to safety events

Example Usage

safety = SafetyMonitorProvider()
safety.register_emergency_callback(robot.stop_all_motors)
safety.set_battery_thresholds(critical=10, low=20, warning=30)
safety.start()

# Check safety status
if safety.is_safe_to_operate():
    robot.execute_action()

Impact

  • Safety: Prevents damage to robot and environment
  • Reliability: Auto-recovery from common failures
  • Compliance: Audit trail for safety events
  • Reusability: Can be used by all robot types in OM1

Checklist

  • Follows OM1 provider patterns (singleton, dataclasses)
  • Includes comprehensive docstrings
  • Includes unit tests
  • Uses type hints throughout

I would like to implement this feature. Looking forward to feedback!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions