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.
viewer = gepetto.corbaserver.Client()
26 print(
"Error while starting the viewer client. ")
27 print(
"Check whether Gepetto-viewer is properly started")
32 windowID = self.
viewer.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.
viewer.gui.createWindow(windowName)
42 self.
viewer.gui.createScene(
"world")
43 self.
viewer.gui.addSceneToWindow(
"world", windowID)
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.
viewer.gui.applyConfiguration(objName, pin.se3ToXYZQUATtuple(M))