|
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.
|
Maps a target's image position to turret angles (pure C++20, natively tested). More...
#include <cstdint>#include <optional>Go to the source code of this file.
Classes | |
| struct | aiming::Angles |
| Turret pose: pan degrees from home (positive = right), tilt servo degrees (larger = up). More... | |
| struct | aiming::CalPoint |
| One calibration sample: the target's pixel and the turret angles that pointed at it. More... | |
| struct | aiming::Pixel |
| An image position in pixels; not clamped, so it can lie outside the frame. More... | |
| struct | aiming::AimMap |
| pan = pan_a * x + pan_b, tilt = tilt_a * y + tilt_b. More... | |
| struct | aiming::ReachBox |
| Rectangle of frame pixels (inclusive corners) with x0 <= x1 and y0 <= y1. More... | |
Functions | |
| AimMap | aiming::default_map () |
| Camera next to the turret, 66 x 50 degree field of view, image centre = home. | |
| std::optional< AimMap > | aiming::fit (const CalPoint &p1, const CalPoint &p2) |
| Per-axis line through two calibration points; empty if they are too close or not finite. | |
| ReachBox | aiming::reach_box (const AimMap &m) |
| The image region whose aim lies inside the soft limits: the pixels where kPanMinDeg <= pan <= kPanMaxDeg and kTiltMinDeg <= tilt <= kTiltMaxDeg (the inverse of the limits through the map), ordered, clamped to the frame and rounded. An axis with a zero or non-finite slope spans the whole frame. A region wholly outside the frame collapses onto the nearest edge column or row. | |
| uint8_t | aiming::limit_bits (Angles a) |
| Soft-limit proximity bits for the HUD: 1 pan within kLimitMarginDeg of kPanMinDeg, 2 pan at the max, 4 tilt at the min, 8 tilt at the max (inclusive; beyond a limit counts too, a non-finite angle sets no bit). | |
| Angles | aiming::clamp_angles (Angles a) |
| Clamps angles to the soft limits; non-finite pan becomes 0 and non-finite tilt becomes kTiltHomeDeg first. | |
| int32_t | aiming::pan_deg_to_steps (float deg) |
| Converts pan degrees to 28BYJ-48 full steps (rounded). Non-finite input gives 0; the degrees are clamped to [kPanMinDeg, kPanMaxDeg] before rounding, so the result is always in [-512, 512]. | |
| float | aiming::pan_steps_to_deg (int32_t steps) |
| Converts a pan step count (28BYJ-48 full steps from home) to degrees; the inverse of pan_deg_to_steps. | |
Variables | |
| constexpr int32_t | aiming::kStepsPerRev = 2048 |
| 28BYJ-48 full steps per revolution | |
| constexpr float | aiming::kPanMinDeg = -90.0f |
| constexpr float | aiming::kPanMaxDeg = 90.0f |
| constexpr float | aiming::kTiltMinDeg = 20.0f |
| constexpr float | aiming::kTiltMaxDeg = 160.0f |
| constexpr float | aiming::kTiltHomeDeg = 90.0f |
| constexpr int | aiming::kFrameW = 320 |
| QVGA. | |
| constexpr int | aiming::kFrameH = 240 |
| constexpr float | aiming::kLimitMarginDeg = 0.5f |
| limit_bits() reports an axis this close to a soft limit | |
| constexpr float | aiming::kMinCalDx = 80.0f |
| closer calibration points amplify aiming error | |
| constexpr float | aiming::kMinCalDy = 60.0f |
Maps a target's image position to turret angles (pure C++20, natively tested).
The camera is fixed (not on the turret), so aiming is open-loop: pan depends linearly on image x and tilt on image y. The map comes from a 2-point joystick calibration, or from default_map() (camera next to the turret, OV3660 field of view) until one exists. Angles: pan degrees from home (positive = right), tilt servo degrees (larger = up).