Skip to content

Commit 24ee76f

Browse files
committed
updated unit test + flatness calc; working
1 parent 7488c78 commit 24ee76f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

test/linsys_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class TestLinsys(unittest.TestCase):
1717
def setUp(self):
1818
self.maxStates = 5 # maximum number of states to try
1919
self.numTests = 4 # number of tests per system size
20-
self.debug = True # turn on debugging output
20+
self.debug = False # turn on debugging output
2121

2222
def test_point_to_point(self):
2323
# Machine precision for floats.
@@ -45,8 +45,8 @@ def test_point_to_point(self):
4545
# Generate a trajectory from start to stop
4646
systraj = tg.linear_point_to_point(linsys, x0, xf, Tf)
4747
xd, ud = systraj.eval((0,Tf))
48-
np.testing.assert_array_almost_equal(x0, xd[0,:])
49-
np.testing.assert_array_almost_equal(xf, xd[1,:])
48+
np.testing.assert_array_almost_equal(x0, xd[0,:], decimal=4)
49+
np.testing.assert_array_almost_equal(xf, xd[1,:], decimal=4)
5050

5151
def suite():
5252
return unittest.TestLoader().loadTestsFromTestCase(TestLinsys)

trajgen/linflat.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def __init__(self, sys):
2222

2323
# Compute state and input from flat flag
2424
def reverse(self, zflag):
25-
x = self.Tinv * np.matrix(zflag[-2::-1]).T
26-
u = zflag[-1] - self.F * x
25+
z = np.matrix(zflag[-2::-1]).T
26+
x = self.Tinv * z
27+
u = zflag[-1] - self.F * z
2728
return np.reshape(x, self.states), np.reshape(u, self.inputs)

0 commit comments

Comments
 (0)