sl-firmware 41dc80ea7d feat: Add diagnostic self-test system (Issue #445)
Comprehensive hardware diagnostics and health monitoring for SaltyBot.

Startup hardware checks:
- RPLIDAR, RealSense, VESC, Jabra microphone, STM32 bridge
- Servo controller, WiFi, GPS module
- Disk space, system RAM, CPU temperature
- Boot result via TTS + face animation

Runtime monitoring:
- Temperature thresholds (Orin GPU >80C, VESC >60C)
- Network latency to 8.8.8.8
- System resource tracking (CPU, RAM, disk)

Features:
- Publishes /saltybot/diagnostics (DiagnosticArray)
- JSON logging to /home/seb/saltybot-data/diagnostics/
- Configuration-driven via YAML
- Boot animations and TTS announcements
- Configurable startup and runtime checks

Package structure:
- saltybot_diagnostics: Main diagnostics node
- diagnostic_checks.yaml: Hardware config + thresholds
- diagnostics.launch.py: Launch file with parameters
- Unit tests for check aggregation and logging

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-05 09:06:18 -05:00

45 lines
1.7 KiB
Python

"""Launch diagnostic self-test node."""
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
def generate_launch_description():
package_dir = get_package_share_directory("saltybot_diagnostics")
config_dir = os.path.join(package_dir, "config")
return LaunchDescription([
DeclareLaunchArgument(
"config_file",
default_value=os.path.join(config_dir, "diagnostic_checks.yaml"),
description="Diagnostic checks configuration",
),
DeclareLaunchArgument(
"enable_startup_check", default_value="true",
description="Enable startup checks",
),
DeclareLaunchArgument(
"enable_runtime_monitoring", default_value="true",
description="Enable runtime monitoring",
),
DeclareLaunchArgument(
"log_directory", default_value="/home/seb/saltybot-data/diagnostics",
description="Log directory",
),
Node(
package="saltybot_diagnostics",
executable="diagnostics_node",
name="diagnostics",
output="screen",
parameters=[{
"config_file": LaunchConfiguration("config_file"),
"enable_startup_check": LaunchConfiguration("enable_startup_check"),
"enable_runtime_monitoring": LaunchConfiguration("enable_runtime_monitoring"),
"log_directory": LaunchConfiguration("log_directory"),
"monitoring_frequency": 1.0,
}],
),
])