5 from pathlib
import Path
7 import pinocchio
as pin
12 pinocchio_model_dir = Path(__file__).parent.parent /
"models"
14 model_path = pinocchio_model_dir /
"example-robot-data/robots"
15 mesh_dir = pinocchio_model_dir
16 urdf_filename =
"talos_reduced.urdf"
17 urdf_model_path = model_path /
"talos_data/robots" / urdf_filename
19 model, collision_model, visual_model = pin.buildModelsFromUrdf(
20 urdf_model_path, mesh_dir, pin.JointModelFreeFlyer()
27 except ImportError
as err:
29 "Error while initializing the viewer. "
30 "It seems you should install gepetto-viewer"
36 viz.loadViewerModel(
"pinocchio")
37 except AttributeError
as err:
39 "Error while loading the viewer model. "
40 "It seems you should start gepetto-viewer"
46 q0 = pin.neutral(model)
51 viz2.initViewer(viz.viewer)
52 viz2.loadViewerModel(rootNodeName=
"pinocchio2")