Skip to content

Commit 80c3d11

Browse files
committed
args...
1 parent 20985d5 commit 80c3d11

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/lqg.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ L = lqi(sys, Q1, Q2)
654654
655655
See also [`lqi_controller`](@ref).
656656
"""
657-
function lqi(sys::AbstractStateSpace, Q1::AbstractMatrix, Q2::AbstractMatrix;
657+
function lqi(sys::AbstractStateSpace, Q1::AbstractMatrix, Q2::AbstractMatrix, args...;
658658
integrator_outputs=1:sys.ny, ϵ=0)
659659

660660
# Validate inputs
@@ -665,7 +665,7 @@ function lqi(sys::AbstractStateSpace, Q1::AbstractMatrix, Q2::AbstractMatrix;
665665
size(Q2, 1) == sys.nu || throw(ArgumentError("Q2 must have size $(sys.nu)×$(sys.nu)"))
666666

667667
sys_aug = add_output_integrator(sys, integrator_outputs; ϵ=ϵ, neg=true)
668-
lqr(sys_aug, Q1, Q2)
668+
lqr(sys_aug, Q1, Q2, args...)
669669
end
670670

671671

@@ -699,8 +699,8 @@ plot(
699699
)
700700
```
701701
"""
702-
function lqi_controller(G, obs, Q1, Q2)
703-
L = -named_ss(ss(lqi(G, Q1, Q2)), name="L", x=:x_L, y=:y_L, u=:u_L)
702+
function lqi_controller(G, obs, Q1, Q2, args...)
703+
L = named_ss(ss(lqi(G, Q1, Q2, args...)), name="L", x=:x_L, y=:y_L, u=:u_L)
704704
G isa NamedStateSpace || (G = named_ss(G, name="plant", x=:x_plant, y=:y_plant, u=:u_plant))
705705
obs isa NamedStateSpace || (obs = named_ss(obs, name="observer", x=:x_observer, y=:y_observer, u=:u_observer))
706706

@@ -738,5 +738,6 @@ function lqi_controller(G, obs, Q1, Q2)
738738
unit_gain.y .=> obs.u[observer_output_inds];
739739
unit_gain.y .=> add_feedback.u[nr+1:end]
740740
]
741-
connect([add_feedback, integrator, L, obs, unit_gain], connections; external_inputs, external_outputs)
741+
# Negate obs to output -x̂
742+
connect([add_feedback, integrator, L, -obs, unit_gain], connections; external_inputs, external_outputs)
742743
end

0 commit comments

Comments
 (0)