예제 #1
0
    def __init__(self, name, transform, view):

        PolyDataItem.__init__(self, name, vtk.vtkPolyData(), view)

        self.transform = transform
        self._blockSignals = False

        self.actor.SetUserTransform(transform)

        self.widget = vtk.vtkFrameWidget()
        self.widget.CreateDefaultRepresentation()
        self.widget.EnabledOff()
        self.rep = self.widget.GetRepresentation()
        self.rep.SetTransform(transform)
        self.traceData = None
        self._frameSync = None

        self.addProperty('Scale', 1.0, attributes=om.PropertyAttributes(decimals=2, minimum=0.01, maximum=100, singleStep=0.1, hidden=False))
        self.addProperty('Edit', False)
        self.addProperty('Trace', False)
        self.addProperty('Tube', False)
        self.addProperty('Tube Width', 0.002, attributes=om.PropertyAttributes(decimals=3, minimum=0.001, maximum=10, singleStep=0.01, hidden=True))

        self.properties.setPropertyIndex('Edit', 0)
        self.properties.setPropertyIndex('Trace', 1)
        self.properties.setPropertyIndex('Tube', 2)

        self.callbacks.addSignal('FrameModified')
        self.onTransformModifiedCallback = None
        self.observerTag = self.transform.AddObserver('ModifiedEvent', self.onTransformModified)

        self._updateAxesGeometry()
        self.setProperty('Color By', 'Axes')
        self.setProperty('Icon', om.Icons.Axes)
예제 #2
0
    def __init__(self, name, polyData, view):

        om.ObjectModelItem.__init__(self, name, om.Icons.Robot)

        self.views = []
        self.polyData = polyData
        self.mapper = vtk.vtkPolyDataMapper()
        self.mapper.SetInputData(self.polyData)
        self.actor = vtk.vtkActor()
        self.actor.SetMapper(self.mapper)
        self.shadowActor = None
        self.scalarBarWidget = None
        self.extraViewRenderers = {}

        self.rangeMap = dict(PolyDataItem.defaultScalarRangeMap)

        self.addProperty(
            'Color By',
            0,
            attributes=om.PropertyAttributes(enumNames=['Solid Color']))
        self.addProperty('Visible', True)
        self.addProperty('Alpha',
                         1.0,
                         attributes=om.PropertyAttributes(decimals=2,
                                                          minimum=0,
                                                          maximum=1.0,
                                                          singleStep=0.1,
                                                          hidden=False))
        self.addProperty('Point Size',
                         self.actor.GetProperty().GetPointSize(),
                         attributes=om.PropertyAttributes(decimals=0,
                                                          minimum=1,
                                                          maximum=20,
                                                          singleStep=1,
                                                          hidden=False))

        self.addProperty('Line Width',
                         self.actor.GetProperty().GetLineWidth(),
                         attributes=om.PropertyAttributes(decimals=0,
                                                          minimum=1,
                                                          maximum=20,
                                                          singleStep=1,
                                                          hidden=False))

        self.addProperty('Surface Mode',
                         0,
                         attributes=om.PropertyAttributes(enumNames=[
                             'Surface', 'Wireframe', 'Surface with edges',
                             'Points'
                         ],
                                                          hidden=True))

        self.addProperty('Color', [1.0, 1.0, 1.0])
        self.addProperty('Show Scalar Bar', False)

        self._updateSurfaceProperty()
        self._updateColorByProperty()

        if view is not None:
            self.addToView(view)
예제 #3
0
    def getDefaultProperties(properties):
        properties.addProperty('Target frame name', '')
        properties.addProperty('Annotation input name', '')
        properties.addProperty('Side', 1, attributes=om.PropertyAttributes(enumNames=['Left', 'Right']))

        properties.addProperty('Cone threshold degrees', 5.0, attributes=om.PropertyAttributes(decimals=1, minimum=0, maximum=360))
        properties.addProperty('Palm offset', 0.0, attributes=om.PropertyAttributes(decimals=3, minimum=-1e4, maximum=1e4))
예제 #4
0
 def __init__(self, name, view):
     AffordanceItem.__init__(self, name, vtk.vtkPolyData(), view)
     self.addProperty('Dimensions', [0.25, 0.25, 0.25], attributes=om.PropertyAttributes(decimals=3, singleStep=0.01, minimum=0.0, maximum=1e4))
     self.addProperty('Subdivisions', 0, attributes=om.PropertyAttributes(minimum=0, maximum=1000))
     self.properties.setPropertyIndex('Dimensions', 0)
     self.properties.setPropertyIndex('Subdivisions', 1)
     self.updateGeometryFromProperties()
