From c4a4e13196be2fdf738a173ca4e70b2a4eb43590 Mon Sep 17 00:00:00 2001 From: John Lambert Date: Tue, 13 Jul 2021 00:16:24 -0600 Subject: [PATCH] fix assert on angles --- python/gtsam/tests/test_ShonanAveraging.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/python/gtsam/tests/test_ShonanAveraging.py b/python/gtsam/tests/test_ShonanAveraging.py index 8c70df5dff..29a14b1b6c 100644 --- a/python/gtsam/tests/test_ShonanAveraging.py +++ b/python/gtsam/tests/test_ShonanAveraging.py @@ -196,11 +196,13 @@ def test_constructorBetweenFactorPose2s(self) -> None: wRi_list = [result_values.atRot2(i) for i in range(num_images)] thetas_deg = np.array([wRi.degrees() for wRi in wRi_list]) - thetas_deg -= max(thetas_deg) + # map all angles to [0,360) thetas_deg = thetas_deg % 360 + thetas_deg -= max(thetas_deg) + expected_thetas_deg = np.array([0.0, 90.0, 0.0]) - np.testing.assert_allclose(thetas_deg, expected_thetas_deg) + np.testing.assert_allclose(thetas_deg, expected_thetas_deg, atol=0.1) if __name__ == "__main__":