Autonomous Fault Detection & Recovery System for CubeSats
AstraGuard AI is an intelligent onboard system that simulates real-time telemetry monitoring, anomaly detection, and autonomous recovery actions for CubeSat spacecraft. The system uses machine learning to identify abnormal patterns and automatically executes recovery procedures to maintain spacecraft health and operational continuity.
| Component | Description |
|---|---|
| π°οΈ Telemetry | Real-time data generation at 5Hz with configurable noise and anomaly injection |
| π€ Anomaly Detection | ML-powered detection using Isolation Forest algorithm |
| π§ Fault Classification | Rule-based system for identifying specific fault types |
| β‘ State Machine | Autonomous recovery decision-making engine |
| π Dashboard | Interactive web interface built with Streamlit |
| π 3D Visualization | Real-time spacecraft attitude visualization |
| π Logging | Comprehensive event tracking and timeline analysis |
- Autonomous Operation: Reduces dependency on ground control
- Early Anomaly Detection: Identifies issues before they become critical
- Modular Architecture: Easy to extend and customize
- Open Source: Built by the community, for the community
- Production Ready: Thoroughly tested and documented
graph TD
A[Telemetry Generation] -->|Raw Data| B[Anomaly Detection]
B -->|Anomaly Score| C[Fault Classification]
C -->|Fault Type| D[State Machine]
D -->|Recovery Actions| E[System Recovery]
A -->|Data| F[Dashboard]
B -->|Alerts| F
C -->|Fault Info| F
D -->|State Updates| F
A -->|Data| G[3D Visualization]
A -->|Logs| H[Timeline]
B -->|Events| H
C -->|Events| H
D -->|Events| H
| Directory | Purpose |
|---|---|
astraguard/telemetry/ |
Generates realistic spacecraft telemetry data |
anomaly/ |
Machine learning models for detecting anomalies |
classifier/ |
Classifies detected anomalies into specific fault types |
state_machine/ |
Implements recovery logic and state management |
dashboard/ |
Web-based monitoring and control interface |
simulation/ |
3D visualization of spacecraft attitude |
logs/ |
Event logging and timeline analysis |
For detailed information about the AstraGuard AI system, please refer to the comprehensive documentation:
π AstraGuard AI: Autonomous Fault Detection & Recovery for Small Satellites (PDF)
This document provides in-depth information about the system architecture, algorithms, implementation details, and usage guidelines.
- Python 3.9 or higher
- pip (Python package manager)
- Git
-
Clone the repository
git clone https://github.com/sr-857/AstraGuard-AI.git cd AstraGuard-AI -
Create and activate a virtual environment (recommended)
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -e .
Launch the interactive dashboard to see the system in action:
python cli.py dashboardThe dashboard will be available at http://localhost:8501.
AstraGuard AI provides a unified CLI for all operations.
Start Telemetry Stream:
python cli.py telemetryRun Anomaly Detection:
python cli.py classifyLaunch 3D Simulation:
python cli.py simulateView Event Logs:
python cli.py logs- Simulates realistic CubeSat telemetry parameters
- Voltage, current, temperature, gyroscope, reaction wheel speed
- 10% fault injection probability for testing
- JSON output format for easy integration
Telemetry Parameters:
- Voltage: 7.9V Β± 0.03V (Bus voltage)
- Current: 0.55A Β± 0.01A (Power consumption)
- Temperature: 24Β°C Β± 0.4Β°C (System temperature)
- Gyroscope: 0 rad/s Β± 0.015 rad/s (Angular rate)
- Wheel Speed: 480 RPM Β± 4 RPM (Reaction wheel)
- Algorithm: Isolation Forest (scikit-learn)
- Training: 2000 synthetic normal samples
- Contamination Rate: 1% expected anomalies
- Features: 5-dimensional telemetry vector
- Output: Boolean anomaly flag + confidence score
- Power Fault: Voltage < 7.3V
- Thermal Fault: Temperature > 32Β°C
- Attitude Fault: |Gyro| > 0.05 rad/s
- Sensor Fault: Missing/invalid sensor data
- Severity Levels: Critical, High, Medium, Low
- NORMAL: Standard operations
- SAFE_MODE: Power conservation (critical faults)
- COOLING: Thermal management (thermal faults)
- STABILIZING: Attitude correction (attitude faults)
- DIAGNOSTICS: Sensor testing (sensor faults)
- Real-time telemetry display
- Anomaly detection alerts
- System state monitoring
- Event timeline visualization
- Recovery action tracking
Test individual components using the CLI or standard python commands:
# Run all tests
python -m pytest tests/
# Test specific components
python cli.py classify # Tests fault classifier- Telemetry Rate: 5 Hz (200ms intervals)
- Anomaly Detection Latency: < 10ms
- Fault Classification Accuracy: > 95% (simulated)
- Recovery Response Time: < 100ms
- Memory Usage: < 100MB (typical operation)
Edit anomaly/anomaly_detector.py to modify:
contamination: Expected anomaly rate (default: 0.01)n_estimators: Number of trees (default: 100)- Training data distribution parameters
Edit classifier/fault_classifier.py to adjust:
- Voltage thresholds
- Temperature limits
- Gyro sensitivity
- Sensor validation ranges
Edit state_machine/state_engine.py to configure:
- Recovery action durations
- Auto-resume behavior
- Command priorities
Model not found error: The model is trained automatically when you run the dashboard. You can also trigger it manually:
python anomaly/anomaly_detector.pyDashboard not updating:
- Check telemetry stream is running (
python cli.py telemetry) - Verify JSON output format
- Check browser console for errors
High memory usage:
- Reduce telemetry history in dashboard
- Clear event log periodically
- Restart components if needed
Enable verbose logging:
export PYTHONUNBUFFERED=1
python cli.py telemetry 2>&1 | tee debug.log- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow PEP 8 style guidelines
- Add type hints to all functions
- Include comprehensive docstrings
- Write unit tests for new features
- Update documentation for API changes
If you use AstraGuard AI in your research, please cite it using the following BibTeX:
@misc{AstraGuardAI,
author = {Roy, Subhajit},
title = {AstraGuard AI: Autonomous Fault Detection \& Recovery System for CubeSats},
year = {2025},
month = {11},
url = {https://github.com/sr-857/AstraGuard-AI},
note = {GitHub repository},
license = {MIT}
}This project is licensed under the MIT License - see the LICENSE file for details.
- scikit-learn: Machine learning algorithms
- Streamlit: Dashboard framework
- NumPy: Numerical computing
- Matplotlib: Visualization library
- Altair: Declarative visualization
Author: Subhajit Roy
Project: AstraGuard AI - Autonomous Fault Detection & Recovery System
Repository: https://github.com/sr-857/AstraGuard-AI
- v2.0: Deep learning anomaly detection
- v2.1: Multi-sensor fusion algorithms
- v2.2: Ground station integration
- v2.3: Hardware-in-the-loop testing
- v3.0: Flight-ready deployment package
AstraGuard AI - Protecting spacecraft through intelligent autonomy π°οΈβ¨