|
A.R.G.U.S 2.1.0
Adaptive Real-Time Guardian for Unsafe Situations
|
#include <VisionProcessor.hpp>
Public Member Functions | |
| VisionProcessor (const VisionConfig &config) | |
| Constructs a VisionProcessor with the given safety configuration. | |
| SafetyResult | process (const cv::Mat &frame, std::chrono::steady_clock::time_point captureTimestamp) |
| Processes a single camera frame and evaluates tool safety. | |
| void | updateConfig (const VisionConfig &newConfig) |
| Updates the safety configuration at runtime. | |
Definition at line 36 of file VisionProcessor.hpp.
|
explicit |
Constructs the VisionProcessor and initialises all detection resources.
Initialises internal resources once at construction so that process() stays fast and latency remains predictable and bounded on every call.
The config is stored by value so this class owns its own copy and is not affected by any external changes after construction — satisfying the Dependency Inversion Principle (depends on VisionConfig abstraction, not hardcoded values).
| config | Safety thresholds and zone boundaries injected at construction. Stored by value to prevent external modifications from affecting in-flight decisions. |
Initialises internal resources once so process() stays fast and latency remains bounded on every call.
| config | Safety thresholds and zone boundaries injected at construction to satisfy the Dependency Inversion principle. Stored by value so external changes cannot affect in-flight safety decisions. |
Definition at line 29 of file VisionProcessor.cpp.
| SafetyResult VisionProcessor::process | ( | const cv::Mat & | frame, |
| std::chrono::steady_clock::time_point | captureTimestamp | ||
| ) |
Runs the full vision safety pipeline on a single camera frame.
Executes a depth-colour safety pipeline per frame:
Must complete within the latency budget (less than one frame period). At 30 FPS the budget is ~33 ms; target completion under 20 ms to leave headroom for FSM transition and interlock signalling.
| frame | The raw camera frame to analyse. Must not be empty. |
| captureTimestamp | The time at which this frame was captured. Used to compute the actual inter-frame elapsed time for the speed check — prevents false SAFE results caused by dropped frames under load. |
Executes the depth-colour pipeline:
Processing time is measured at each return point and included in the result to support latency budget analysis.
| frame | The camera frame to analyse. Must be non-empty. |
| captureTimestamp | The time at which this frame was captured. Used to compute actual inter-frame elapsed time for the speed check, ensuring correctness under variable frame delivery rates on a loaded RPi. |
Helper lambda: builds a SafetyResult with correct timestamps and processing_time without duplicating this logic at every return point.
Definition at line 75 of file VisionProcessor.cpp.
References DEPTH_EXCEEDED, VisionConfig::depthCheckEnabled, VisionConfig::depthHueLower1, VisionConfig::depthHueLower2, VisionConfig::depthHueUpper1, VisionConfig::depthHueUpper2, VisionConfig::depthPixelThreshold, VisionConfig::depthSatMax, VisionConfig::depthSatMin, VisionConfig::depthValMax, VisionConfig::depthValMin, SAFE, VisionConfig::safeZoneXMax, VisionConfig::safeZoneXMin, VisionConfig::safeZoneYMax, and VisionConfig::safeZoneYMin.
Referenced by AppController::runLiveMarkerTest().
| void VisionProcessor::updateConfig | ( | const VisionConfig & | newConfig | ) |
Allows dynamic adjustment of thresholds (e.g., via UI sliders) without reconstructing the VisionProcessor. Useful for calibration and testing under varying lighting conditions.
| newConfig | The updated configuration to apply. |
Definition at line 49 of file VisionProcessor.cpp.
Referenced by AppController::runLiveMarkerTest().