Пример #1
0
 def __init__(self,
              channel="OPTITRACK_FRAMES",
              desc_channel="OPTITRACK_DATA_DESCRIPTIONS"):
     self.channel = channel
     self.desc_channel = desc_channel
     self.subscriber = None
     self.desc_subscriber = None
     self.unitConversion = 0.001
     self.data_descriptions = None
     self.marker_sets = om.getOrCreateContainer(
         "Marker Sets", parentObj=self.getRootFolder())
     self.rigid_bodies = om.getOrCreateContainer(
         "Rigid Bodies", parentObj=self.getRootFolder())
     self.labeled_markers = om.getOrCreateContainer(
         "Labeled Markers", parentObj=self.getRootFolder())
     self.unlabeled_markers = om.getOrCreateContainer(
         "Unlabeled Markers", parentObj=self.getRootFolder())
     self.drawEdges = False
     self.markerGeometry = None
     self.optitrackToWorld = vtk.vtkTransform()
     self.optitrackToWorld.SetMatrix(
         self.defaultOptitrackToWorld.GetMatrix())
     self.initSubscriber()
     self.callbacks = callbacks.CallbackRegistry([
         'RIGID_BODY_LIST_CHANGED',
     ])
Пример #2
0
    def __init__(self, minValue=0.0, maxValue=1.0, resolution=1000):
        self._value = 0.0
        self.spinbox = QtGui.QDoubleSpinBox()
        self.spinbox.setSuffix('s')
        self.slider = QtGui.QSlider(QtCore.Qt.Horizontal)
        self.playButton = QtGui.QPushButton('Play')
        self.setValueRange(minValue, maxValue)
        self.setResolution(resolution)
        self.slider.connect('valueChanged(int)', self._onSliderValueChanged)
        self.spinbox.connect('valueChanged(double)',
                             self._onSpinboxValueChanged)
        self.playButton.connect('clicked()', self._onPlayClicked)
        self.widget = QtGui.QWidget()
        layout = QtGui.QHBoxLayout(self.widget)
        layout.addWidget(self.playButton)
        layout.addWidget(self.spinbox)
        layout.addWidget(self.slider)

        self.animationPrevTime = 0.0
        self.animationRate = 1.0
        self.animationRateTarget = 1.0
        self.animationRateAlpha = 1.0
        self.animationTimer = TimerCallback(callback=self._tick, targetFps=60)
        self.useRealTime = True

        self.callbacks = callbacks.CallbackRegistry(self.events._fields)

        self.eventFilter = PythonQt.dd.ddPythonEventFilter()
        self.eventFilter.connect('handleEvent(QObject*, QEvent*)',
                                 self._filterEvent)
        self.eventFilter.addFilteredEventType(QtCore.QEvent.MouseButtonPress)
        self.eventFilter.addFilteredEventType(QtCore.QEvent.MouseMove)
        self.slider.installEventFilter(self.eventFilter)
Пример #3
0
    def __init__(self, ikPlanner):

        if USE_DRC_MESSAGES:
            lcmUtils.addSubscriber('CANDIDATE_MANIP_PLAN',
                                   lcmdrc.robot_plan_w_keyframes_t,
                                   self.onManipPlan)
            lcmUtils.addSubscriber('CANDIDATE_ROBOT_PLAN_WITH_SUPPORTS',
                                   lcmdrc.robot_plan_with_supports_t,
                                   self.onManipPlan)
        else:
            lcmUtils.addSubscriber('CANDIDATE_MANIP_PLAN', lcmrl.robot_plan_t,
                                   self.onManipPlan)

        self.lastManipPlan = None
        self.committedPlans = []
        self.callbacks = callbacks.CallbackRegistry(
            [self.PLAN_RECEIVED, self.PLAN_COMMITTED, self.USE_SUPPORTS])
        self.ikPlanner = ikPlanner
        self.publishPlansWithSupports = False
        self.plansWithSupportsAreQuasistatic = True
        self.leftFootSupportEnabled = True
        self.rightFootSupportEnabled = True
        self.leftHandSupportEnabled = False
        self.rightHandSupportEnabled = False
        self.pelvisSupportEnabled = False
Пример #4
0
 def __init__(self):
     self._treeWidget = None
     self._propertiesPanel = None
     self._objects = {}
     self._blockSignals = False
     self.actions = []
     self.callbacks = callbacks.CallbackRegistry([self.ACTION_SELECTED, self.SELECTION_CHANGED, self.OBJECT_ADDED])
Пример #5
0
    def __init__(self):

        self.callbacks = callbacks.CallbackRegistry([self.PROPERTY_CHANGED_SIGNAL,
                                                     self.PROPERTY_ADDED_SIGNAL,
                                                     self.PROPERTY_ATTRIBUTE_CHANGED_SIGNAL])

        self._properties = OrderedDict()
        self._attributes = {}
        self._alternateNames = {}
