S1005403_RisCC/.github/copilot-instructions.md
2025-10-13 10:34:59 +02:00

2.9 KiB

Copilot Instructions for Target Simulator

Project Overview

  • Target Simulator is a Python desktop application (Tkinter GUI) for simulating radar targets and scenarios, with communication via TFTP and serial protocols.
  • Main entry: target_simulator/__main__.py launches the GUI (MainView).
  • Core logic is split into:
    • core/: simulation engine, communication interfaces, scenario models
    • gui/: Tkinter windows, frames, and widgets
    • utils/: logging, config management, TFTP client

Architecture & Data Flow

  • Simulation runs in a background thread (SimulationEngine) and updates target states/scenarios.
  • Communication: Supports both TFTP and serial, abstracted via CommunicatorInterface and implemented in serial_communicator.py and tftp_communicator.py.
  • Configuration: Settings and scenarios are stored in settings.json (read/write via ConfigManager).
  • Logging: Centralized, routed to both console and GUI (logger.py). GUI log widget uses colored levels.
  • Scenarios: Defined in settings.json under scenarios, loaded and managed via GUI and core logic.

Developer Workflows

  • Run app: python -m target_simulator (from project root)
  • Debug: Use Python debugger on __main__.py or GUI modules
  • Settings: Edit settings.json for global config, connection, and scenario data
  • Logging: Adjust LOGGING_CONFIG in config.py for format/colors

Patterns & Conventions

  • Absolute imports are used throughout (e.g., from target_simulator.core...).
  • PEP8 style, English for code/comments/docstrings
  • One statement per line; concise, essential comments only
  • Modularization: If a file grows >1000 lines, split by topic into new modules
  • Scenario/Settings: All persistent config is managed via ConfigManager and stored in settings.json
  • GUI: All Tkinter windows/frames are in gui/, main window is MainView
  • Logging: Use get_logger, setup_basic_logging, and add_tkinter_handler for consistent logging

Integration Points

  • External dependencies: Tkinter, threading, TFTP/serial (no third-party packages required)
  • Temp files: Written to Temp/ for live updates and scenario init logs
  • C++ code: BupTFTP.cpp/h present but not integrated with Python app

Examples

  • To add a new communication protocol, implement CommunicatorInterface in core/ and update GUI logic in main_view.py.
  • To add a new scenario, update settings.json and use ConfigManager methods.
  • To extend logging, add new handlers in logger.py and update config.py for color/format.

References

  • Main entry: target_simulator/__main__.py
  • Simulation: core/simulation_engine.py
  • GUI: gui/main_view.py, other gui/ modules
  • Config: utils/config_manager.py, settings.json
  • Logging: utils/logger.py, config.py

If any section is unclear or missing, please provide feedback to improve these instructions.