বাতাসA thrust-vector gimbal, 12 September 2024

A filter with no memory

State has to live somewhere. And units are part of the gain.

What happened
A 2024 thrust-vector-control gimbal: an MPU6050 and two SG90 servos, PID on the tilt. Read again in 2026.
What I believed
v1 fuses gyro and accelerometer with a complementary filter (0.96 / 0.04).
What was true
Each call creates a new uninitialized local angleX, rather than retaining the previous estimate. V2 separates X and Y loops but uses accelerometer-only angles. Its I and D gains use milliseconds, so their numerical values cannot be copied unchanged into a seconds-based loop. Servo commands are clamped; the error integrals are not.
Next time
Persist filter state; specify time and gain units; handle a zero interval and actuator saturation.
Evidence
gist v1 (2024-09-12), gist V2 (2024-09-13)