Пример #6
0
 def __init__(self, channel):
     self.collection = OrderedDict()
     self.collectionId = newUUID()
     self.sentCommands = set()
     self.sentRequest = None
     self.channel = channel
     self.callbacks = callbacks.CallbackRegistry(
         [self.DESCRIPTION_UPDATED_SIGNAL, self.DESCRIPTION_REMOVED_SIGNAL])
     self.sub = None
     self._modified()
Пример #7
0
    def __init__(self, name, icon=Icons.Robot, properties=None):

        #print 'init called on:', self
        self._tree = None
        self.callbacks = callbacks.CallbackRegistry([self.REMOVED_FROM_OBJECT_MODEL])
        self.properties = properties or PropertySet()
        self.properties.connectPropertyChanged(self._onPropertyChanged)
        self.properties.connectPropertyAdded(self._onPropertyAdded)
        self.properties.connectPropertyAttributeChanged(self._onPropertyAttributeChanged)

        self.addProperty('Icon', icon, attributes=PropertyAttributes(hidden=True))
        self.addProperty('Deletable', True, attributes=PropertyAttributes(hidden=True))
        self.addProperty('Name', name, attributes=PropertyAttributes(hidden=True))
Пример #8
0
 def __init__(self):
     self.tasks = []
     self.generators = []
     self.timer = TimerCallback(targetFps=10)
     self.timer.callback = self.callbackLoop
     self.callbacks = callbacks.CallbackRegistry([
         self.QUEUE_STARTED_SIGNAL, self.QUEUE_STOPPED_SIGNAL,
         self.TASK_STARTED_SIGNAL, self.TASK_ENDED_SIGNAL,
         self.TASK_PAUSED_SIGNAL, self.TASK_FAILED_SIGNAL,
         self.TASK_EXCEPTION_SIGNAL
     ])
     self.currentTask = None
     self.isRunning = False
Пример #9
0
 def __init__(self, minValue=0.0, maxValue=1.0, resolution=1000):
     self.spinbox = QtGui.QDoubleSpinBox()
     self.spinbox.setSuffix('s')
     self.slider = QtGui.QSlider(QtCore.Qt.Horizontal)
     self.setResolution(resolution)
     self.setValueRange(minValue, maxValue)
     self.slider.connect('valueChanged(int)', self._onSliderValueChanged)
     self.spinbox.connect('valueChanged(double)', self._onSpinboxValueChanged)
     self.widget = QtGui.QWidget()
     layout = QtGui.QHBoxLayout(self.widget)
     layout.addWidget(self.spinbox)
     layout.addWidget(self.slider)
     self.animationTimer = None
     self.callbacks = callbacks.CallbackRegistry(self.events._fields)
Пример #10
0
    def __init__(self, channel):
        self.collection = OrderedDict()
        self.collectionId = newUUID()
        self.sentCommands = set()
        self.sentRequest = None
        self.channel = channel
        self.callbacks = callbacks.CallbackRegistry([self.DESCRIPTION_UPDATED_SIGNAL,
                                                     self.DESCRIPTION_REMOVED_SIGNAL])
        self.sub = None
        self._modified()

        if USE_LCM:
            self.sub = lcmUtils.addSubscriber(self.channel, messageClass=lcmdrc.affordance_collection_t, callback=self._onCommandMessage)
            self.sub.setNotifyAllMessagesEnabled(True)
Пример #11
0
    def __init__(self, robotURDF, fixedPointFile, leftFootLink, rightFootLink,
                 pelvisLink):

        self.comm = None
        self.outputConsole = None
        self.ready = False
        self.restarted = False
        self.robotURDF = robotURDF
        self.fixedPointFile = fixedPointFile
        self.leftFootLink = leftFootLink
        self.rightFootLink = rightFootLink
        self.pelvisLink = pelvisLink
        self.infoFunc = None

        self.callbacks = callbacks.CallbackRegistry([self.STARTUP_COMPLETED])
Пример #12
0
 def __init__(self):
     self._treeWidget = None
     self._propertiesPanel = None
     self._objectToItem = {}
     self._itemToObject = {}
     self._itemToName = {}
     self._nameToItems = defaultdict(set)
     self._blockSignals = False
     self._propertyConnector = None
     self.actions = []
     self.callbacks = callbacks.CallbackRegistry([
                         self.ACTION_SELECTED,
                         self.OBJECT_ADDED,
                         self.OBJECT_CLICKED,
                         self.SELECTION_CHANGED,
                         ])
Пример #13
0
    def __init__(
        self, imageView, obj=None, callback=None, numberOfPoints=1, drawLines=True
    ):

        self.imageView = imageView
        self.view = imageView.view
        self.obj = obj
        self.drawLines = drawLines
        self.annotationObj = None
        self.annotationFunc = callback
        self.eventFilter = None
        self.numberOfPoints = numberOfPoints
        self.showCursor = False
        self.cursorObj = None
        self.callbacks = callbacks.CallbackRegistry([self.DOUBLE_CLICK_EVENT])
        self.clear()