# ARTOS - Advanced Radar Test & Orchestration System

Modular GUI application for testing and controlling MIL-STD-1553B radar systems over UDP.

## Features
- **Modular Docking GUI:** Resizable, minimizable panels for each subsystem
- **MCS Control:** Mission Control System with radar modes, functions, and parameters
- **1553 Bus Communication:** UDP-based MIL-STD-1553B message handling
- **Layered Architecture:** Clear separation between hardware (L0), orchestration (L1), algorithms (L2), and tests (L3)
- **Zero External Dependencies:** Pure Tkinter stdlib for maximum reliability
- **Workspace Persistence:** Save/load custom panel layouts

## Quick Start

### Installation
```powershell
# Clone repository
git clone <repo-url>
cd SXXXXXXX_PyMsc

# Create virtual environment
python -m venv .venv
.venv\Scripts\Activate.ps1

# Install dependencies
pip install -r requirements.txt
```

### Running ARTOS
```powershell
# Launch the modular docking GUI
python -m pymsc

# Alternative: Use the launcher script
python scripts\launch_docking_gui.py
```

### First-Time Setup
1. Start ARTOS: `python -m pymsc`
2. The GUI will launch with MCS dock on the left
3. Use **View** menu to toggle other module panels
4. Use **System → Start System** to begin 1553 communication
5. Save your workspace layout: **File → Save Layout**

## Architecture

ARTOS follows a 4-layer design:
- **L0:** Hardware abstraction (1553 Bus Module)
- **L1:** Test orchestration (TestContext - planned)
- **L2:** Algorithm library (planned)
- **L3:** Test execution (scripts + GUI sequences)

See [ARTOS Architecture Decisions](doc/ARTOS_Architecture_Decisions.md) for detailed design rationale.

## GUI Structure

```
┌─────────────┬──────────────────────────┐
│             │  Right Top               │
│   MCS       │  ┌────────────────────┐  │
│   Dock      │  │  Navigation (TBD)  │  │
│             │  └────────────────────┘  │
│   Control   │  ┌────────────────────┐  │
│   Mission   │  │  IRST (TBD)        │  │
│             │  └────────────────────┘  │
│             ├──────────────────────────┤
│             │  Logger & Status (TBD)   │
└─────────────┴──────────────────────────┘
```

## Project Structure

```
SXXXXXXX_PyMsc/
├── pymsc/                      # Main application package
│   ├── core/                   # Business logic & 1553 module
│   ├── gui/
│   │   ├── docking/            # Modular docking system
│   │   ├── components/         # Reusable widgets
│   │   └── pages/              # Control & Mission pages
│   └── utils/                  # Helpers and profiler
├── scripts/                    # Launcher scripts
├── doc/                        # Architecture & design docs
├── tests/                      # Unit and integration tests
└── logs/                       # Runtime logs
```

## Development

### Adding a New Dock Module
See [Docking System README](pymsc/gui/docking/README.md) for detailed guide.

Quick example:
```python
from pymsc.gui.docking import DockFrame

class MyModuleDock(DockFrame):
    def __init__(self, parent, **kwargs):
        super().__init__(parent, title="My Module", **kwargs)
    
    def populate_content(self):
        # Add your widgets here
        label = ttk.Label(self.content_frame, text="My content")
        label.pack()
```

### Running Tests
```powershell
pytest                          # Run all tests
pytest tests/test_imports.py    # Quick smoke test
```

## Configuration

### 1553 Bus Settings
Edit in [pymsc/__main__.py](pymsc/__main__.py):
```python
config = {
    'udp_send_ip': '127.0.0.1',
    'udp_send_port': 51553,
    'udp_recv_ip': '0.0.0.0',
    'udp_recv_port': 61553
}
```

### Workspace Layouts
Saved to `layouts/user_layout.json` via **File → Save Layout**.

## Documentation
- [Architecture Decisions](doc/ARTOS_Architecture_Decisions.md) - Design rationale and roadmap
- [Docking System](pymsc/gui/docking/README.md) - GUI module guide
- [English Manual](doc/English-manual.md) - User manual
- [ICD Document](doc/ICD_DECD_FTH%20-%20GRIFO-F_TH,%20Data%20Exchange%20Control%20Document%20for,%20rev%20-A,%20Draft%202.md) - 1553 protocol spec

## Contributing
1. Follow PEP 8 style guide
2. Add docstrings to public methods
3. Update tests for new features
4. Document architectural decisions in ADR

## License
Internal project - © 2025

---

**Status:** v0.1.0 - Modular docking GUI implemented ✅  
**Next Phase:** TestContext implementation (L1 orchestration layer)
