2 import gepetto.corbaserver
3 import pinocchio
as pin
10 Class Display: Example of a class implementing a client for the Gepetto-viewer
11 server. The main method of the class is 'place', that sets the position/rotation of
12 a 3D visual object in a scene.
17 This function connect with the Gepetto-viewer server and open a window with the
18 given name. If the window already exists, it is kept in the current state.
19 Otherwise, the newly-created window is set up with a scene named 'world'.
24 self.
viewerviewer = gepetto.corbaserver.Client()
26 print(
"Error while starting the viewer client. ")
27 print(
"Check whether Gepetto-viewer is properly started")
32 windowID = self.
viewerviewer.gui.getWindowID(windowName)
33 print(
"Warning: window '" + windowName +
"' already created.")
35 "The previously created objects will not be destroyed "
36 "and do not have to be created again."
40 windowID = self.
viewerviewer.gui.createWindow(windowName)
42 self.
viewerviewer.gui.createScene(
"world")
43 self.
viewerviewer.gui.addSceneToWindow(
"world", windowID)
46 self.
viewerviewer.gui.refresh()
48 def place(self, objName, M, refresh=True):
50 This function places (ie changes both translation and rotation) of the object
51 names "objName" in place given by the SE3 object "M". By default, immediately
52 refresh the layout. If multiple objects have to be placed at the same time, do
53 the refresh only at the end of the list.
55 self.
viewerviewer.gui.applyConfiguration(objName, pin.se3ToXYZQUATtuple(M))
57 self.
viewerviewer.gui.refresh()
def place(self, objName, M, refresh=True)
def __init__(self, windowName="pinocchio")