예제 #5
0
    def __init__(self, name, view):
        AffordanceItem.__init__(self, name, vtk.vtkPolyData(), view)
        self.setProperty('Collision Enabled', False)
        self.addProperty('Radius',
                         0.15,
                         attributes=om.PropertyAttributes(decimals=3,
                                                          singleStep=0.01,
                                                          minimum=0.0,
                                                          maximum=1e4))
        self.addProperty('Tube Radius',
                         0.02,
                         attributes=om.PropertyAttributes(decimals=3,
                                                          singleStep=0.01,
                                                          minimum=0.0,
                                                          maximum=1e4))
        self.addProperty('Segments',
                         8,
                         attributes=om.PropertyAttributes(decimals=3,
                                                          singleStep=1,
                                                          minimum=3,
                                                          maximum=100))

        self.properties.setPropertyIndex('Radius', 0)
        self.properties.setPropertyIndex('Tube Radius', 1)
        self.properties.setPropertyIndex('Segments', 2)

        self.updateGeometryFromProperties()
예제 #6
0
 def __init__(self, name, view):
     AffordanceItem.__init__(self, name, vtk.vtkPolyData(), view)
     self.addProperty('Radius', 0.03, attributes=om.PropertyAttributes(decimals=3, singleStep=0.01, minimum=0.0, maximum=1e4))
     self.addProperty('Length', 0.5, attributes=om.PropertyAttributes(decimals=3, singleStep=0.01, minimum=0.0, maximum=1e4))
     self.properties.setPropertyIndex('Radius', 0)
     self.properties.setPropertyIndex('Length', 1)
     self.updateGeometryFromProperties()
예제 #7
0
    def __init__(self, name, text="", view=None):

        om.ObjectModelItem.__init__(self, name)

        self.views = []
        self.actor = vtk.vtkTextActor()
        prop = self.actor.GetTextProperty()
        prop.SetFontSize(18)
        self.actor.SetPosition(10, 10)
        self.actor.SetInput(text)

        self.addProperty("Visible", True)
        self.addProperty("Text", text)
        self.addProperty(
            "Position",
            [10, 10],
            attributes=om.PropertyAttributes(minimum=0,
                                             maximum=3000,
                                             singleStep=1),
        )
        self.addProperty(
            "Font Size",
            18,
            attributes=om.PropertyAttributes(minimum=6,
                                             maximum=128,
                                             singleStep=1),
        )
        self.addProperty("Bold", False)
        self.addProperty("Italic", False)

        if view:
            self.addToView(view)
예제 #8
0
    def __init__(self, view):
        om.ObjectModelItem.__init__(self, "view options")

        self.view = view
        self.addProperty(
            "Camera projection",
            0,
            attributes=om.PropertyAttributes(
                enumNames=["Perspective", "Parallel"]),
        )
        self.addProperty(
            "View angle",
            view.camera().GetViewAngle(),
            attributes=om.PropertyAttributes(minimum=2, maximum=180),
        )
        self.addProperty(
            "Key light intensity",
            view.lightKit().GetKeyLightIntensity(),
            attributes=om.PropertyAttributes(minimum=0,
                                             maximum=5,
                                             singleStep=0.1,
                                             decimals=2),
        )
        self.addProperty("Light kit", True)
        self.addProperty("Eye dome lighting", False)
        self.addProperty("Orientation widget", True)
        self.addProperty("Interactive render", True)
        self.addProperty("Gradient background", True)
        self.addProperty("Background color",
                         view.backgroundRenderer().GetBackground())
        self.addProperty("Background color 2",
                         view.backgroundRenderer().GetBackground2())
예제 #9
0
    def __init__(self, name, text='', view=None):

        om.ObjectModelItem.__init__(self, name)

        self.views = []
        self.actor = vtk.vtkTextActor()
        prop = self.actor.GetTextProperty()
        prop.SetFontSize(18)
        self.actor.SetPosition(10, 10)
        self.actor.SetInput(text)

        self.addProperty('Visible', True)
        self.addProperty('Text', text)
        self.addProperty('Position', [10, 10],
                         attributes=om.PropertyAttributes(minimum=0,
                                                          maximum=3000,
                                                          singleStep=1))
        self.addProperty('Font Size',
                         18,
                         attributes=om.PropertyAttributes(minimum=6,
                                                          maximum=128,
                                                          singleStep=1))
        self.addProperty('Bold', False)
        self.addProperty('Italic', False)

        if view:
            self.addToView(view)
