sample-model-viewer.py
Go to the documentation of this file.
1 from sys import argv
2 
3 import pinocchio as pin
4 from numpy import pi
5 from pinocchio.visualize import GepettoVisualizer, MeshcatVisualizer, RVizVisualizer
6 
7 # GepettoVisualizer: -g
8 # MeshcatVisualizer: -m
9 VISUALIZER = None
10 if len(argv) > 1:
11  opt = argv[1]
12  if opt == "-g":
13  VISUALIZER = GepettoVisualizer
14  elif opt == "-m":
15  VISUALIZER = MeshcatVisualizer
16  elif opt == "-r":
17  VISUALIZER = RVizVisualizer
18  else:
19  raise ValueError("Unrecognized option: " + opt)
20 
21 model = pin.buildSampleModelHumanoid()
22 visual_model = pin.buildSampleGeometryModelHumanoid(model)
23 collision_model = visual_model.copy()
24 
25 q0 = pin.neutral(model)
26 
27 if VISUALIZER:
28  viz = VISUALIZER(model, collision_model, visual_model)
29  viz.initViewer()
30  viz.loadViewerModel()
31  viz.display(q0)
32 
33  input("Enter to check a new configuration")
34 
35  q = q0.copy()
36  q[8] = pi / 2
37  q[14] = pi / 2
38  q[23] = -pi / 2
39  q[29] = pi / 2
40 
41  viz.display(q)
42 
43  input("Press enter to exit...")
pinocchio.visualize
Definition: bindings/python/pinocchio/visualize/__init__.py:1
sample-model-viewer.VISUALIZER
VISUALIZER
Definition: sample-model-viewer.py:9


pinocchio
Author(s):
autogenerated on Sun Dec 22 2024 03:41:12