Beispiel #1
0
def initFrame():
    """
    Initializes the sensel to capture all contacts. Returns the initial frame.
    """
    error = sensel.setFrameContent(handle, sensel.FRAME_CONTENT_CONTACTS_MASK)
    (error, frame) = sensel.allocateFrameData(handle)
    error = sensel.startScanning(handle)
    return frame
 def init_frame(self):
     self.close_on_error(
         sensel.setFrameContent(self.handle,
                                sensel.FRAME_CONTENT_CONTACTS_MASK))
     frame = self.close_on_error(sensel.allocateFrameData(self.handle))
     assert frame
     self.close_on_error(sensel.startScanning(self.handle))
     return frame
Beispiel #3
0
 def _initFrame(self):
     (error, self.info) = sensel.getSensorInfo(self.handle)
     error = sensel.setFrameContent(self.handle, 0x0F)
     error = sensel.setContactsMask(self.handle, 0x0F)
     (error, frame) = sensel.allocateFrameData(self.handle)
     error = sensel.startScanning(self.handle)
     self._frame = frame
     self.frames = []
     self.updated = False
     try:
         _thread.start_new_thread(self._run, ())
     except:
         print("Thread Error")
Beispiel #4
0
def init_frame(handle, setrate=125, detail=0, baseline=1, devbuffer=10):

    # Frame rate
    # setrate = 2000
    error = sensel.setMaxFrameRate(handle, setrate)

    # Scan detail
    # 0 for high, 1 for medium, 2 for low
    # detail = 0
    error = sensel.setScanDetail(handle, detail)

    error, rate = sensel.getMaxFrameRate(handle)
    print('Rate: ' + str(rate))
    error, val = sensel.getScanDetail(handle)
    print('Scan detail: ' + str(val))

    # Misc
    error = sensel.setDynamicBaseline(handle, baseline)
    error, val = sensel.getDynamicBaseline(handle)
    print('Dynamic baseline: ' + str(val))

    error = sensel.setEnableBlobMerge(handle, 0)
    error, val = sensel.getEnableBlobMerge(handle)
    print('Blob merge: ' + str(val))

    # Frame content
    # The Content Bitmask is used to enable or disable reporting of the five (5) parameters in Frame Data:
    # Contacts, Force Array, Labels Array, Accelerometer Data, and Lost Frame Count.
    # Set the byte value according to the parameters needed. For example,
    # FRAME_CONTENT_PRESSURE_MASK = 0x01
    # FRAME_CONTENT_LABELS_MASK   = 0x02
    # FRAME_CONTENT_CONTACTS_MASK = 0x04
    # FRAME_CONTENT_ACCEL_MASK    = 0x08

    # mask = sensel.FRAME_CONTENT_PRESSURE_MASK + sensel.FRAME_CONTENT_ACCEL_MASK
    # mask = sensel.FRAME_CONTENT_PRESSURE_MASK + sensel.FRAME_CONTENT_CONTACTS_MASK
    mask = sensel.FRAME_CONTENT_PRESSURE_MASK
    # mask = sensel.FRAME_CONTENT_CONTACTS_MASK
    error = sensel.setFrameContent(handle, mask)

    # set buffer control
    error = sensel.setBufferControl(handle, devbuffer)
    error, val = sensel.getBufferControl(handle)
    print('Device buffer: ' + str(val))

    error, frame = sensel.allocateFrameData(handle)
    error = sensel.startScanning(handle)
    return frame
Beispiel #5
0
def initFrame():
    error = sensel.setFrameContent(handle, sensel.FRAME_CONTENT_CONTACTS_MASK)
    (error, frame) = sensel.allocateFrameData(handle)
    error = sensel.startScanning(handle)
    return frame