Skip to content

Commit 321e447

Browse files
committed
wip: offsets
1 parent c3e19f8 commit 321e447

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

ext/LinearMPCext.jl

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@ function Base.convert(::Type{LinearMPC.MPC}, mpc::ModelPredictiveControl.LinMPC)
1717
Nc = Hc = mpc.Hc
1818
newmpc = LinearMPC.MPC(F, G; Gd, C, Dd, Np, Nc)
1919
# --- Operating points ---
20-
xo = estim.x̂op
21-
uo = model.uop
22-
yo = model.yop
23-
!iszero(yo) && error("LinearMPC does not support non-zero output operating points yop.")
24-
if !iszero(model.dop)
25-
@warn "LinearMPC does not support measured disturbance operating points dop.\n" *
26-
"Ensure to subtract the operating point from the measurement at each time "*
27-
"step before solving the MPC problem."
28-
end
29-
LinearMPC.set_operating_point!(newmpc; xo, uo, relinearize=false)
20+
uoff = model.uop
21+
doff = model.dop
22+
yoff = model.yop
23+
xoff = estim.x̂op
24+
foff = estim.f̂op
25+
LinearMPC.set_offset!(newmpc; uo=uoff, ho=yoff)
3026
# --- State observer parameters ---
3127
Q, R = estim.cov.Q̂, estim.cov.
3228
set_state_observer!(newmpc; C=estim.Ĉm, Q, R)

0 commit comments

Comments
 (0)