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.
Loading...
Searching...
No Matches
remote_inbox.h
Go to the documentation of this file.
1
8#pragma once
9
10#include "remote_command.h"
11
12#include <optional>
13
14namespace remote
15{
16constexpr uint32_t kJogTimeoutMs = 300;
17constexpr float kJogSpeed = 0.6f;
18constexpr float kJogSpeedSlow = 0.25f;
19constexpr float kJogSpeedFast = 1.0f;
20
22struct Jog {
23 float pan = 0.0f;
24 float tilt = 0.0f;
25};
26
28struct AimPixel {
29 int16_t x = 0;
30 int16_t y = 0;
31};
32
35{
36public:
41 void submit(const Command& cmd, uint32_t now_ms);
42
44 bool jog_active(uint32_t now_ms) const;
45
47 Jog jog(uint32_t now_ms) const;
48
50 std::optional<RemoteMode> take_mode_request();
51
53 std::optional<CalAction> take_cal_request();
54
56 std::optional<AimPixel> take_aim_request();
57
59 JogSpeed speed() const { return speed_; }
60
61private:
62 bool has_move_ = false;
63 int8_t pan_ = 0;
64 int8_t tilt_ = 0;
65 uint32_t move_ms_ = 0;
66 std::optional<RemoteMode> mode_request_;
67 std::optional<CalAction> cal_request_;
68 std::optional<AimPixel> aim_request_;
69 JogSpeed speed_ = JogSpeed::Normal;
70};
71} // namespace remote
Stores the latest Move (with timeout), the jog speed and the pending mode, calibration and aim reques...
Definition remote_inbox.h:35
std::optional< CalAction > take_cal_request()
The latest Calibrate action, returned once.
Definition remote_inbox.cpp:68
std::optional< AimPixel > take_aim_request()
The latest Aim pixel, returned once.
Definition remote_inbox.cpp:70
std::optional< RemoteMode > take_mode_request()
The latest Mode command, returned once.
Definition remote_inbox.cpp:66
bool jog_active(uint32_t now_ms) const
True if a Move arrived and less than kJogTimeoutMs have passed since.
Definition remote_inbox.cpp:40
void submit(const Command &cmd, uint32_t now_ms)
Applies a command. Move stores direction and time, Stop ends the jog, Mode, Calibrate and Aim store a...
Definition remote_inbox.cpp:7
JogSpeed speed() const
The persistent jog speed setting (default Normal).
Definition remote_inbox.h:59
Jog jog(uint32_t now_ms) const
The magnitude of the current speed setting times the direction while active, else {0,...
Definition remote_inbox.cpp:45
Parses the HUD's /commands text messages into typed commands (pure C++20, natively tested).
JogSpeed
HUD jog magnitude setting.
Definition remote_command.h:28
constexpr float kJogSpeedSlow
jog magnitude at JogSpeed::Slow
Definition remote_inbox.h:18
constexpr uint32_t kJogTimeoutMs
a jog expires this long after the last Move
Definition remote_inbox.h:16
constexpr float kJogSpeed
jog magnitude per axis while active at JogSpeed::Normal
Definition remote_inbox.h:17
constexpr float kJogSpeedFast
jog magnitude at JogSpeed::Fast
Definition remote_inbox.h:19
Image pixel requested by an Aim command.
Definition remote_inbox.h:28
One parsed message. Only the fields matching kind are meaningful.
Definition remote_command.h:31
Jog request in the same units as Joystick/Turret::jog.
Definition remote_inbox.h:22