bindings_urdf.py
Go to the documentation of this file.
1 import unittest
2 import pinocchio as pin
3 import os
4 
5 @unittest.skipUnless(pin.WITH_URDFDOM,"Needs URDFDOM")
6 class TestGeometryObjectUrdfBindings(unittest.TestCase):
7 
8  def setUp(self):
9  self.current_file = os.path.dirname(str(os.path.abspath(__file__)))
10  self.model_dir = os.path.abspath(os.path.join(self.current_file, "../../models/example-robot-data/robots"))
11  self.model_path = os.path.abspath(os.path.join(self.model_dir, "romeo_description/urdf/romeo.urdf"))
12 
13  def test_load(self):
14  model = pin.buildModelFromUrdf(self.model_path)
15  model_ff = pin.buildModelFromUrdf(self.model_path, pin.JointModelFreeFlyer())
16 
17  def test_self_load(self):
18  model = pin.Model()
19  pin.buildModelFromUrdf(self.model_path, pin.JointModelFreeFlyer(), model)
20  model_ref = pin.buildModelFromUrdf(self.model_path, pin.JointModelFreeFlyer())
21 
22  def test_xml(self):
23  with open(self.model_path) as model:
24  file_content = model.read()
25 
26  model_ref = pin.buildModelFromUrdf(self.model_path, pin.JointModelFreeFlyer())
27  model = pin.buildModelFromXML(file_content,pin.JointModelFreeFlyer())
28 
29  self.assertEqual(model,model_ref)
30 
31  model_self = pin.Model()
32  pin.buildModelFromXML(file_content,pin.JointModelFreeFlyer(),model_self)
33  self.assertEqual(model_self,model_ref)
34 
35 if __name__ == '__main__':
36  unittest.main()


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