2 from pathlib
import Path
4 import pinocchio
as pin
7 @unittest.skipUnless(pin.WITH_URDFDOM,
"Needs URDFDOM")
16 pin.buildModelFromUrdf(self.
model_path, pin.JointModelFreeFlyer())
20 pin.buildModelFromUrdf(self.
model_path, pin.JointModelFreeFlyer(), model)
21 pin.buildModelFromUrdf(self.
model_path, pin.JointModelFreeFlyer())
25 file_content = model.read()
27 model_ref = pin.buildModelFromUrdf(self.
model_path, pin.JointModelFreeFlyer())
28 model = pin.buildModelFromXML(file_content, pin.JointModelFreeFlyer())
30 self.assertEqual(model, model_ref)
32 model_self = pin.Model()
33 pin.buildModelFromXML(file_content, pin.JointModelFreeFlyer(), model_self)
34 self.assertEqual(model_self, model_ref)
39 model_dir = self.
current_dir /
"../../models/example-robot-data/robots"
40 model_path = model_dir /
"ur_description/urdf/ur5_robot.urdf"
42 model = pin.buildModelFromUrdf(model_path)
43 filename = Path(
"model.pickle")
44 with filename.open(
"wb")
as f:
47 with filename.open(
"rb")
as f:
48 model_copy = pickle.load(f)
50 self.assertTrue(model == model_copy)
53 if __name__ ==
"__main__":