Skip to content

Commit

Permalink
Reuse methods rather than defining new ones
Browse files Browse the repository at this point in the history
  • Loading branch information
cmower committed Aug 11, 2023
1 parent 705570e commit 4de925b
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@ def random_vector(lo=-1, hi=1, n=3):
return np.random.uniform(-lo, hi, size=(n,))


def isclose(A: np.ndarray, B: np.ndarray):
return np.isclose(A, B).all()


def iscloseRNEA(A: np.ndarray, B: np.ndarray):
return np.isclose(A, B, atol=8.0e-2).all()
def isclose(A: np.ndarray, B: np.ndarray, atol=1e-08):
return np.isclose(A, B, atol=atol).all()


###########################################################################
Expand Down Expand Up @@ -1013,8 +1009,6 @@ def test_get_global_link_axis_function(self):
assert isinstance(axis(q), optas.SX)




class TestRnea:
# Setup path to tester robot URDF
cwd = pathlib.Path(__file__).parent.resolve() # path to current working directory
Expand Down Expand Up @@ -1055,4 +1049,4 @@ def test_calculate_inverse_dynamics(self):
self.id, q.tolist(), qd.tolist(), qdd.tolist()
)
)
assert iscloseRNEA(tau1.toarray().flatten(), tau2)
assert isclose(tau1.toarray().flatten(), tau2, atol=8.0e-2)

0 comments on commit 4de925b

Please sign in to comment.