|
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.
|
Non-blocking turret: callers post commands, a 1 kHz motor task executes them. More...
#include <turret.h>
Public Member Functions | |
| Turret (Servo &servo) | |
| bool | begin () |
| Configure pins (coils LOW), attach the servo at home tilt and start the motor task. | |
| void | set_target_deg (const aiming::Angles &target) override |
| Move to absolute angles (clamped to the soft limits). | |
| void | jog (float pan, float tilt) override |
| Manual velocity, each axis -1..1 of its max speed; 0,0 stops (with deceleration). | |
| void | home () override |
| Same as set_target_deg({0, home tilt}). | |
| aiming::Angles | position_deg () const override |
| Current angles (pan from the step counter, tilt as last written to the servo). | |
| float | pan_speed () const override |
| Current stepper speed, steps/s (signed). | |
| uint32_t | late_ticks () const |
| Count of late wake-ups (lag of more than 1 tick) where missed 1 ms ticks were dropped. | |
| uint32_t | stack_free () const |
| Minimum free stack of the motor task seen so far, in bytes (high-water mark, sampled every 1000 ticks; 0 until the first sample). | |
Public Member Functions inherited from BaseTurret | |
Non-blocking turret: callers post commands, a 1 kHz motor task executes them.
Why a task: the Arduino stepper library blocks for the whole move (about 15 ms per command), which stalled frame detection in loop(). Here loop() only writes a small command mailbox; the motor task (core 0, priority 7) ticks an aiming::StepPlanner every millisecond, drives the four ULN2003 coil pins itself and moves the servo at 50 Hz with a rate limit. Why the coils are released: a 28BYJ-48 held energized at standstill draws current continuously and heats up, so all four pins go LOW 500 ms after the last step. Its gear train holds the position unpowered. Thread safety: the mailbox and the published state each sit in a vsync::SpinGuarded (own portMUX spinlock); critical sections only copy a few words.
|
explicit |
| servo | Servo object used for tilt (attached by begin()). |
| bool Turret::begin | ( | ) |
Configure pins (coils LOW), attach the servo at home tilt and start the motor task.
|
overridevirtual |
Same as set_target_deg({0, home tilt}).
Implements BaseTurret.
|
overridevirtual |
Manual velocity, each axis -1..1 of its max speed; 0,0 stops (with deceleration).
Implements BaseTurret.
|
overridevirtual |
Current stepper speed, steps/s (signed).
Implements BaseTurret.
|
overridevirtual |
Current angles (pan from the step counter, tilt as last written to the servo).
Implements BaseTurret.
|
overridevirtual |
Move to absolute angles (clamped to the soft limits).
Implements BaseTurret.