How hhgzs/tjurm-2024 works
Main Components
• Configuration & Parameter Manager – Represented by the modules in “data/uniconfig”, “include/data_manager”, and “src/data_manager”. This component handles JSON-based configurations and parameters (including dynamic linking of parameters from system directories).
• Garage/Vehicle Manager – This corresponds to the “garage” module in both include and source folders. It uses factory pattern techniques to create specific instances (e.g., wrapper_car, wrapper_rune, wrapper_tower) based on the configuration.
• Thread Management – The project is organized using several threads:
• Control Threads (located in “src/threads/control”): Handles serial communication with the lower-level hardware using CRC, receive/send functionalities.
• Pipeline Threads (in “src/threads/pipeline”): This is where the system’s core real-time processing happens. It is further divided into:
• Baseline Pipeline (for standard YOLOv5-based detection and tracking)
• Fourpoints Pipeline (handling the four-point network processing)
• Rune Pipeline (for the specialized “rune” mode)
• UI & Debug Threads – Threads like “image_thread.cpp”, “recording_thread.cpp”, and “ui.cpp” handle image display, debugging, and user interface functionalities.
• Main Application Controller – The “main.cpp” initializes and links all of the above components, coordinating startup and thread management.
• External Dependencies – The system relies on the OpenRM vision algorithm library and the nlohmann JSON library (embedded in “libs/json”). Make sure to mark this external linkage.
Relationships and Interactions
• The configuration files from “data/uniconfig” are read by the Data Manager and then propagated as parameters throughout the system (using the Singleton and Template method patterns).
• The Garage Module interacts with both configuration and control threads. It creates specialized instances based on the current configuration (Factory Pattern) and communicates with the control module (Observer Pattern).
• The Control module interacts with the hardware (serial communication). It both sends control signals (post-processing results from the pipelines) and receives data that may further influence the pipelines and modes.
• UI / Debug threads provide real-time visualization. Their data flows back into the control structures as needed (for example, when “imshow” is enabled).
Architectural Patterns and Design Principles
• Pipeline Architecture: Illustrate the flow steps in each pipeline stage (preprocessing, detection, tracking, and control) with each block clearly labeled.
• Decoupled Algorithm and Framework Layers: Show a clear separation between the self-aim framework (which handles high-level thread orchestration and parameter management) and the external OpenRM algorithm library (plugged in via dynamic linking).
• Use of Design Patterns: Indicate where factory (garage creation), strategy (choosing processing pipeline modes), and observer (serial communication for triggering mode changes) patterns are used.
Relevant Technologies, Frameworks, and Libraries
• C++ (with CMake as the build system)
• JSON processing using the nlohmann JSON library (from “libs/json”)
• External dependency on the OpenRM-2024 vision algorithm library
• Multi-threading (various thread modules for control, pipeline, and UI) and serial port communication (embedded in control threads)
• Linux-based configuration involving system-level services (e.g., rc.local for self-startup)
Important Detail
• As many components as possible from the file tree—don’t shy away from splitting the architecture in detailed sections. Even small components (like the checksum in control/crc or the image display in image_thread.cpp) contribute to the overall architecture.
• Since the project supports customization by modifying parameters in the configuration directory (and uses a symbolic link from /etc/openrm), highlight that configuration management is an integral part of the system.