2 from test_case
import PinocchioTestCase
as TestCase
4 import pinocchio
as pin
10 self.
model = pin.buildSampleModelHumanoidRandom()
11 self.
data = self.model.createData()
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):
20 self.fext.append(pin.Force.Random())
24 res = pin.computeRNEADerivatives(self.
model,self.
data,self.
q,self.
v,self.
a)
26 self.assertTrue(len(res) == 3)
28 data2 = self.model.createData()
29 pin.rnea(self.
model,data2,self.
q,self.
v,self.
a)
31 self.assertApprox(self.data.ddq,data2.ddq)
34 res = pin.computeRNEADerivatives(self.
model,self.
data,self.
q,self.
v,self.
a,self.
fext)
36 self.assertTrue(len(res) == 3)
38 pin.rnea(self.
model,data2,self.
q,self.
v,self.
a,self.
fext)
40 self.assertApprox(self.data.ddq,data2.ddq)
44 res = pin.computeGeneralizedGravityDerivatives(self.
model,self.
data,self.
q)
46 data2 = self.model.createData()
47 ref,_,_ = pin.computeRNEADerivatives(self.
model,data2,self.
q,self.
v*0,self.
a*0)
49 self.assertApprox(res,ref)
53 res = pin.computeStaticTorqueDerivatives(self.
model,self.
data,self.
q,self.
fext)
55 data2 = self.model.createData()
56 ref,_,_ = pin.computeRNEADerivatives(self.
model,data2,self.
q,self.
v*0,self.
a*0,self.
fext)
58 self.assertApprox(res,ref)
60 if __name__ ==
'__main__':
def test_static_torque_derivatives(self)
def test_generalized_gravity_derivatives(self)
def test_rnea_derivatives(self)