2 import pinocchio
as pin
4 from test_case
import PinocchioTestCase
as TestCase
8 self.
model = pin.buildSampleModelHumanoidRandom()
9 self.
data = self.model.createData()
12 data2 = self.data.copy()
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__':
def test_std_vector_field(self)