bindings_std_vector.py
Go to the documentation of this file.
1 import pickle
2 import unittest
3 from pathlib import Path
4 
5 import numpy as np
6 import pinocchio as pin
7 from test_case import PinocchioTestCase as TestCase
8 
9 
10 class TestStdMap(TestCase):
11  def setUp(self):
12  pass
13 
14  def test_pickle(self):
15  vec = pin.StdVec_Vector3()
16  for k in range(100):
17  vec.append(np.random.rand(3))
18 
19  pickle.dump(vec, Path("save_std_vec.p").open("wb"))
20 
21  vec_loaded = pickle.load(Path("save_std_vec.p").open("rb"))
22  for k in range(len(vec)):
23  self.assertApprox(vec[k], vec_loaded[k])
24 
25 
26 if __name__ == "__main__":
27  unittest.main()
bindings_std_vector.TestStdMap.setUp
def setUp(self)
Definition: bindings_std_vector.py:11
bindings_std_vector.TestStdMap.test_pickle
def test_pickle(self)
Definition: bindings_std_vector.py:14
bindings_std_vector.TestStdMap
Definition: bindings_std_vector.py:10
append-urdf-model-with-another-model.open
open
Definition: append-urdf-model-with-another-model.py:78


pinocchio
Author(s):
autogenerated on Sun Dec 22 2024 03:41:06