5 import pinocchio
as pin
9 from os.path import dirname, join, abspath
15 pinocchio_model_dir = join(dirname(dirname(str(abspath(__file__)))),
"models")
17 model_path = join(pinocchio_model_dir,
"example-robot-data/robots")
18 mesh_dir = pinocchio_model_dir
19 urdf_filename =
"talos_reduced.urdf" 20 urdf_model_path = join(join(model_path,
"talos_data/robots"),urdf_filename)
22 model, collision_model, visual_model = pin.buildModelsFromUrdf(urdf_model_path, mesh_dir, pin.JointModelFreeFlyer())
24 viz = MeshcatVisualizer(model, collision_model, visual_model)
33 viz.initViewer(open=
True)
34 except ImportError
as err:
35 print(
"Error while initializing the viewer. It seems you should install Python meshcat")
43 q0 = pin.neutral(model)
47 viz2 = MeshcatVisualizer(model, collision_model, visual_model)
48 viz2.initViewer(viz.viewer)
49 viz2.loadViewerModel(rootNodeName =
"pinocchio2")