예제 #10
0
    def __init__(self, view):
        om.ObjectModelItem.__init__(self, 'view options')

        self.view = view
        self.addProperty('Camera projection',
                         0,
                         attributes=om.PropertyAttributes(
                             enumNames=['Perspective', 'Parallel']))
        self.addProperty('View angle',
                         view.camera().GetViewAngle(),
                         attributes=om.PropertyAttributes(minimum=2,
                                                          maximum=180))
        self.addProperty('Key light intensity',
                         view.lightKit().GetKeyLightIntensity(),
                         attributes=om.PropertyAttributes(minimum=0,
                                                          maximum=5,
                                                          singleStep=0.1,
                                                          decimals=2))
        self.addProperty('Light kit', True)
        self.addProperty('Eye dome lighting', False)
        self.addProperty('Orientation widget', True)
        self.addProperty('Interactive render', True)
        self.addProperty('Gradient background', True)
        self.addProperty('Background color',
                         view.backgroundRenderer().GetBackground())
        self.addProperty('Background color 2',
                         view.backgroundRenderer().GetBackground2())
예제 #11
0
    def __init__(self, model):

        modelName = os.path.basename(model.filename())
        om.ObjectModelItem.__init__(self, modelName, om.Icons.Robot)

        self.views = []
        self.model = None
        self.callbacks.addSignal(self.MODEL_CHANGED_SIGNAL)

        self.addProperty('Filename', model.filename())
        self.addProperty('Visible', model.visible())
        self.addProperty('Alpha',
                         model.alpha(),
                         attributes=om.PropertyAttributes(decimals=2,
                                                          minimum=0,
                                                          maximum=1.0,
                                                          singleStep=0.1,
                                                          hidden=False))
        self.addProperty(
            'Color Mode',
            0,
            attributes=om.PropertyAttributes(
                enumNames=['Solid Color', 'Textures', 'URDF Colors']))
        self.addProperty('Color', model.color())

        self.setModel(model)
예제 #12
0
    def __init__(self, name, polyData, view):

        om.ObjectModelItem.__init__(self, name, om.Icons.Robot)

        self.views = []
        self.polyData = polyData
        self.mapper = vtk.vtkPolyDataMapper()
        self.mapper.SetInput(self.polyData)
        self.actor = vtk.vtkActor()
        self.actor.SetMapper(self.mapper)
        self.shadowActor = None
        self.scalarBarWidget = None
        self.extraViewRenderers = {}

        self.rangeMap = {
            'intensity': (400, 4000),
            #'z' : (0.0, 2.0),
            #'distance' : (0.5, 4.0),
            'spindle_angle': (0, 360),
            'azimuth': (-2.5, 2.5),
            'scan_delta': (0.0, 0.3)
        }

        self.addProperty(
            'Color By',
            0,
            attributes=om.PropertyAttributes(enumNames=['Solid Color']))
        self.addProperty('Visible', True)
        self.addProperty('Alpha',
                         1.0,
                         attributes=om.PropertyAttributes(decimals=2,
                                                          minimum=0,
                                                          maximum=1.0,
                                                          singleStep=0.1,
                                                          hidden=False))
        self.addProperty('Point Size',
                         self.actor.GetProperty().GetPointSize(),
                         attributes=om.PropertyAttributes(decimals=0,
                                                          minimum=1,
                                                          maximum=20,
                                                          singleStep=1,
                                                          hidden=False))

        self.addProperty('Surface Mode',
                         0,
                         attributes=om.PropertyAttributes(enumNames=[
                             'Surface', 'Wireframe', 'Surface with edges',
                             'Points'
                         ],
                                                          hidden=True))

        self.addProperty('Color', [1.0, 1.0, 1.0])
        self.addProperty('Show Scalar Bar', False)

        self._updateSurfaceProperty()
        self._updateColorByProperty()

        if view is not None:
            self.addToView(view)
