5 import pinocchio
as pin
8 from test_case
import PinocchioTestCase
as TestCase
15 self.assertApprox(m,
eye(3))
20 self.assertApprox(m,
eye(3))
25 self.assertApprox(v,
zero(3))
28 """Test log3 over the quaternions."""
29 from eigenpy
import Quaternion
31 quat_v = np.array([0.0, 0.0, 0.0, 1.0])
34 self.assertApprox(v0,
zero(3))
37 self.assertApprox(v1,
zero(3))
40 self.assertApprox(pin.exp3_quat(
zero(3)), np.array([0.0, 0.0, 0.0, 1.0]))
45 self.assertApprox(J,
eye(3))
50 self.assertTrue(M.isIdentity())
52 M2 = pin.exp6(np.array(v))
53 self.assertTrue(M2.isIdentity())
58 self.assertApprox(J,
eye(6))
60 J2 = pin.Jexp6(np.array(v))
61 self.assertApprox(J, J2)
64 m = pin.SE3.Identity()
66 self.assertApprox(v.vector,
zero(6))
71 self.assertApprox(v.vector,
zero(6))
74 q0 = np.array([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0])
76 self.assertApprox(v.vector,
zero(6))
79 m = pin.SE3.Identity()
81 self.assertApprox(J,
eye(6))
88 u_unskew = pin.unSkew(u_skew)
90 self.assertApprox(u, u_unskew)
93 u_v_square = pin.skewSquare(u, v)
95 self.assertApprox(u_v_square, u_skew.dot(v_skew))
98 self.assertApprox(
exp(42), math.exp(42))
99 self.assertApprox(
log(42), math.log(42))
100 self.assertApprox(
exp(
log(42)), 42)
101 self.assertApprox(
log(
exp(42)), 42)
104 self.assertLess(np.linalg.norm(m), np.pi)
105 self.assertApprox(
log(
exp(m)), m)
107 m = np.random.rand(3)
108 self.assertLess(np.linalg.norm(m), np.pi)
109 self.assertApprox(
log(
exp(m)), m)
112 self.assertApprox(
exp(
log(m)), m)
116 np.linalg.norm(m), np.pi
118 self.assertApprox(
log(
exp(m)), m)
120 m = np.random.rand(6)
122 np.linalg.norm(m), np.pi
124 self.assertApprox(
log(
exp(m)), m)
127 self.assertApprox(
exp(
log(m)).homogeneous, m)
129 with self.assertRaises(ValueError):
131 with self.assertRaises(ValueError):
133 with self.assertRaises(ValueError):
135 with self.assertRaises(ValueError):
137 with self.assertRaises(ValueError):
141 if __name__ ==
"__main__":