panda3d-viewer.py
Go to the documentation of this file.
1 # This examples shows how to load several robots in panda3d_viewer.
2 # Note: this feature requires panda3d_viewer to be installed, this can be done using
3 # pip install panda3d_viewer
4 # ruff: noqa: E402
5 
6 import sys
7 from pathlib import Path
8 
9 # Add path to the example-robot-data package from git submodule.
10 # If you have it properly installed, there is no need for this sys.path thing.)
11 path = Path(__file__).parent.parent / "models" / "example-robot-data" / "python"
12 sys.path.append(str(path))
14  HectorLoader,
15  HyQLoader,
16  ICubLoader,
17  RomeoLoader,
18  Solo8Loader,
19  TalosLoader,
20  TiagoLoader,
21 )
22 from panda3d_viewer import Viewer
23 from pinocchio.visualize.panda3d_visualizer import Panda3dVisualizer
24 
25 # Open a Panda3D GUI window
26 viewer = Viewer(window_title="python-pinocchio")
27 
28 # These RobotLoader classes are defined in example_robot_data
29 loaders = (
30  TalosLoader,
31  RomeoLoader,
32  ICubLoader,
33  TiagoLoader,
34  Solo8Loader,
35  HyQLoader,
36  HectorLoader,
37 )
38 
39 for i, loader in enumerate(loaders):
40  # The robot is loaded as a RobotWrapper object
41  robot = loader().robot
42  # Attach the robot to the viewer scene
43  robot.setVisualizer(Panda3dVisualizer())
44  robot.initViewer(viewer=viewer)
45  robot.loadViewerModel(group_name=robot.model.name)
46 
47  q = robot.q0[:]
48  q[1] = 3 - i
49  if loader is RomeoLoader:
50  q[2] = 0.87
51 
52  robot.display(q)
53 
54 viewer.join()
example_robot_data.robots_loader
Definition: robots_loader.py:1
example_robot_data.robots_loader.loader
def loader(name, display=False, rootNodeName="", verbose=False)
Definition: robots_loader.py:616
pinocchio.visualize.panda3d_visualizer
Definition: panda3d_visualizer.py:1
pinocchio.visualize.panda3d_visualizer.Panda3dVisualizer
Definition: panda3d_visualizer.py:17


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