예제 #13
0
    def getDefaultProperties(properties):

        properties.addProperty('Position', [0.5, -0.22, 1.2],
                               attributes=om.PropertyAttributes(decimals=3,
                                                                minimum=-1e4,
                                                                maximum=1e4))
        properties.addProperty('Rotation', [0, 0, 0],
                               attributes=om.PropertyAttributes(decimals=2,
                                                                minimum=-360,
                                                                maximum=360))
예제 #14
0
 def addDefaultProperties(self):
     self.params.addProperty('max degrees per second',
                             10,
                             attributes=om.PropertyAttributes(singleStep=1,
                                                              decimals=2))
     self.params.addProperty(
         'Hand',
         0,
         attributes=om.PropertyAttributes(enumNames=['Left', 'Right']))
     self.params.setProperty('Hand', self.planner.side.capitalize())
예제 #15
0
    def __init__(self, name, polyData, view):
        PolyDataItem.__init__(self, name, polyData, view)
        self.params = {}
        self.addProperty('uuid', newUUID(), attributes=om.PropertyAttributes(hidden=True))
        self.addProperty('Collision Enabled', True)
        self.addProperty('Origin', [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0], attributes=om.PropertyAttributes(hidden=True))
        self.addProperty('Camera Texture Enabled', False)

        self.properties.setPropertyIndex('Collision Enabled', 0)
        self.setProperty('Icon', om.Icons.Hammer)
예제 #16
0
    def __init__(self, model):

        om.ObjectModelItem.__init__(self, 'Multisense', om.Icons.Laser)

        self.model = model
        self.scalarBarWidget = None
        self.addProperty('Color By', 0,
                         attributes=om.PropertyAttributes(enumNames=['Solid Color', 'Intensity', 'Z Coordinate', 'Range', 'Spindle Angle', 'Azimuth', 'Camera RGB', 'Scan Delta']))
        self.addProperty('Show Scalar Bar', False)
        self.addProperty('Updates Enabled', True)
        self.addProperty('Min Range', model.reader.GetDistanceRange()[0],
                         attributes=om.PropertyAttributes(decimals=2, minimum=0.0, maximum=100.0, singleStep=0.25, hidden=False))
        self.addProperty('Max Range', model.reader.GetDistanceRange()[1],
                         attributes=om.PropertyAttributes(decimals=2, minimum=0.0, maximum=100.0, singleStep=0.25, hidden=False))
        self.addProperty('Edge Filter Angle', model.reader.GetEdgeAngleThreshold(),
                         attributes=om.PropertyAttributes(decimals=0, minimum=0.0, maximum=60.0, singleStep=1, hidden=False))
        self.addProperty('Number of Scan Lines', model.numberOfScanLines,
                         attributes=om.PropertyAttributes(decimals=0, minimum=0, maximum=100, singleStep=1, hidden=False))
        self.addProperty('Visible', model.visible)
        self.addProperty('Point Size', model.pointSize,
                         attributes=om.PropertyAttributes(decimals=0, minimum=1, maximum=20, singleStep=1, hidden=False))
        self.addProperty('Alpha', model.alpha,
                         attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=1.0, singleStep=0.1, hidden=False))
        self.addProperty('Min Height', model.reader.GetHeightRange()[0],
                         attributes=om.PropertyAttributes(decimals=2, minimum=-80.0, maximum=80.0, singleStep=0.25, hidden=False))
        self.addProperty('Max Height', model.reader.GetHeightRange()[1],
                         attributes=om.PropertyAttributes(decimals=2, minimum=-80.0, maximum=80.0, singleStep=0.25, hidden=False))
예제 #17
0
    def __init__(self,
                 name,
                 cameraName,
                 imageManager,
                 robotStateJointController,
                 provider=None):
        vis.PolyDataItem.__init__(self, name, vtk.vtkPolyData(), view=None)

        self.robotStateJointController = robotStateJointController
        self.addProperty("Camera name", cameraName)

        self.addProperty(
            "Decimation",
            1,
            attributes=om.PropertyAttributes(
                enumNames=["1", "2", "4", "8", "16"]),
        )
        self.addProperty(
            "Remove Size",
            1000,
            attributes=om.PropertyAttributes(decimals=0,
                                             minimum=0,
                                             maximum=100000.0,
                                             singleStep=1000),
        )
        self.addProperty(
            "Target FPS",
            5.0,
            attributes=om.PropertyAttributes(decimals=1,
                                             minimum=0.1,
                                             maximum=30.0,
                                             singleStep=0.1),
        )
        self.addProperty(
            "Max Range",
            5.0,
            attributes=om.PropertyAttributes(decimals=2,
                                             minimum=0.0,
                                             maximum=30.0,
                                             singleStep=0.25),
        )

        self.imageManager = imageManager
        self.cameraName = cameraName
        self.firstData = True
        self.timer = TimerCallback()
        self.timer.callback = self.update
        self.lastUtime = 0
        self.lastDataReceivedTime = 0

        if provider:
            self.setProvider(provider)
        else:
            self.provider = None
