Exemple #1
0
def init(view):
    global _multisenseItem
    global multisenseDriver


    m = MultiSenseSource(view)
    m.start()
    multisenseDriver = m

    sensorsFolder = om.getOrCreateContainer('sensors')

    _multisenseItem = MultisenseItem(m)
    om.addToObjectModel(_multisenseItem, sensorsFolder)

    useMapServer = hasattr(drc, 'vtkMapServerSource')
    if useMapServer:
        mapServerSource = MapServerSource(view, callbackFunc=view.render)
        mapsServerContainer = om.ObjectModelItem('Map Server', icon=om.Icons.Robot)
        mapsServerContainer.source = mapServerSource
        om.addToObjectModel(mapsServerContainer, parentObj=sensorsFolder)
        mapServerSource.start()
    else:
        mapServerSource = None


    spindleDebug = SpindleAxisDebug(multisenseDriver)
    spindleDebug.addToView(view)
    om.addToObjectModel(spindleDebug, sensorsFolder)


    return multisenseDriver, mapServerSource
Exemple #2
0
def main():

    objectTree = QtGui.QTreeWidget()
    propertiesPanel = PythonQt.dd.ddPropertiesPanel()

    om.init(objectTree, propertiesPanel)
    p = om.ObjectModelItem('test parent item')
    p.addProperty('foo', 1)
    p.addProperty('Visible', True)
    om.addToObjectModel(p)
    c = om.ObjectModelItem('test child item')
    om.addToObjectModel(c, p)

    assert om.findObjectByName('test parent item') == p
    assert om.findObjectByName('test child item') == c
    assert p.children()[0] == c
    assert c.children() == []

    objectTree.show()
    propertiesPanel.show()

    objectTree2 = QtGui.QTreeWidget()
    propertiesPanel2 = PythonQt.dd.ddPropertiesPanel()

    tree = om.ObjectModelTree()
    tree.init(objectTree2, propertiesPanel2)

    p2 = om.ObjectModelItem('test parent item 2')
    p2.addProperty('foo2', 1)
    p2.addProperty('Visible', True)
    tree.addToObjectModel(p2)
    c2 = om.ObjectModelItem('test child item 2')
    tree.addToObjectModel(c2, p2)

    assert tree.findObjectByName('test parent item 2') == p2
    assert tree.findObjectByName('test child item 2') == c2
    assert p2.children()[0] == c2
    assert c2.children() == []

    objectTree2.show()
    propertiesPanel2.show()

    startApplication(enableQuitTimer=True)
