2 from test_case
import PinocchioTestCase
as TestCase
4 import pinocchio
as pin
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):
24 res = pin.computeRNEADerivatives(self.
model,self.
data,self.
q,self.
v,self.
a)
26 self.assertTrue(len(res) == 3)
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)
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)
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__':
result_of::push_front< V const, T >::type append(T const &t, V const &v)
Append the element T at the front of boost fusion vector V.
JointDataTpl< Scalar, Options, JointCollectionTpl > createData(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through CreateData visitor to create a JointDataTpl.
def test_static_torque_derivatives(self)
def test_generalized_gravity_derivatives(self)
def test_rnea_derivatives(self)