4 import pinocchio
as pin
11 self.assertTrue(np.allclose(
zero(3), v.linear))
12 self.assertTrue(np.allclose(
zero(3), v.angular))
13 self.assertTrue(np.allclose(
zero(6), v.vector))
19 self.assertFalse(np.allclose(
zero(3), v.linear))
20 self.assertFalse(np.allclose(
zero(3), v.angular))
21 self.assertFalse(np.allclose(
zero(6), v.vector))
27 self.assertTrue(np.allclose(
zero(3), v.linear))
28 self.assertTrue(np.allclose(
zero(3), v.angular))
29 self.assertTrue(np.allclose(
zero(6), v.vector))
35 self.assertTrue(np.allclose(v.linear, lin))
38 self.assertTrue(v.linear[1] == 1.0)
44 self.assertTrue(np.allclose(v.angular, ang))
47 self.assertTrue(v.angular[1] == 1.0)
53 self.assertTrue(np.allclose(v.vector, vec))
56 v1 = pin.Motion.Random()
57 v2 = pin.Motion.Random()
58 self.assertTrue(np.allclose((v1 + v2).vector, v1.vector + v2.vector))
59 self.assertTrue(np.allclose((v1 - v2).vector, v1.vector - v2.vector))
63 v = pin.Motion.Random()
64 self.assertTrue(np.allclose((m * v).vector, m.action.dot(v.vector)))
65 self.assertTrue(np.allclose(m.act(v).vector, m.action.dot(v.vector)))
67 np.allclose((m.actInv(v)).vector, np.linalg.inv(m.action).dot(v.vector))
69 self.assertTrue(np.allclose((v ^ v).vector,
zero(6)))
72 m = pin.Motion.Random()
75 m_from_array = pin.Motion(m_array)
77 self.assertTrue(m_from_array == m)
80 for _
in range(100000):
81 v = pin.Motion.Zero() + pin.Motion.Zero()
82 self.assertTrue(np.allclose(v.vector,
zero(6)))
85 if __name__ ==
"__main__":