예제 #18
0
    def updatePolyData(self, viewId, polyData):

        obj = self.polyDataObjects.get(viewId)
        if obj not in om.getObjects():
            obj = None
        if not obj:
            hiddenMapIds = [9999]
            visibleDefault = False if viewId in hiddenMapIds else True
            obj = vis.PolyDataItem(self.getNameForViewId(viewId), polyData,
                                   self.view)

            obj.setProperty('Visible', visibleDefault)
            if obj._isPointCloud():
                obj.setProperty('Color', [1, 1, 1])
                obj.setProperty('Alpha', 0.5)
            else:
                obj.setProperty('Color', [0, 0.68, 1])

            if viewId == lcmdrc.data_request_t.HEIGHT_MAP_SCENE:
                obj.setProperty('Surface Mode', 'Wireframe')

            folder = om.findObjectByName('Map Server')
            folder.addProperty('Min Range',
                               self.reader.GetDistanceRange()[0],
                               attributes=om.PropertyAttributes(
                                   decimals=2,
                                   minimum=0.0,
                                   maximum=100.0,
                                   singleStep=0.25,
                                   hidden=False))
            folder.addProperty('Max Range',
                               self.reader.GetDistanceRange()[1],
                               attributes=om.PropertyAttributes(
                                   decimals=2,
                                   minimum=0.0,
                                   maximum=100.0,
                                   singleStep=0.25,
                                   hidden=False))
            folder.addProperty('Edge Filter Angle',
                               self.reader.GetEdgeAngleThreshold(),
                               attributes=om.PropertyAttributes(decimals=0,
                                                                minimum=0.0,
                                                                maximum=60.0,
                                                                singleStep=1,
                                                                hidden=False))
            om.addToObjectModel(obj, folder)
            om.expand(folder)
            self.folder = folder
            self.polyDataObjects[viewId] = obj
        else:
            obj.setPolyData(polyData)

        if self.colorizeCallback:
            self.colorizeCallback(obj)
예제 #19
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()
    panel.show()

    panelConnector = propertyset.PropertyPanelConnector(obj.properties, panel)

    def onPropertyChanged(propertySet, propertyName):
        obj.properties.setPropertyAttribute('str list', 'enumNames',
                                            ['one', 'two', 'three'])

    obj.properties.connectPropertyChanged(onPropertyChanged)
    obj.setProperty('bool', False)

    assert 'one' in obj.properties.getPropertyAttribute(
        'str list', 'enumNames')

    _pythonManager.consoleWidget().show()
    startApplication(enableQuitTimer=True)
예제 #20
0
    def __init__(self, model):

        om.ObjectModelItem.__init__(self, 'Kinect', om.Icons.Eye)

        self.model = model
        self.scalarBarWidget = None
        self.addProperty('Color By', 1,
                         attributes=om.PropertyAttributes(enumNames=['Solid Color', 'rgb_colors']))
        self.addProperty('Updates Enabled', True)
        self.addProperty('Framerate', model.targetFps,
                         attributes=om.PropertyAttributes(decimals=0, minimum=1.0, maximum=30.0, singleStep=1, hidden=False))
        self.addProperty('Visible', model.visible)
