2.9 KiB
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__.pylaunches the GUI (MainView). - Core logic is split into:
core/: simulation engine, communication interfaces, scenario modelsgui/: Tkinter windows, frames, and widgetsutils/: 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
CommunicatorInterfaceand implemented inserial_communicator.pyandtftp_communicator.py. - Configuration: Settings and scenarios are stored in
settings.json(read/write viaConfigManager). - Logging: Centralized, routed to both console and GUI (
logger.py). GUI log widget uses colored levels. - Scenarios: Defined in
settings.jsonunderscenarios, 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__.pyor GUI modules - Settings: Edit
settings.jsonfor global config, connection, and scenario data - Logging: Adjust
LOGGING_CONFIGinconfig.pyfor 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
ConfigManagerand stored insettings.json - GUI: All Tkinter windows/frames are in
gui/, main window isMainView - Logging: Use
get_logger,setup_basic_logging, andadd_tkinter_handlerfor 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/hpresent but not integrated with Python app
Examples
- To add a new communication protocol, implement
CommunicatorInterfaceincore/and update GUI logic inmain_view.py. - To add a new scenario, update
settings.jsonand useConfigManagermethods. - To extend logging, add new handlers in
logger.pyand updateconfig.pyfor color/format.
References
- Main entry:
target_simulator/__main__.py - Simulation:
core/simulation_engine.py - GUI:
gui/main_view.py, othergui/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.