Low-Latency Control Loop
Write a high-rate PID control loop in C designed for low latency. The loop computes a new output based on error, integral, and derivative terms, and clamps output to safe limits.
Constraints
- dt fixed.
- Use float arithmetic.
- anti-windup on integral.
- output clamp.
- Function signature: float pid(float set, float meas).
- Must run fast (inline where possible).
1float pid(float set, float meas);