Skip to content

Commit 7b68f28

Browse files
committed
[tests/python] Fix threshold in test_center_of_mass, always run
1 parent 84d1307 commit 7b68f28

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

tests/python/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ if(NOT BUILD_WITH_PINOCCHIO_PYTHON_BINDINGS)
1515
list(REMOVE_ITEM PYTHON_TESTS test_frames.py)
1616
endif()
1717
if(NOT PINOCCHIO_V3)
18-
list(REMOVE_ITEM PYTHON_TESTS test_center_of_mass.py)
1918
list(REMOVE_ITEM PYTHON_TESTS test_constrained_dynamics.py)
2019
list(REMOVE_ITEM PYTHON_TESTS test_finite_diff.py)
2120
list(REMOVE_ITEM PYTHON_TESTS test_frames.py)

tests/python/test_center_of_mass.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
model = pin.buildSampleModelHumanoid()
1313
rdata: pin.Data = model.createData()
1414
np.random.seed(0)
15-
FD_EPS = 1e-8
16-
THRESH = 2 * FD_EPS**0.5
15+
EPS = 1e-7
16+
ATOL = 2 * EPS**0.5
1717

1818
nq = model.nq
1919
nv = model.nv
@@ -55,7 +55,7 @@ def test_com_placement():
5555
assert J.shape == realJ.shape
5656
assert np.allclose(fdata.Jx[:, :nv], realJ)
5757

58-
fun_fd = aligator.FiniteDifferenceHelper(space, fun, FD_EPS)
58+
fun_fd = aligator.FiniteDifferenceHelper(space, fun, EPS)
5959
fdata2 = fun_fd.createData()
6060
fun_fd.evaluate(x0, u0, x0, fdata2)
6161
assert np.allclose(fdata.value, fdata2.value)
@@ -70,7 +70,7 @@ def test_com_placement():
7070
fun.computeJacobians(x0, u0, x0, fdata)
7171
fun_fd.evaluate(x0, u0, x0, fdata2)
7272
fun_fd.computeJacobians(x0, u0, x0, fdata2)
73-
assert np.allclose(fdata.Jx, fdata2.Jx, THRESH)
73+
assert np.allclose(fdata.Jx, fdata2.Jx, ATOL)
7474

7575

7676
def test_frame_velocity():
@@ -94,7 +94,7 @@ def test_frame_velocity():
9494

9595
fun.computeJacobians(x0, fdata)
9696

97-
fun_fd = aligator.FiniteDifferenceHelper(space, fun, FD_EPS)
97+
fun_fd = aligator.FiniteDifferenceHelper(space, fun, EPS)
9898
fdata2 = fun_fd.createData()
9999
fun_fd.evaluate(x0, u0, x0, fdata2)
100100
fun_fd.computeJacobians(x0, u0, x0, fdata2)
@@ -110,7 +110,7 @@ def test_frame_velocity():
110110
print(fdata.Jx)
111111
print(fdata2.Jx)
112112
print(fdata.Jx)
113-
assert np.allclose(fdata.Jx, fdata2.Jx, THRESH)
113+
assert np.allclose(fdata.Jx, fdata2.Jx, ATOL)
114114

115115

116116
if __name__ == "__main__":

0 commit comments

Comments
 (0)