Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
AtsushiSakai committed Feb 15, 2017
1 parent dbd4425 commit 57d71d5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
22 changes: 12 additions & 10 deletions mpc_modeling/mpc_modeling_with_ECOS.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,12 @@ def test3():
plt.legend()
plt.grid(True)

x, u = opt_mpc_with_state_constr(A, B, N, Q, R, P, x0, umax=umax, umin=umin)
x1 = np.array(x[0, :]).flatten()
x2 = np.array(x[1, :]).flatten()
u = np.array(u).flatten()
x, u = opt_mpc_with_state_constr(A, B, N, Q, R, P, x0, umax=umax, umin=umin)
x1 = np.array(x[0, :]).flatten()
x2 = np.array(x[1, :]).flatten()
u = np.array(u).flatten()

if DEBUG_:
# flg, ax = plt.subplots(1)
plt.plot(x1, '*r', label="x1")
plt.plot(x2, '*b', label="x2")
Expand Down Expand Up @@ -218,12 +219,13 @@ def test4():
rx2 = np.array(x[1, :]).flatten()
ru = np.array(u[0, :]).flatten()

flg, ax = plt.subplots(1)
plt.plot(rx1, label="x1")
plt.plot(rx2, label="x2")
plt.plot(ru, label="u")
plt.legend()
plt.grid(True)
if DEBUG_:
flg, ax = plt.subplots(1)
plt.plot(rx1, label="x1")
plt.plot(rx2, label="x2")
plt.plot(ru, label="u")
plt.legend()
plt.grid(True)

x, u = opt_mpc_with_state_constr(A, B, N, Q, R, P, x0)
x1 = np.array(x[0, :]).flatten()
Expand Down
4 changes: 4 additions & 0 deletions tests/test_mpc_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
author Atsushi Sakai
"""
import unittest

import sys
sys.path.append("./mpc_tracking/")

import mpc_tracking.mpc_tracking


Expand Down

0 comments on commit 57d71d5

Please sign in to comment.