예제 #21
0
 def addDefaultProperties(self):
     self.params.addProperty('Chair Height',
                             0.57,
                             attributes=om.PropertyAttributes(
                                 singleStep=0.01, decimals=3))
     self.params.addProperty('Sit Back Distance',
                             0.2,
                             attributes=om.PropertyAttributes(
                                 singleStep=0.01, decimals=3))
     self.params.addProperty('Speed',
                             1,
                             attributes=om.PropertyAttributes(
                                 singleStep=0.1, decimals=3))
     self.params.addProperty('Back Gaze Bound',
                             0.4,
                             attributes=om.PropertyAttributes(
                                 singleStep=0.01, decimals=3))
     self.params.addProperty('Min Distance',
                             0.1,
                             attributes=om.PropertyAttributes(
                                 singleStep=0.01, decimals=3))
     self.params.addProperty('Pelvis Gaze Bound',
                             0.1,
                             attributes=om.PropertyAttributes(
                                 singleStep=0.01, decimals=3))
     self.params.addProperty('Pelvis Gaze Angle',
                             0,
                             attributes=om.PropertyAttributes(
                                 singleStep=0.01, decimals=3))
     self.params.addProperty('Back y Angle',
                             -0.2,
                             attributes=om.PropertyAttributes(
                                 singleStep=0.01, decimals=3))
예제 #22
0
 def getDefaultProperties(properties):
     properties.addProperty(
         'Side',
         0,
         attributes=om.PropertyAttributes(enumNames=['Left', 'Right']))
     properties.addProperty(
         'Mode',
         0,
         attributes=om.PropertyAttributes(enumNames=['Basic', 'Pinch']))
     properties.addProperty('Amount',
                            100,
                            attributes=propertyset.PropertyAttributes(
                                minimum=0, maximum=100))
     properties.addProperty('Check status', False)
예제 #23
0
    def getDefaultProperties(properties):

        properties.addProperty('Radius',
                               0.195,
                               attributes=om.PropertyAttributes(decimals=4,
                                                                minimum=0,
                                                                maximum=10))
        properties.addProperty('Position', [0.7, -0.22, 1.21],
                               attributes=om.PropertyAttributes(decimals=3,
                                                                minimum=-1e4,
                                                                maximum=1e4))
        properties.addProperty('Rotation', [180, -90, 16],
                               attributes=om.PropertyAttributes(decimals=2,
                                                                minimum=-360,
                                                                maximum=360))
예제 #24
0
    def setProvider(self, provider):
        """
        Set the provider for this cloud. This completes the initialisation of the object and displays the cloud by
        pulling data from the provider

        :param provider: An instantiation of the PointCloudSourceMeta abstract class
        :return:
        """
        if not issubclass(provider.__class__, self._requiredProviderClass):
            raise TypeError(
                "Attempted to set {} provider to {}, but it was not a"
                " subclass of {} as is required.".format(
                    self.__class__,
                    provider.__class__,
                    self._requiredProviderClass.__class__,
                )
            )

        self.provider = provider
        self.provider.set_consumer(self)
        self.addProperty("Updates Enabled", True)
        self.addProperty(
            "Number of Point Clouds",
            10,
            attributes=om.PropertyAttributes(
                decimals=0, minimum=1, maximum=100, singleStep=1, hidden=False
            ),
        )
        if self.getProperty("Visible"):
            self.provider.start()
예제 #25
0
    def __init__(self, filename):
        self.parser = OtdfParser()
        self.parser.setOtdfFilename(filename)
        model = self.createDefaultModel()
        assert model is not None
        roboturdf.RobotModelItem.__init__(self, model)

        self.setProperty('Name', os.path.basename(filename))
        self.setProperty('Color Mode', 0)
        self.setPropertyAttribute('Color Mode', 'hidden', True)
        # add otdf properties

        basePropertyKeys = list(self.properties._properties.keys())
        otdfPropertyKeys = []
        for paramName, paramData in self.parser.paramDict.items():
            otdfPropertyKeys.append(paramName)
            valueDefault, valueMin, valueMax, valueIncrement = paramData
            self.addProperty(paramName, float(valueDefault), om.PropertyAttributes(decimals=4, minimum=valueMin, maximum=valueMax, singleStep=valueIncrement, hidden=False))

        orderedProperties = OrderedDict()
        for name in otdfPropertyKeys + basePropertyKeys:
            orderedProperties[name] = self.properties._properties[name]
        self.properties._properties = orderedProperties

        self.updateModelPosition()
예제 #26
0
 def getDefaultProperties(properties):
     properties.addProperty('Posture group', 'General')
     properties.addProperty('Posture name', 'arm up pregrasp')
     properties.addProperty('Side',
                            1,
                            attributes=om.PropertyAttributes(
                                enumNames=['Default', 'Left', 'Right']))
