3 import pinocchio
as pin
8 jc = pin.JointModelComposite()
9 self.assertTrue(hasattr(jc,
"joints"))
10 self.assertTrue(hasattr(jc,
"njoints"))
11 self.assertTrue(hasattr(jc,
"jointPlacements"))
14 jc = pin.JointModelComposite()
15 self.assertTrue(jc.nq == 0)
16 self.assertTrue(len(jc.joints) == 0)
17 self.assertTrue(jc.njoints == len(jc.joints))
20 jc = pin.JointModelComposite(2)
21 self.assertTrue(jc.nq == 0)
22 self.assertTrue(len(jc.joints) == 0)
23 self.assertTrue(jc.njoints == len(jc.joints))
26 j1 = pin.JointModelRX()
27 self.assertTrue(j1.nq == 1)
29 jc1 = pin.JointModelComposite(j1)
30 self.assertTrue(jc1.nq == 1)
31 self.assertTrue(len(jc1.joints) == 1)
32 self.assertTrue(jc1.njoints == len(jc1.joints))
34 j2 = pin.JointModelRX()
35 self.assertTrue(j2.nq == 1)
37 jc2 = pin.JointModelComposite(j1, pin.SE3.Random())
38 self.assertTrue(jc2.nq == 1)
39 self.assertTrue(len(jc2.joints) == 1)
40 self.assertTrue(jc2.njoints == len(jc2.joints))
43 j1 = pin.JointModelRX()
44 self.assertTrue(j1.nq == 1)
45 j2 = pin.JointModelRY()
46 self.assertTrue(j2.nq == 1)
47 j3 = pin.JointModelRZ()
48 self.assertTrue(j3.nq == 1)
50 jc = pin.JointModelComposite(2)
51 self.assertTrue(jc.nq == 0)
52 self.assertTrue(len(jc.joints) == 0)
53 self.assertTrue(jc.njoints == len(jc.joints))
56 self.assertTrue(jc.nq == 1)
57 self.assertTrue(len(jc.joints) == 1)
58 self.assertTrue(jc.njoints == len(jc.joints))
61 self.assertTrue(jc.nq == 2)
62 self.assertTrue(len(jc.joints) == 2)
63 self.assertTrue(jc.njoints == len(jc.joints))
65 jc.addJoint(j3, pin.SE3.Random())
66 self.assertTrue(jc.nq == 3)
67 self.assertTrue(jc.njoints == len(jc.joints))
70 jc1 = pin.JointModelComposite()
71 jc2 = jc1.addJoint(pin.JointModelRX())
72 jc3 = jc2.addJoint(pin.JointModelRY())
73 jc4 = jc1.addJoint(pin.JointModelRZ())
74 self.assertTrue(jc1.njoints == 3)
75 self.assertTrue(jc2.njoints == 3)
76 self.assertTrue(jc3.njoints == 3)
77 self.assertTrue(jc4.njoints == 3)
82 self.assertTrue(jc2.njoints == 3)
85 j1 = pin.JointModelRX()
86 self.assertTrue(j1.nq == 1)
87 j2 = pin.JointModelRY()
88 self.assertTrue(j2.nq == 1)
89 j3 = pin.JointModelRZ()
90 self.assertTrue(j3.nq == 1)
92 jc = pin.JointModelComposite(j1).addJoint(j2, pin.SE3.Random()).addJoint(j3)
94 self.assertTrue(jc.nq == 3)
95 self.assertTrue(len(jc.joints) == 3)
96 self.assertTrue(jc.njoints == len(jc.joints))
99 if __name__ ==
"__main__":