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
status_fields.h File Reference

Computes the pose-derived HUD fields of ControlStatus (pure C++20, natively tested). More...

#include "aim_map.h"
#include "control_status.h"
#include <cstdint>

Go to the source code of this file.

Classes

struct  hud::HomeState
 AI return-home state read from the aiming::AimPolicy. Ignored unless ai_mode is set. More...
 

Functions

int16_t hud::round_pixel (float v)
 Rounds a pixel coordinate to int16, saturating at the int16 range (a nearly flat map can put the inverse of a pose far outside the frame); a non-finite value gives 0.
 
void hud::fill_pose_fields (ControlStatus &st, const aiming::AimMap &map, const HomeState &home)
 Fills aim_x, aim_y, lim, rx0, ry0, rx1, ry1, home_ms and returning of st from st.angles (which must already hold the current pose), the active map and the AI home state.
 

Variables

constexpr float hud::kReturningMarginDeg = 1.0f
 A pose further than this from home on either axis counts as "travelling home" after a Home command.
 

Detailed Description

Computes the pose-derived HUD fields of ControlStatus (pure C++20, natively tested).

The controller fills the mode, calibration and counter fields itself; this helper derives the fields that only depend on the current pose, the active aim map and the AI return-home state: the aim pixel (ax, ay), the soft-limit bits (lim), the reachable box (rx0..ry1), the home countdown (home) and the returning flag (ret). See docs/superpowers/specs/2026-10-26-hud-ux-overhaul-design.md, section "Reply JSON".

Function Documentation

◆ fill_pose_fields()

void hud::fill_pose_fields ( ControlStatus & st,
const aiming::AimMap & map,
const HomeState & home )

Fills aim_x, aim_y, lim, rx0, ry0, rx1, ry1, home_ms and returning of st from st.angles (which must already hold the current pose), the active map and the AI home state.

aim_x/aim_y = round_pixel(map.to_pixel(pose)) (not clamped to the frame); lim = aiming::limit_bits(pose); the box = aiming::reach_box(map); home_ms = home.home_remaining_ms in AI mode, else 0; returning = AI mode, Home has fired and the pose is more than kReturningMarginDeg from (0, aiming::kTiltHomeDeg) on either axis. The other fields are left untouched.