예제 #27
0
    def __init__(self, name, view):
        AffordanceItem.__init__(self, name, vtk.vtkPolyData(), view)
        self.setProperty('Collision Enabled', False)

        self.addProperty('Filename', '')
        self.addProperty('Scale', [1.0, 1.0, 1.0], attributes=om.PropertyAttributes(decimals=3, singleStep=0.01, minimum=0.0, maximum=1e4))

        self.properties.setPropertyIndex('Filename', 0)
        self.properties.setPropertyIndex('Scale', 1)

        # attempt to reload geometry if it is currently empty
        if self.getProperty('Filename') and not self.polyData.GetNumberOfPoints():
            self.updateGeometryFromProperties()
예제 #28
0
    def __init__(self, name, actor):

        om.ObjectModelItem.__init__(self, name, om.Icons.Octomap)


        self.actor = actor
        self.actor.SetUseBounds(False)
        self.addProperty('Visible', actor.GetVisibility())
        self.addProperty('Alpha', 0.8, attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=1.0, singleStep=0.1, hidden=False))
        self.addProperty('Color Mode', 2, attributes=om.PropertyAttributes(enumNames=['Flat', 'Print', 'Height', 'Gray', 'Semantic']))
        self.addProperty('Occ. Space', 1, attributes=om.PropertyAttributes(enumNames=['Hide', 'Show']))
        self.addProperty('Free Space', 0, attributes=om.PropertyAttributes(enumNames=['Hide', 'Show']))
        self.addProperty('Structure', 0, attributes=om.PropertyAttributes(enumNames=['Hide', 'Show']))
        self.addProperty('Tree Depth', 16, attributes=om.PropertyAttributes(decimals=0, minimum=1, maximum=16, singleStep=1.0))
        self.views = []
예제 #29
0
    def setProvider(self, provider):
        """
        Set the provider for this depth image cloud. This completes the initialisation of the object and displays the
        cloud by pulling data from the provider

        :param provider: An instantiation of the DepthImageSourceMeta abstract class
        :return:
        """
        if not issubclass(provider.__class__, self._requiredProviderClass):
            raise TypeError(
                "Attempted to set {} provider to {}, but it was not a"
                " subclass of {} as is required.".format(
                    self.__class__,
                    provider.__class__,
                    self._requiredProviderClass.__class__,
                )
            )

        self.provider = provider
        self.provider.set_consumer(self)

        decimation = int(self.properties.getPropertyEnumValue("Decimation"))
        removeSize = int(self.properties.getProperty("Remove Size"))
        rangeThreshold = float(self.properties.getProperty("Max Range"))
        self.addProperty("Remove Stale Data", False)
        self.addProperty(
            "Stale Data Timeout",
            5.0,
            attributes=om.PropertyAttributes(
                decimals=1, minimum=0.1, maximum=30.0, singleStep=0.1
            ),
        )

        self.provider.set_decimate(int(decimation))
        self.provider.set_remove_size(removeSize)
        self.provider.set_range_threshold(rangeThreshold)
        self.setProperty("Visible", True)
        self.lastDataReceivedTime = time.time()
예제 #30
0
    def __init__(self, name, actor):

        om.ObjectModelItem.__init__(self, name, om.Icons.Collections)


        self.actor = actor
        self.actor.SetUseBounds(False)
        self.addProperty('Visible', actor.GetVisibility())
        self.addProperty('Start', 0.0, attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=1.0, singleStep=0.01))
        self.addProperty('End', 1.0, attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=1.0, singleStep=0.01))

        self.addProperty('Points Alpha', 0.8, attributes=om.PropertyAttributes(decimals=2, minimum=0, maximum=1.0, singleStep=0.1))
        self.addProperty('Point Width', 5.0, attributes=om.PropertyAttributes(decimals=0, minimum=1.0, maximum=30.0, singleStep=1))
        self.addProperty('Pose Width', 1.0, attributes=om.PropertyAttributes(decimals=1, minimum=0.1, maximum=30.0, singleStep=0.1))
        self.addProperty('Color Poses', False)

        self.addProperty('Fill Scans', False)
        self.addProperty('Color by Time', False)
        self.addProperty('Elevation by Time', False)
        self.addProperty('Elevation by Collection', False)
        self.addProperty('Max Elevation', 0.0, attributes=om.PropertyAttributes(decimals=1, minimum=0, maximum=100.0, singleStep=0.1))

        self.views = []
        self.collectionInfos = None