Exemple #3
0
    def _setupProperties(self):
        self.params = om.ObjectModelItem('Footstep Params')
        self.defaults_map = ['Drake Nominal', 'Terrain', 'Stairs', 'Polaris Platform']
        self.params.addProperty('Defaults', 0, attributes=om.PropertyAttributes(enumNames=self.defaults_map))
        self.params.addProperty('Behavior', 0, attributes=om.PropertyAttributes(enumNames=['BDI Stepping', 'BDI Walking', 'Drake Walking']))
        self.params.addProperty('Leading Foot', 1, attributes=om.PropertyAttributes(enumNames=['Auto', 'Left', 'Right']))
        self.leading_foot_map = [lcmdrc.footstep_plan_params_t.LEAD_AUTO,
                                 lcmdrc.footstep_plan_params_t.LEAD_LEFT,
                                 lcmdrc.footstep_plan_params_t.LEAD_RIGHT]
        # self.params.addProperty('Map Command', 0, attributes=om.PropertyAttributes(enumNames=['Full Heightmap', 'Flat Ground', 'Z Normals']))
        self.params.addProperty('Map Mode', 0, attributes=om.PropertyAttributes(enumNames=['Foot Plane', 'Terrain Heights & Normals', 'Terrain Heights, Z Normals', 'Horizontal Plane']))
        self.map_mode_map = [
                             lcmdrc.footstep_plan_params_t.FOOT_PLANE,
                             lcmdrc.footstep_plan_params_t.TERRAIN_HEIGHTS_AND_NORMALS,
                             lcmdrc.footstep_plan_params_t.TERRAIN_HEIGHTS_Z_NORMALS,
                             lcmdrc.footstep_plan_params_t.HORIZONTAL_PLANE
                             ]
        # self.params.addProperty('Heights Source', attributes=om.PropertyAttributes(enumNames=['Map Data', 'Foot Plane']))
        # self.params.addProperty('Normals Source', attributes=om.PropertyAttributes(enumNames=['Map Data', 'Foot Plane']))
        self.params.addProperty('Min Num Steps', None, attributes=om.PropertyAttributes(decimals=0, minimum=0, maximum=30, singleStep=1))
        self.params.addProperty('Max Num Steps', None, attributes=om.PropertyAttributes(decimals=0, minimum=1, maximum=30, singleStep=1))
        self.params.addProperty('Min Step Width', None, attributes=om.PropertyAttributes(decimals=2, minimum=0.1, maximum=0.35, singleStep=0.01))
        self.params.addProperty('Nominal Step Width', None, attributes=om.PropertyAttributes(decimals=2, minimum=0.21, maximum=0.4, singleStep=0.01))
        self.params.addProperty('Max Step Width', None, attributes=om.PropertyAttributes(decimals=2, minimum=0.22, maximum=0.5, singleStep=0.01))
        self.params.addProperty('Nominal Forward Step', None, attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=0.5, singleStep=0.01))
        self.params.addProperty('Max Forward Step', None, attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=0.5, singleStep=0.01))
        self.params.addProperty('Swing Height', None, attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=0.5, singleStep=0.005))
        self.params.addProperty('Max Upward Step', None, attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=0.5, singleStep=0.01))
        self.params.addProperty('Max Downward Step', None, attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=0.5, singleStep=0.01))
        self.params.addProperty('Drake Swing Speed', None, attributes=om.PropertyAttributes(decimals=2, minimum=0.05, maximum=5.0, singleStep=0.05))
        self.params.addProperty('Drake Min Hold Time', None, attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=10.0, singleStep=0.05))
        self.params.addProperty('Drake Instep Shift', None, attributes=om.PropertyAttributes(decimals=4, minimum=-0.3, maximum=0.3, singleStep=0.0005))
        self.behavior_lcm_map = {
                              0: lcmdrc.footstep_plan_params_t.BEHAVIOR_BDI_STEPPING,
                              1: lcmdrc.footstep_plan_params_t.BEHAVIOR_BDI_WALKING,
                              2: lcmdrc.footstep_plan_params_t.BEHAVIOR_WALKING}
        self.params.addProperty('Planner Mode', 0, attributes=om.PropertyAttributes(enumNames=['Fast MIQP', 'Slow MISOCP']))
        self.params.addProperty('Support Contact Groups', 0, attributes=om.PropertyAttributes(enumNames=['Whole Foot', 'Front 2/3', 'Back 2/3']))
        self.params.addProperty('Prevent Swing Undershoot', 0, attributes=om.PropertyAttributes(enumNames=['False', 'True']))
        self.params.addProperty('Prevent Swing Overshoot', 0, attributes=om.PropertyAttributes(enumNames=['False', 'True']))

        self.applyDefaults(DEFAULT_PARAM_SET)
Exemple #4
0
def main():

    obj = om.ObjectModelItem('test')
    obj.addProperty('double', 1.0, attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=100, singleStep=0.5))
    obj.addProperty('double list', [1.0, 2.0, 3.0], attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=100, singleStep=0.5))

    obj.addProperty('int', 1, attributes=om.PropertyAttributes(minimum=0, maximum=100, singleStep=5))
    obj.addProperty('int list', [1, 2, 3], attributes=om.PropertyAttributes(minimum=0, maximum=100, singleStep=1))

    obj.addProperty('bool', True)

    obj.addProperty('str', 'value')

    obj.addProperty('str list', 0, attributes=om.PropertyAttributes(enumNames=['value 1', 'value 2', 'value 3']))

    obj.addProperty('color', [1.0, 0.5, 0.0])

    panel = PythonQt.dd.ddPropertiesPanel()
    panel.setBrowserModeToWidget()
    om.PropertyPanelHelper.addPropertiesToPanel(obj.properties, panel)
    panel.show()

    startApplication(enableQuitTimer=True)
Exemple #5
0
 def _setupParams(self):
     self.params = om.ObjectModelItem('Task Params')
     self.params.properties.connectPropertyChanged(self.onPropertyChanged)