4 import pinocchio
as pin
11 self.assertTrue(np.allclose(
zero(3), f.linear))
12 self.assertTrue(np.allclose(
zero(3), f.angular))
13 self.assertTrue(np.allclose(
zero(6), f.vector))
19 self.assertFalse(np.allclose(
zero(3), f.linear))
20 self.assertFalse(np.allclose(
zero(3), f.angular))
21 self.assertFalse(np.allclose(
zero(6), f.vector))
27 self.assertTrue(np.allclose(
zero(3), f.linear))
28 self.assertTrue(np.allclose(
zero(3), f.angular))
29 self.assertTrue(np.allclose(
zero(6), f.vector))
35 self.assertTrue(np.allclose(f.linear, lin))
38 self.assertTrue(f.linear[1] == 1.0)
44 self.assertTrue(np.allclose(f.angular, ang))
47 self.assertTrue(f.angular[1] == 1.0)
53 self.assertTrue(np.allclose(f.vector, vec))
56 f1 = pin.Force.Random()
57 f2 = pin.Force.Random()
58 self.assertTrue(np.allclose((f1 + f2).vector, f1.vector + f2.vector))
59 self.assertTrue(np.allclose((f1 - f2).vector, f1.vector - f2.vector))
62 f = pin.Force.Random()
65 np.allclose((m * f).vector, np.linalg.inv(m.action.T).dot(f.vector))
68 np.allclose(m.act(f).vector, np.linalg.inv(m.action.T).dot(f.vector))
70 self.assertTrue(np.allclose((m.actInv(f)).vector, m.action.T.dot(f.vector)))
71 v = pin.Motion(np.concatenate([f.vector[3:], f.vector[:3]]))
72 self.assertTrue(np.allclose((v ^ f).vector,
zero(6)))
75 f = pin.Force.Random()
78 f_from_array = pin.Force(f_array)
80 self.assertTrue(f_from_array == f)
83 for _
in range(100000):
84 f = pin.Force.Zero() + pin.Force.Zero()
85 self.assertTrue(np.allclose(f.vector,
zero(6)))
88 if __name__ ==
"__main__":