Skip to content

Commit d01a52c

Browse files
committed
fix optimal unit tests (matrix case) + PEP8
1 parent 994fedc commit d01a52c

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

control/tests/iosys_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ def nlsys_output(t, x, u, params):
745745
return C @ x
746746
nlsys = ct.NonlinearIOSystem(
747747
nlsys_update, nlsys_output, inputs=1, outputs=1, states=2, dt=True)
748-
748+
749749
# Set up parameters for simulation
750750
T, U, X0 = tsys.T, tsys.U, tsys.X0
751751

control/tests/optimal_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def test_discrete_lqr():
9191
lqr_sys, time, 0, x0, return_x=True)
9292

9393
# Use LQR input as initial guess to avoid convergence/precision issues
94-
lqr_u = -K @ lqr_x[0:time.size]
94+
lqr_u = np.array(-K @ lqr_x[0:time.size]) # convert from matrix
9595

9696
# Formulate the optimal control problem and compute optimal trajectory
9797
optctrl = opt.OptimalControlProblem(

0 commit comments

Comments
 (0)