Fix lqi_controller partial/discrete handling; add LQGProblem method; docs port#139
Merged
Conversation
… method - lqi_controller silently mis-wired when integrator_outputs != 1:ny because nr was overwritten to ny. Now nr = length(integrator_outputs) and the feedback comparator/integrator/reference symbols all use the correct subset. - ss(lqi(...)) was created without a timeevol, so the gain block was always continuous-time and connect() rejected it for discrete plants. Stamp the plant's timeevol on it. - Replace c2d(1/s, Ts) for the controller integrator with the same form used by add_output_integrator(::Discrete) (Ts/(z-(1-ϵ))) and expose ϵ as a kwarg so plant augmentation and controller agree even with leakage. - Add lqi_controller(prob::LQGProblem, Qi; ...) that builds the Kalman observer internally and forms Q1_aug = blkdiag(prob.Q1, Qi). - lqi docstring: replace stale Q3 signature with args... and clarify that the reference enters in lqi_controller, not in the augmented plant. - New tests cover MIMO continuous, partial integrator_outputs, discrete-time with ϵ, and the LQGProblem method. - Add an LQI section to docs/src/lqg_disturbance.md showing the explicit error-integration design alongside the disturbance-model approach. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #139 +/- ##
==========================================
+ Coverage 90.87% 90.99% +0.12%
==========================================
Files 20 20
Lines 3045 3055 +10
==========================================
+ Hits 2767 2780 +13
+ Misses 278 275 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lqi_controller(src/lqg.jl):integrator_outputswas silently mis-wired:nrgot overwritten tony, so callinglqi_controllerwith anything other than the defaultintegrator_outputs=1:nyeither errored or produced a controller wired up for a different number of references thanlqihad actually augmented.ss(lqi(...))was created without atimeevol, so the gain block was always continuous-time andconnectrejected it on a discrete plant with"Sampling time mismatch". Now stampsG.timeevolon it.add_output_integrator(::Discrete)— both now usetf(Ts, [1, -(1-ϵ)], Ts)— and exposeϵas a kwarg so plant augmentation and the controller agree even with leakage.lqi_controller(prob::LQGProblem, Qi; integrator_outputs, ϵ)that builds the Kalman observer internally fromproband formsQ1_aug = blkdiag(prob.Q1, Qi). This closes thef(::LQGProblem)API parity gap forlqi_controller.lqidocstring: replace staleQ3in the signature withargs...and clarify that the reference enters at the closed-loop level insidelqi_controller, not in the augmented plant.docs/src/lqg_disturbance.mdshowing the LQI alternative alongside the disturbance-model approach. This replaces the example add integrator option toextended_controller#106 was trying to add (which has been closed in favor of this approach).Test plan
Pkg.test()): 1374 pass, 6 broken (pre-existing), 0 fail.test/test_lqi.jlcases:integrator_outputs=[1]on a 2-output plant — only the integrated channel tracks exactly.ϵ=1e-4— verifies the integrator pole sits at1-ϵ.lqi_controller(::LQGProblem, Qi)— same dimensions and integrator behavior as the explicit-observer form.cd docs && julia --project make.jl— clean build; the new LQG_DIST@exampleblock evaluates without errors.extended_controller#106 (already closed remotely with a comment referencing this work).🤖 Generated with Claude Code