Ejemplo n.º 1
0
    def invoke(self, arg, from_tty):
        args = arg.split(" ")
        if len(args) is not 2:
            raise gdb.GdbError(
                "Expects 2 arguments. See \"help forward-geometry\"")
        command = "call hpp::model::forwardGeometry({0},{1})".format(
            args[0], args[1])
        print "Calling ", command
        gdb.execute(command, from_tty, True)
        val = gdb.history(0)

        start = val['_M_impl']['_M_start']
        finish = val['_M_impl']['_M_finish']
        end = val['_M_impl']['_M_end_of_storage']
        length = int(finish - start)

        print "%s links" % length

        cl = Client()

        item = start
        while item != finish:
            current = item.dereference()
            name = str(current["name"]["_M_dataplus"]["_M_p"].string())
            pos = [0, 0, 0, 0, 0, 0, 0]
            for i in range(3):
                pos[i] = float(current["p"][i])
            for i in range(4):
                pos[i + 3] = float(current["q"][i])
            cl.gui.applyConfiguration(name, pos)
            item = item + 1
        cl.gui.refresh()
        print "done"
Ejemplo n.º 2
0
 def __init__(self, mainWindow, flags=None):
     if flags is None:
         super(Plugin, self).__init__("Gepetto Viewer plugin", mainWindow)
     else:
         super(Plugin, self).__init__("Gepetto Viewer plugin", mainWindow,
                                      flags)
     self.client = Client()
     # Initialize the widget
     self.tabWidget = QtGui.QTabWidget(self)
     self.setWidget(self.tabWidget)
     self.nodeCreator = _NodeCreator(self, self)
     self.tabWidget.addTab(self.nodeCreator, "Node Creator")
     self.main = mainWindow
     mainWindow.connect('refresh()', self.refresh)
Ejemplo n.º 3
0
 def __init__(self, mainWindow):
     super(Plugin, self).__init__("Gepetto Viewer plugin", mainWindow)
     self.setObjectName("Gepetto Viewer plugin")
     self.client = Client()
     # Initialize the widget
     self.tabWidget = QtGui.QTabWidget(self)
     # This avoids having a widget bigger than what it needs. It avoids having
     # a big dock widget and a small osg widget when creating the main osg widget.
     p = Qt.QSizePolicy.Maximum
     self.tabWidget.setSizePolicy(Qt.QSizePolicy(p, p))
     self.setWidget(self.tabWidget)
     self.nodeCreator = _NodeCreator(self, self)
     self.tabWidget.addTab(self.nodeCreator, "Node Creator")
     self.main = mainWindow
     mainWindow.connect("refresh()", self.refresh)
     mainWindow.bodyTree().connect("bodySelected(SelectionEvent*)",
                                   self.selected)
    def __init__ (self, mainWindow, flags = None):
        if flags is None:
            super(Plugin, self).__init__ ("Matplotlib example plugin", mainWindow)
        else:
            super(Plugin, self).__init__ ("Matplotlib example plugin", mainWindow, flags)
        self.setObjectName("Matplotlib example plugin")
        self.client = Client()

        # This avoids having a widget bigger than what it needs. It avoids having
        # a big dock widget and a small osg widget when creating the main osg widget.
        p = Qt.QSizePolicy.Ignored
        self.testWidget = MatplotlibWidget(self, True)
        self.testWidget.setSizePolicy(Qt.QSizePolicy(p,p))
        self.setWidget (self.testWidget)

        # Plot something
        x = np.linspace (0, 10, num=100)
        y = np.sin(x)
        self.testWidget.figure.gca().plot (x, y)
