bindings_std_map.py
Go to the documentation of this file.
1 import unittest
2 from test_case import PinocchioTestCase as TestCase
3 
4 import pinocchio as pin
5 import numpy as np
6 
7 import pickle
8 
9 class TestStdMap(TestCase):
10 
11  def setUp(self):
12  pass
13 
14  def test_pickle(self):
15  map = pin.StdMap_String_VectorXd()
16  keys = []
17  for k in range(100):
18  key_name = 'key_' + str(k+1)
19  keys.append(key_name)
20  map[key_name] = np.random.rand((10))
21 
22  pickle.dump( map, open( "save_std_map.p", "wb" ) )
23 
24  map_loaded = pickle.load( open( "save_std_map.p", "rb" ) )
25  for key in keys:
26  self.assertApprox(map[key],map_loaded[key])
27 
28 if __name__ == '__main__':
29  unittest.main()


pinocchio
Author(s):
autogenerated on Tue Jun 1 2021 02:45:02