|
Void Sentry
An AI-driven, real-time Sentry Turret platform leveraging asynchronous I/O and computer vision to deliver high-precision autonomous motion tracking on resource-constrained embedded hardware.
|
The control loop's decisions, one pass per run() call: button gestures, HUD requests, the three modes and the status counters. More...
#include <control_logic.h>
Public Member Functions | |
| ControlLogic (ControlPorts &io) | |
| void | load_calibration (const aiming::AimMap &map) |
| Makes a saved calibration active (Controller::begin, after loading it from NVS). | |
| void | run (uint32_t now_ms, bool held) |
| One pass: classifies the button, services a pending HUD record, applies the HUD's mode, calibration and aim requests, then runs the per-mode behaviour (jog arbitration, or the aim policy in Ai). | |
| ControlStatus | status (uint32_t now_ms, const aiming::Angles &pose, remote::JogSpeed speed) const |
| The status to publish after a pass. | |
| ControlMode | mode () const |
| The active operating mode. | |
The control loop's decisions, one pass per run() call: button gestures, HUD requests, the three modes and the status counters.
Owns the button classifier, the aim policy, the calibration session, the mode and the counters published in ControlStatus. Starts in Ai mode with the default (uncalibrated) aim map.
Modes (ControlMode):
cal:point) records a calibration point: the turret's resting angles paired with the visible target's pixel position. A successful fit is saved through ControlPorts::save_calibration, made active, and switches to Ai.Button gestures: short press toggles Ai/User (or records a point in Calibrate); a long press enters Calibrate, or cancels it and restores the previous mode.
HUD requests (taken from the inbox once per pass, so a request that does not apply is dropped, never deferred): mode:* outside Calibrate only, and not on a pass that started in Calibrate; cal:start / cal:cancel act like a long press when not calibrating / while calibrating (ignored otherwise); cal:point acts like a short press in Calibrate (ignored otherwise): the jog is zeroed and the pose is recorded on the first later pass where the pan is at rest, or after kHudRecordTimeoutMs with the current pose. Any cal:* is dropped on a pass where the button produced an event, and a knob record clears a pending HUD one. aim:x,y in User and Calibrate only, and not while a calibration record is in progress: the pixel goes through the active aim map to an absolute target, and the aim holds (the idle (0,0) jog is not sent) until a jog source becomes active.
|
inlineexplicit |
| io | The device ports; must outlive this object. |
| void control::ControlLogic::run | ( | uint32_t | now_ms, |
| bool | held ) |
One pass: classifies the button, services a pending HUD record, applies the HUD's mode, calibration and aim requests, then runs the per-mode behaviour (jog arbitration, or the aim policy in Ai).
| now_ms | millis() at the start of the pass. |
| held | Raw joystick button level read at the start of the pass. |
| ControlStatus control::ControlLogic::status | ( | uint32_t | now_ms, |
| const aiming::Angles & | pose, | ||
| remote::JogSpeed | speed ) const |
The status to publish after a pass.
| now_ms | The pass's millis() (for the AI home countdown). |
| pose | Current turret pose. |
| speed | The HUD jog speed setting from the inbox. |