Ejemplo n.º 5
0
    def __init__(self, mainWindow):
        super(Plugin, self).__init__("Coordinates viewer plugin", mainWindow)
        self.setObjectName("Coordinates viewer plugin")
        self.client = Client()

        self.le_name = QtGui.QLineEdit()
        self.le_name.setReadOnly(True)
        self.transform = QtGui.QLineEdit()
        self.transform.setReadOnly(True)

        self.local = QtGui.QCheckBox()
        self.local.setChecked(True)
        self.point = QtGui.QLineEdit()
        self.point.setReadOnly(True)
        self.normal = QtGui.QLineEdit()
        self.normal.setReadOnly(True)

        layout = QtGui.QFormLayout()
        layout.addRow('Name', self.le_name)
        layout.addRow('Transform', self.transform)
        layout.addRow('Local frame', self.local)
        layout.addRow('Point', self.point)
        layout.addRow('Normal', self.normal)

        # Initialize the widget
        widget = QtGui.QWidget(self)
        widget.setLayout(layout)
        # This avoids having a widget bigger than what it needs. It avoids having
        # a big dock widget and a small osg widget when creating the main osg widget.
        p = Qt.QSizePolicy.Maximum
        widget.setSizePolicy(
            Qt.QSizePolicy(Qt.QSizePolicy.Expanding, Qt.QSizePolicy.Maximum))
        self.setWidget(widget)

        mainWindow.bodyTree().connect('bodySelected(SelectionEvent*)',
                                      self.selected)
Ejemplo n.º 6
0
 def resetConnection(self):
     self.client = Client()
Ejemplo n.º 7
0
import numpy as np
import os
from gepetto.corbaserver import Client

path = None
devel_hpp_dir = os.getenv('DEVEL_HPP_DIR')
if devel_hpp_dir:
    path = devel_hpp_dir + '/src/hpp-fcl/test/fcl_resources'
else:
    path = os.getenv('PWD') + '/fcl_resources'

Red = [1, 0, 0, .5]
Green = [0, 1, 0, .5]
Blue = [0, 0, 1, .5]

c = Client()
wid = 0

sceneName = 'scene'
wid = c.gui.createWindow('test-fcl')

c.gui.createScene(sceneName)
c.gui.addSceneToWindow(sceneName, wid)

c.gui.addMesh("env", path + "/env.obj")
c.gui.addMesh("rob", path + "/rob.obj")
c.gui.addToGroup("env", sceneName)
c.gui.addToGroup("rob", sceneName)

q2 = (0, 0, 0, 0, 0, 0, 1)
q1 = (-1435.35587657243, 2891.398094594479,
Ejemplo n.º 8
0
# Datas for compare_convex_box
from gepetto.corbaserver import Client
from gepetto import Quaternion

def translate (tr, t, d):
    return [ tr[i] + d*t[i] for i in range(3) ] + tr[3:]

cl = Client ()
try:
    cl.gui.getWindowID("fcl")
except:
    cl.gui.createWindow("fcl")

cl.gui.addBox ('fcl/b0', 2, 2, 2, [1,0,0,0.5])
cl.gui.addBox ('fcl/b1', 2, 2, 2, [0,1,0,0.5])
cl.gui.setWireFrameMode ('fcl/b1', "WIREFRAME")
cl.gui.addBox ('fcl/b1_0', 2, 2, 2, [0,0  ,1,0.5])
cl.gui.addBox ('fcl/b1_1', 2, 2, 2, [0,0.5,1,0.5])

cl.gui.addSphere ("fcl/p0", 0.01, [1, 0, 1, 1])
cl.gui.addSphere ("fcl/p1", 0.01, [0, 1, 1, 1])

cl.gui.addArrow ("fcl/n0", 0.01, 1., [1, 0, 1, 1])
cl.gui.addArrow ("fcl/n1", 0.01, 1., [0, 1, 1, 1])

eps = 0.
d0 = 1.5183589910964868 + eps
n0 = [0.0310588, 0.942603, -0.332467]
d1 = 1.7485932899646754 + eps
n1 = [0.132426, -0.0219519, -0.99095]
Ejemplo n.º 9
0
 def resetConnection(self):
     self.client = Client()
     self.gui = self.client.gui