2 import pinocchio
as pin
4 from test_case
import PinocchioTestCase
as TestCase
8 self.
model = pin.buildSampleModelHumanoidRandom()
13 q = pin.neutral(self.
model)
14 pin.forwardKinematics(self.
model,data2,q)
15 jointId = self.
model.njoints-1
16 self.assertNotEqual(self.
data.oMi[jointId], data2.oMi[jointId])
19 self.assertEqual(data2.oMi[jointId], data3.oMi[jointId])
25 q = pin.neutral(model)
26 pin.centerOfMass(model,data,q)
28 com_list = data.com.tolist()
30 with self.assertRaises(Exception)
as context:
31 com = data.com[len(data.com)+10]
34 self.assertTrue(
'Index out of range' in str(context.exception))
36 with self.assertRaises(Exception)
as context:
40 self.assertTrue(
'Invalid index type' in str(context.exception))
46 filename =
"data.pickle" 47 with
open(filename,
'wb')
as f:
50 with
open(filename,
'rb')
as f:
51 data_copy = pickle.load(f)
53 self.assertTrue(data == data_copy)
55 if __name__ ==
'__main__':
JointDataTpl< Scalar, Options, JointCollectionTpl > createData(const JointModelTpl< Scalar, Options, JointCollectionTpl > &jmodel)
Visit a JointModelTpl through CreateData visitor to create a JointDataTpl.
def test_std_vector_field(self)
void copy(const ModelTpl< Scalar, Options, JointCollectionTpl > &model, const DataTpl< Scalar, Options, JointCollectionTpl > &origin, DataTpl< Scalar, Options, JointCollectionTpl > &dest, KinematicLevel kinematic_level)
Copy part of the data from origin to dest. Template parameter can be used to select at which differen...