# codewithmonusharma/sih architecture

> Architecture diagram of the GitHub repository codewithmonusharma/sih, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/codewithmonusharma/sih
- Repository: https://github.com/codewithmonusharma/sih

## Overview

OptiTrack is a hardware-free FSOC coarse-alignment simulator with a mission-control GUI and video replay. The main workflow starts a configured simulation, models beacon motion and camera imagery with disturbances, detects and tracks the beacon, then supports reacquisition and gimbal control; the GUI presents live views and telemetry. The map also retains calibration, evaluation, and replay capabilities documented by the repository. Several connections rely on SOURCE INDEX references or README statements because the corresponding implementation excerpts were not provided.

Main entry points: [`runner/simulator.py`](https://github.com/codewithmonusharma/sih/blob/main/runner/simulator.py) (Simulation runner), [`gui/main_window.py`](https://github.com/codewithmonusharma/sih/blob/main/gui/main_window.py) (Mission window), [`gui/application/session.py`](https://github.com/codewithmonusharma/sih/blob/main/gui/application/session.py) (Simulation session), [`detection`](https://github.com/codewithmonusharma/sih/tree/main/detection) (Detector backends)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Mission Control"]
  node_main["Application entry<br/>[main.py]"]
  node_gui_entry["GUI entry<br/>[app.py]"]
  node_window["Mission window<br/>[main_window.py]"]
  node_app_controller["Lifecycle controller<br/>[controller.py]"]
  node_session["Simulation session<br/>[session.py]"]
  node_presenter["Simulation presenter"]
  node_views["Mission views"]
end

subgraph group_simulation["Simulation World"]
  node_config["Simulation config<br/>[schemas.py]"]
  node_runner["Simulation runner<br/>[simulator.py]"]
  node_world_motion["World and motion<br/>[motion.py]"]
  node_beacon["Beacon renderer<br/>[beacon.py]"]
  node_camera["Virtual camera<br/>[model.py]"]
  node_calibration["Camera calibration<br/>[calibration.py]"]
  node_disturbances["Disturbance engine<br/>[engine.py]"]
end

subgraph group_vision["Perception and Control"]
  node_frame["Frame contract<br/>[schema.py]"]
  node_detector["Detector backends"]
  node_tracker["IMM tracker<br/>[imm_tracker.py]"]
  node_roi["Adaptive ROI<br/>[roi.py]"]
  node_state_machine["Tracking state machine<br/>[state_machine.py]"]
  node_recovery["Reacquisition search<br/>[search.py]"]
  node_pat["PAT controller"]
end

subgraph group_results["Replay and Evaluation"]
  node_video["Video replay runner<br/>[video_runner.py]"]
  node_evaluation["Evaluation suite<br/>[evaluate.py]"]
  node_reports["Telemetry reports<br/>[report_writer.py]"]
end

node_operator(("Operator"))
node_user_video["Video input"]

node_operator -->|"starts"| node_main
node_main -->|"imports"| node_gui_entry
node_gui_entry -->|"exports"| node_window
node_window -->|"uses"| node_app_controller
node_window -->|"uses"| node_session
node_window -->|"uses"| node_presenter
node_window -->|"composes"| node_views
node_app_controller -->|"steps"| node_session
node_session -->|"builds"| node_runner
node_session -->|"configures"| node_config
node_runner -->|"queries motion"| node_world_motion
node_runner -.->|"renders beacon"| node_beacon
node_runner -.->|"creates camera"| node_camera
node_runner -.->|"calibrates"| node_calibration
node_runner -->|"disturbs frames"| node_disturbances
node_runner -.->|"runs detection"| node_detector
node_runner -.->|"uses frames"| node_frame
node_detector -->|"consumes"| node_frame
node_detector -->|"emits observations"| node_tracker
node_runner -.->|"updates"| node_tracker
node_runner -.->|"uses crop"| node_roi
node_runner -.->|"updates state"| node_state_machine
node_runner -.->|"searches on loss"| node_recovery
node_runner -.->|"commands gimbal"| node_pat
node_presenter -->|"reads state"| node_app_controller
node_user_video -.->|"supplies video"| node_video
node_operator -->|"runs benchmarks"| node_evaluation
node_evaluation -.->|"exports results"| node_reports

click node_main "https://github.com/codewithmonusharma/sih/blob/main/main.py"
click node_gui_entry "https://github.com/codewithmonusharma/sih/blob/main/gui/app.py"
click node_window "https://github.com/codewithmonusharma/sih/blob/main/gui/main_window.py"
click node_app_controller "https://github.com/codewithmonusharma/sih/blob/main/gui/application/controller.py"
click node_session "https://github.com/codewithmonusharma/sih/blob/main/gui/application/session.py"
click node_presenter "https://github.com/codewithmonusharma/sih/blob/main/gui/presentation/simulation_presenter.py"
click node_views "https://github.com/codewithmonusharma/sih/tree/main/gui/views"
click node_config "https://github.com/codewithmonusharma/sih/blob/main/config/schemas.py"
click node_runner "https://github.com/codewithmonusharma/sih/blob/main/runner/simulator.py"
click node_world_motion "https://github.com/codewithmonusharma/sih/blob/main/environment/motion.py"
click node_beacon "https://github.com/codewithmonusharma/sih/blob/main/target/beacon.py"
click node_camera "https://github.com/codewithmonusharma/sih/blob/main/camera/model.py"
click node_calibration "https://github.com/codewithmonusharma/sih/blob/main/camera/calibration.py"
click node_disturbances "https://github.com/codewithmonusharma/sih/blob/main/disturbance/engine.py"
click node_frame "https://github.com/codewithmonusharma/sih/blob/main/frame/schema.py"
click node_detector "https://github.com/codewithmonusharma/sih/tree/main/detection"
click node_tracker "https://github.com/codewithmonusharma/sih/blob/main/estimate/imm_tracker.py"
click node_roi "https://github.com/codewithmonusharma/sih/blob/main/estimate/roi.py"
click node_state_machine "https://github.com/codewithmonusharma/sih/blob/main/tracking/state_machine.py"
click node_recovery "https://github.com/codewithmonusharma/sih/blob/main/reacquisition/search.py"
click node_pat "https://github.com/codewithmonusharma/sih/blob/main/pat/baseline_controller.py"
click node_video "https://github.com/codewithmonusharma/sih/blob/main/runner/video_runner.py"
click node_evaluation "https://github.com/codewithmonusharma/sih/blob/main/evaluate.py"
click node_reports "https://github.com/codewithmonusharma/sih/blob/main/telemetry/report_writer.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_gui_entry,node_window,node_app_controller,node_session,node_presenter,node_views toneBlue
class node_config,node_runner,node_world_motion,node_beacon,node_camera,node_calibration,node_disturbances toneAmber
class node_frame,node_detector,node_tracker,node_roi,node_state_machine,node_recovery,node_pat toneMint
class node_video,node_evaluation,node_reports toneRose
class node_operator,node_user_video toneIndigo
```

## Components

### Mission Control

- [Application entry](https://github.com/codewithmonusharma/sih/blob/main/main.py): `main.py`
- [GUI entry](https://github.com/codewithmonusharma/sih/blob/main/gui/app.py): `gui/app.py`
- [Mission window](https://github.com/codewithmonusharma/sih/blob/main/gui/main_window.py): `gui/main_window.py`
- [Lifecycle controller](https://github.com/codewithmonusharma/sih/blob/main/gui/application/controller.py): `gui/application/controller.py`
- [Simulation session](https://github.com/codewithmonusharma/sih/blob/main/gui/application/session.py): `gui/application/session.py`
- [Simulation presenter](https://github.com/codewithmonusharma/sih/blob/main/gui/presentation/simulation_presenter.py): `gui/presentation/simulation_presenter.py`
- [Mission views](https://github.com/codewithmonusharma/sih/tree/main/gui/views): `gui/views`

### Simulation World

- [Simulation config](https://github.com/codewithmonusharma/sih/blob/main/config/schemas.py): `config/schemas.py`
- [Simulation runner](https://github.com/codewithmonusharma/sih/blob/main/runner/simulator.py): `runner/simulator.py`
- [World and motion](https://github.com/codewithmonusharma/sih/blob/main/environment/motion.py): `environment/motion.py`
- [Beacon renderer](https://github.com/codewithmonusharma/sih/blob/main/target/beacon.py): `target/beacon.py`
- [Virtual camera](https://github.com/codewithmonusharma/sih/blob/main/camera/model.py): `camera/model.py`
- [Camera calibration](https://github.com/codewithmonusharma/sih/blob/main/camera/calibration.py): `camera/calibration.py`
- [Disturbance engine](https://github.com/codewithmonusharma/sih/blob/main/disturbance/engine.py): `disturbance/engine.py`

### Perception and Control

- [Frame contract](https://github.com/codewithmonusharma/sih/blob/main/frame/schema.py): `frame/schema.py`
- [Detector backends](https://github.com/codewithmonusharma/sih/tree/main/detection): `detection`
- [IMM tracker](https://github.com/codewithmonusharma/sih/blob/main/estimate/imm_tracker.py): `estimate/imm_tracker.py`
- [Adaptive ROI](https://github.com/codewithmonusharma/sih/blob/main/estimate/roi.py): `estimate/roi.py`
- [Tracking state machine](https://github.com/codewithmonusharma/sih/blob/main/tracking/state_machine.py): `tracking/state_machine.py`
- [Reacquisition search](https://github.com/codewithmonusharma/sih/blob/main/reacquisition/search.py): `reacquisition/search.py`
- [PAT controller](https://github.com/codewithmonusharma/sih/blob/main/pat/baseline_controller.py): `pat/baseline_controller.py`

### Replay and Evaluation

- [Video replay runner](https://github.com/codewithmonusharma/sih/blob/main/runner/video_runner.py): `runner/video_runner.py`
- [Evaluation suite](https://github.com/codewithmonusharma/sih/blob/main/evaluate.py): `evaluate.py`
- [Telemetry reports](https://github.com/codewithmonusharma/sih/blob/main/telemetry/report_writer.py): `telemetry/report_writer.py`

### Other components

- **Operator**
- **Video input**

## Connections

- Operator → Application entry: starts (evidence: `README.md`)
- Application entry → GUI entry: imports (evidence: `main.py`)
- GUI entry → Mission window: exports (evidence: `gui/app.py`)
- Mission window → Lifecycle controller: uses (evidence: `gui/main_window.py`)
- Mission window → Simulation session: uses (evidence: `gui/main_window.py`)
- Mission window → Simulation presenter: uses (evidence: `gui/main_window.py`)
- Mission window → Mission views: composes (evidence: `gui/main_window.py`)
- Lifecycle controller → Simulation session: steps (evidence: `gui/application/controller.py`)
- Simulation session → Simulation runner: builds (evidence: `gui/application/session.py`)
- Simulation session → Simulation config: configures (evidence: `gui/application/session.py`)
- Simulation runner → World and motion: queries motion (evidence: `runner/simulator.py`)
- Simulation runner → Beacon renderer: renders beacon (evidence: `runner/simulator.py`)
- Simulation runner → Virtual camera: creates camera (evidence: `runner/simulator.py`)
- Simulation runner → Camera calibration: calibrates (evidence: `runner/simulator.py`)
- Simulation runner → Disturbance engine: disturbs frames (evidence: `runner/simulator.py`)
- Simulation runner → Detector backends: runs detection (evidence: `runner/simulator.py`)
- Simulation runner → Frame contract: uses frames (evidence: `runner/simulator.py`)
- Detector backends → Frame contract: consumes (evidence: `detection/base.py`)
- Detector backends → IMM tracker: emits observations (evidence: `detection/base.py`)
- Simulation runner → IMM tracker: updates (evidence: `runner/simulator.py`)
- Simulation runner → Adaptive ROI: uses crop (evidence: `runner/simulator.py`)
- Simulation runner → Tracking state machine: updates state (evidence: `runner/simulator.py`)
- Simulation runner → Reacquisition search: searches on loss (evidence: `runner/simulator.py`)
- Simulation runner → PAT controller: commands gimbal (evidence: `README.md`)
- Simulation presenter → Lifecycle controller: reads state (evidence: `gui/presentation/simulation_presenter.py`)
- Video input → Video replay runner: supplies video (evidence: `README.md`)
- Operator → Evaluation suite: runs benchmarks (evidence: `README.md`)
- Evaluation suite → Telemetry reports: exports results (evidence: `README.md`)
