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
aim_policy.h
Go to the documentation of this file.
1
9#pragma once
10
11#include "aim_map.h"
12#include "tracking_types.h"
13
14#include <cstdint>
15
16namespace aiming
17{
18struct TrackView {
19 tracking::TrackPhase state = tracking::TrackPhase::Idle;
20 float x = 0.0f;
21 float y = 0.0f;
22};
23
24enum class AimKind : uint8_t { Hold, Aim, Home };
25
30struct AimCommand {
31 AimKind kind = AimKind::Hold;
32 Angles angles;
33};
34
36 float deadband_deg = 1.0f;
37 uint32_t home_delay_ms = 2000;
38};
39
41{
42public:
43 explicit AimPolicy(const AimMap& map, const PolicyConfig& config = PolicyConfig{});
44
45 void set_map(const AimMap& map) { map_ = map; }
46 const AimMap& map() const { return map_; }
47 AimCommand update(const TrackView& track, uint32_t now_ms);
48 void reset();
49
57 uint32_t home_remaining_ms(uint32_t now_ms) const;
58
60 bool homed() const { return homed_; }
61
62private:
63 AimMap map_;
64 PolicyConfig config_;
65 bool have_setpoint_ = false;
66 Angles setpoint_{0.0f, kTiltHomeDeg};
67 bool seen_ = false;
68 bool homed_ = false;
69 bool searching_ = false;
70 uint32_t last_seen_ms_ = 0;
71};
72} // namespace aiming
Maps a target's image position to turret angles (pure C++20, natively tested).
Definition aim_policy.h:41
bool homed() const
True once Home has fired, until the next lock or reset().
Definition aim_policy.h:60
void reset()
forget the setpoint and the lost-target timer (mode changes)
Definition aim_policy.cpp:9
const AimMap & map() const
the active map
Definition aim_policy.h:46
uint32_t home_remaining_ms(uint32_t now_ms) const
Milliseconds until the pending return Home fires: home_delay_ms minus the time since the target was l...
Definition aim_policy.cpp:47
Result of one policy update. For Aim and Home, angles is the new target pose. For Hold,...
Definition aim_policy.h:30
pan = pan_a * x + pan_b, tilt = tilt_a * y + tilt_b.
Definition aim_map.h:50
Turret pose: pan degrees from home (positive = right), tilt servo degrees (larger = up).
Definition aim_map.h:30
Definition aim_policy.h:35
Definition aim_policy.h:18
float x
target centroid, frame pixels
Definition aim_policy.h:20
Value types shared by the motion detector and the tracker (pure C++20, natively tested).