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
direction.h
Go to the documentation of this file.
1
8#pragma once
9
10#include "move_types.h"
11#include "tracking_types.h"
12
13#include <tuple>
14
15namespace tracking
16{
17inline std::tuple<MoveX, MoveY> direction_for(const TrackState& track, float deadzone_cells = 2.5f)
18{
19 if (track.state != TrackPhase::Locked && track.state != TrackPhase::Coasting)
20 {
21 return std::make_tuple(MoveX(MoveX::None), MoveY(MoveY::None));
22 }
23 const float dx = track.cx - (kGridW - 1) / 2.0f;
24 const float dy = track.cy - (kGridH - 1) / 2.0f;
27 if (dx < -deadzone_cells)
28 {
29 x = MoveX(MoveX::Left);
30 } else if (dx > deadzone_cells)
31 {
33 }
34 if (dy < -deadzone_cells)
35 {
36 y = MoveY(MoveY::Up);
37 } else if (dy > deadzone_cells)
38 {
39 y = MoveY(MoveY::Down);
40 }
41 return std::make_tuple(x, y);
42}
43} // namespace tracking
Encapsulates horizontal movement states and utility methods.
Definition move_types.h:67
static constexpr MoveXValue None
Local alias for None state.
Definition move_types.h:70
static constexpr MoveXValue Right
Local alias for Right state.
Definition move_types.h:72
static constexpr MoveXValue Left
Local alias for Left state.
Definition move_types.h:74
Encapsulates vertical movement states and utility methods.
Definition move_types.h:105
static constexpr MoveYValue Up
Local alias for Up state.
Definition move_types.h:110
static constexpr MoveYValue None
Local alias for None state.
Definition move_types.h:108
static constexpr MoveYValue Down
Local alias for Down state.
Definition move_types.h:112
movement definitions for the Smart Camera project.
Value types shared by the motion detector and the tracker (pure C++20, natively tested).