Commit cf9c85b8 authored by Pierre Fernbach's avatar Pierre Fernbach
Browse files

[Tests][Python] test_com_trajectory_helper use isclose instead of array_equal

parent bf64feb1
......@@ -3,7 +3,7 @@
import unittest
import numpy as np
from numpy import array, array_equal, random
from numpy import array, array_equal, random, isclose
from random import uniform
from math import sqrt, sin, cos
......@@ -1218,20 +1218,20 @@ class ContactPhaseTest(unittest.TestCase):
self.assertEqual(cp.c_t.max(), time_points[-1])
self.assertEqual(cp.dc_t.dim(), 3)
for i in range(N):
self.assertTrue(array_equal(cp.c_t(time_points[i, 0]), points[:,i]))
self.assertTrue(array_equal(cp.dc_t(time_points[i, 0]), points_derivative[:,i]))
self.assertTrue(array_equal(cp.ddc_t(time_points[i, 0]), points_second_derivative[:,i]))
self.assertTrue(isclose(cp.c_t(time_points[i, 0]), points[:,i]).all())
self.assertTrue(isclose(cp.dc_t(time_points[i, 0]), points_derivative[:,i]).all())
self.assertTrue(isclose(cp.ddc_t(time_points[i, 0]), points_second_derivative[:,i]).all())
cp.setAMtrajectoryFromPoints(points,points_derivative,time_points)
for i in range(N):
self.assertTrue(array_equal(cp.L_t(time_points[i, 0]), points[:,i]))
self.assertTrue(array_equal(cp.dL_t(time_points[i, 0]), points_derivative[:,i]))
self.assertTrue(isclose(cp.L_t(time_points[i, 0]), points[:,i]).all())
self.assertTrue(isclose(cp.dL_t(time_points[i, 0]), points_derivative[:,i]).all())
cp.setJointsTrajectoryFromPoints(points,points_derivative,points_second_derivative,time_points)
for i in range(N):
self.assertTrue(array_equal(cp.q_t(time_points[i, 0]), points[:,i]))
self.assertTrue(array_equal(cp.dq_t(time_points[i, 0]), points_derivative[:,i]))
self.assertTrue(array_equal(cp.ddq_t(time_points[i, 0]), points_second_derivative[:,i]))
self.assertTrue(isclose(cp.q_t(time_points[i, 0]), points[:,i]).all())
self.assertTrue(isclose(cp.dq_t(time_points[i, 0]), points_derivative[:,i]).all())
self.assertTrue(isclose(cp.ddq_t(time_points[i, 0]), points_second_derivative[:,i]).all())
class ContactSequenceTest(unittest.TestCase):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment