serialization.py
Go to the documentation of this file.
1 import unittest
2 
3 import pinocchio as pin
4 from test_case import PinocchioTestCase as TestCase
5 
6 main_path = "./serialization-data"
7 
8 
9 class TestSerialization(TestCase):
10  def testTXT(self):
11  model = pin.buildSampleModelHumanoidRandom()
12  filename = main_path + "/model.txt"
13  model.saveToText(filename)
14 
15  model2 = pin.Model()
16  model2.loadFromText(filename)
17 
18  self.assertTrue(model == model2)
19 
20  def testXML(self):
21  model = pin.buildSampleModelHumanoidRandom()
22  filename = main_path + "/model.xml"
23  tag_name = "Model"
24  model.saveToXML(filename, tag_name)
25 
26  model2 = pin.Model()
27  model2.loadFromXML(filename, tag_name)
28 
29  self.assertTrue(model == model2)
30 
31  def testBIN(self):
32  model = pin.buildSampleModelHumanoidRandom()
33  filename = main_path + "/model.bin"
34  model.saveToBinary(filename)
35 
36  model2 = pin.Model()
37  model2.loadFromBinary(filename)
38 
39  self.assertTrue(model == model2)
40 
41 
42 if __name__ == "__main__":
43  unittest.main()
serialization.TestSerialization.testBIN
def testBIN(self)
Definition: serialization.py:31
serialization.TestSerialization
Definition: serialization.py:9
serialization.TestSerialization.testTXT
def testTXT(self)
Definition: serialization.py:10
serialization.TestSerialization.testXML
def testXML(self)
Definition: serialization.py:20


pinocchio
Author(s):
autogenerated on Thu Dec 19 2024 03:41:32