2 import pinocchio
as pin
10 self.assertTrue(np.allclose(
zero(3), f.linear))
11 self.assertTrue(np.allclose(
zero(3), f.angular))
12 self.assertTrue(np.allclose(
zero(6), f.vector))
18 self.assertFalse(np.allclose(
zero(3), f.linear))
19 self.assertFalse(np.allclose(
zero(3), f.angular))
20 self.assertFalse(np.allclose(
zero(6), f.vector))
26 self.assertTrue(np.allclose(
zero(3), f.linear))
27 self.assertTrue(np.allclose(
zero(3), f.angular))
28 self.assertTrue(np.allclose(
zero(6), f.vector))
34 self.assertTrue(np.allclose(f.linear, lin))
37 self.assertTrue(f.linear[1] == 1.)
43 self.assertTrue(np.allclose(f.angular, ang))
46 self.assertTrue(f.angular[1] == 1.)
52 self.assertTrue(np.allclose(f.vector, vec))
55 f1 = pin.Force.Random()
56 f2 = pin.Force.Random()
57 self.assertTrue(np.allclose((f1+f2).vector,f1.vector + f2.vector))
58 self.assertTrue(np.allclose((f1 - f2).vector, f1.vector - f2.vector))
61 f = pin.Force.Random()
63 self.assertTrue(np.allclose((m * f).vector, np.linalg.inv(m.action.T).dot(f.vector)))
64 self.assertTrue(np.allclose(m.act(f).vector, np.linalg.inv(m.action.T).dot(f.vector)))
65 self.assertTrue(np.allclose((m.actInv(f)).vector, m.action.T.dot(f.vector)))
66 v = pin.Motion(np.concatenate([f.vector[3:], f.vector[:3]]))
67 self.assertTrue(np.allclose((v ^ f).vector,
zero(6)))
71 f = pin.Force.Random()
74 f_from_array = pin.Force(f_array)
76 self.assertTrue(f_from_array == f)
79 for _
in range(100000):
80 f = pin.Force.Zero() + pin.Force.Zero()
81 self.assertTrue(np.allclose(f.vector,
zero(6)))
83 if __name__ ==
'__main__':
def test_several_init(self)
def test_zero_getters(self)
def test_set_angular(self)
def test_set_vector(self)
def test_conversion(self)
def test_set_linear(self)
def test_internal_sums(self)
def test_se3_action(self)