You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 79e2fdc
Browse filesBrowse the repository at this point in the historyBrowse files
fix(lqr): forward MaxIterations through Lqr and IntegralStateFeedbackLqi (#279)
Systems sampled at high frequencies produce discrete poles near the unit
circle that require far more than the default 300 DARE iterations to
converge. Without a way to raise the cap, Lqr hard-asserted on the
converged=false result regardless of whether the caller could tolerate a
slower solve.
Add MaxIterations = 300 as a fourth template parameter to Lqr and a fifth
to IntegralStateFeedbackLqi, forwarding it to
DiscreteAlgebraicRiccatiEquation. All existing call sites are unaffected
by the defaulted parameter. Closes#274.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
-**Sample-time mismatch**: the discrete integral $x_i$ accumulates $T_s$-scaled errors.
83
83
Using the wrong $T_s$ at run time shifts the effective integral gain and breaks zero-error
84
84
convergence.
85
+
-**Slow DARE convergence**: the augmented plant $(A_a, B_a)$ has eigenvalues at exactly 1, and at high sampling rates those eigenvalues approach 1 from many directions, requiring many more DARE iterations than the default 300. Raise the cap via the `MaxIterations` template parameter: `IntegralStateFeedbackLqi<float, StateSize, InputSize, OutputSize, 30000>`.
-**Q/R scaling.** Only the *ratio* of $Q$ to $R$ matters. Scaling both by the same factor does not change $K$.
88
88
-**Full state required.** LQR assumes all states are measured. If only partial measurements are available, combine LQR with a [Kalman Filter](../filters/active/KalmanFilter.md) to form an LQG controller.
89
89
-**Fixed-point limitations.** The DARE involves matrix inversions and multiplications that can overflow Q15/Q31 ranges. Prefer floating-point for the offline solve; use the pre-computed $K$ constructor for fixed-point runtime.
90
+
-**Slow DARE convergence.** Systems with eigenvalues near the unit circle (e.g., high-frequency sampling, integrating plants) may require far more than the default 300 iterations to converge. Use the `MaxIterations` template parameter to raise the cap: `Lqr<float, StateSize, InputSize, 30000>`. A hard-assert fires if the solver does not converge within the specified limit.
0 commit comments