4 import pinocchio
as pin
5 from test_case
import PinocchioTestCase
as TestCase
10 self.
model = pin.buildSampleModelHumanoidRandom()
13 qmax = np.full((self.
model.nq, 1), np.pi)
14 self.
q = pin.randomConfiguration(self.
model, -qmax, qmax)
15 self.
v = np.random.rand(self.
model.nv)
16 self.
a = np.random.rand(self.
model.nv)
19 for _
in range(self.
model.njoints):
23 res = pin.computeRNEADerivatives(self.
model, self.
data, self.
q, self.
v, self.
a)
25 self.assertTrue(len(res) == 3)
28 pin.rnea(self.
model, data2, self.
q, self.
v, self.
a)
30 self.assertApprox(self.
data.ddq, data2.ddq)
33 res = pin.computeRNEADerivatives(
37 self.assertTrue(len(res) == 3)
39 pin.rnea(self.
model, data2, self.
q, self.
v, self.
a, self.
fext)
41 self.assertApprox(self.
data.ddq, data2.ddq)
44 res = pin.computeGeneralizedGravityDerivatives(self.
model, self.
data, self.
q)
47 ref, _, _ = pin.computeRNEADerivatives(
48 self.
model, data2, self.
q, self.
v * 0, self.
a * 0
51 self.assertApprox(res, ref)
54 res = pin.computeStaticTorqueDerivatives(
59 ref, _, _ = pin.computeRNEADerivatives(
60 self.
model, data2, self.
q, self.
v * 0, self.
a * 0, self.
fext
63 self.assertApprox(res, ref)
66 if __name__ ==
"__main__":