Skip to content

Commit d3278ed

Browse files
committed
added: custom constraint conversion now works
1 parent f5baa5f commit d3278ed

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

ext/LinearMPCext.jl

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,14 @@ function Base.convert(::Type{LinearMPC.MPC}, mpc::ModelPredictiveControl.LinMPC)
134134

135135
lb_k_i = wmin_k[i:i] - Wy_i*yoff
136136
ub_k_i = wmax_k[i:i] - Wy_i*yoff
137-
@show lb_k_i
138-
@show ub_k_i
139137
lb = isfinite(lb_k_i[]) ? lb_k_i : zeros(0)
140138
ub = isfinite(ub_k_i[]) ? ub_k_i : zeros(0)
141139
soft = !only_hard && c_w_k[i] > 0
142140
Ax = Wy_i*C
143-
Ad = Wy_i*Dd
144-
@show Ax
145-
@show Ad
146-
LinearMPC.add_constraint!(newmpc; Ax, Ad, lb, ub, ks, soft)
147-
141+
Au = Wu_i
142+
Ad = Wy_i*Dd + Wd_i
143+
Ar = Wr_i
144+
LinearMPC.add_constraint!(newmpc; Ax, Au, Ad, Ar, lb, ub, ks, soft)
148145
end
149146
end
150147
# --- Terminal constraints ---

0 commit comments

Comments
 (0)