feat(pid): runtime PID tuning via USB + telemetry (bd-18i) #3
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "sl-controls/bd-18i-pid-tuning"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
P<kp>I<ki>D<kd>T<setpoint°>M<max_speed>?{"kp":...,"ki":...,"kd":...}Tuning workflow
Note: bd-18i branch includes bd-2dv changes (mpu6000 fusion). Merge after PR #2.
Closes bd-18i
Add USB command interface for live PID gain adjustment without reflashing: P<kp> I<ki> D<kd> T<setpoint_deg> M<max_speed> ? Command parsing runs in main loop (sscanf-safe), not in USB IRQ. USB IRQ copies command to shared volatile buffer (cdc_cmd_buf), sets flag. Acknowledgement echoes current gains: {"kp":...,"ki":...,"kd":...} Bounds checking: kp 0-500, ki/kd 0-50, setpoint ±20°, max_speed 0-1000. Gains validated before write — silently ignored if out of range. Telemetry updated from raw counts to physical tuning signals: pitch (°x10), pitch_rate (°/s x10), error (°x10), integral (x10 for windup monitoring), motor_cmd, state Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>69f2fa0532to34fdb5d11b