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