2 from importlib.util
import find_spec
5 from .base_visualizer
import BaseVisualizer
6 from .gepetto_visualizer
import GepettoVisualizer
7 from .meshcat_visualizer
import MeshcatVisualizer
8 from .panda3d_visualizer
import Panda3dVisualizer
9 from .rviz_visualizer
import RVizVisualizer
14 GEPETTO = GepettoVisualizer
15 MESHCAT = MeshcatVisualizer
16 PANDA3D = Panda3dVisualizer
22 Allow user to choose their prefered viewer with eg.
23 export PINOCCHIO_VIEWER=RVIZ.
25 Otherwise, try to find one which is installed.
28 if "PINOCCHIO_VIEWER" in environ:
29 selected = environ[
"PINOCCHIO_VIEWER"].upper()
30 if hasattr(cls, selected):
31 return getattr(cls, selected).value
33 f
"The visualizer '{selected}' is not available.\n"
34 "Please set PINOCCHIO_VIEWER to something installed among:\n"
40 raise ImportError(err)
43 for v
in [
"meshcat",
"gepetto",
"panda3d_viewer",
"rviz"]:
44 if find_spec(v)
is not None:
45 return getattr(cls, v.replace(
"_viewer",
"").upper()).value
48 "No visualizer could be found.\n"
49 "Please install one of those:\n"
55 raise ImportError(err)