4 import pinocchio
as pin
8 from os.path import dirname, join, abspath
14 pinocchio_model_dir = join(dirname(dirname(str(abspath(__file__)))),
"models")
16 model_path = join(pinocchio_model_dir,
"example-robot-data/robots")
17 mesh_dir = pinocchio_model_dir
18 urdf_filename =
"talos_reduced.urdf" 19 urdf_model_path = join(join(model_path,
"talos_data/robots"),urdf_filename)
21 model, collision_model, visual_model = pin.buildModelsFromUrdf(urdf_model_path, mesh_dir, pin.JointModelFreeFlyer())
22 viz = GepettoVisualizer(model, collision_model, visual_model)
27 except ImportError
as err:
28 print(
"Error while initializing the viewer. It seems you should install gepetto-viewer")
33 viz.loadViewerModel(
"pinocchio")
34 except AttributeError
as err:
35 print(
"Error while loading the viewer model. It seems you should start gepetto-viewer")
40 q0 = pin.neutral(model)
44 viz2 = GepettoVisualizer(model, collision_model, visual_model)
45 viz2.initViewer(viz.viewer)
46 viz2.loadViewerModel(rootNodeName =
"pinocchio2")