def _run(self): self.is_running = True while (self.is_running): error = sensel.readSensor(self.handle) (error, num_frames) = sensel.getNumAvailableFrames(self.handle) for i in range(num_frames): self._sync() timestamp = time.perf_counter() error = sensel.getFrame(self.handle, self._frame) R = self.info.num_rows C = self.info.num_cols force_array = np.zeros((R, C)) for r in range(R): force_array[r, :] = self._frame.force_array[r * C:(r + 1) * C] force_array *= 0.2 frame = FrameData(force_array, timestamp) for i in range(self._frame.n_contacts): c = self._frame.contacts[i] x = c.x_pos / Board.MAX_X y = c.y_pos / Board.MAX_Y contact = ContactData(c.id, c.state, x, y, c.area, c.total_force, c.major_axis, c.minor_axis, c.delta_x, c.delta_y, c.delta_force, c.delta_area) frame.append_contact(contact) self.frames.append(frame) self.updated = True self._closeSensel()
def scanFrames(frame, info): error = sensel.readSensor(handle) (error, num_frames) = sensel.getNumAvailableFrames(handle) for i in range(num_frames): #print(num_frames) error = sensel.getFrame(handle, frame) printFrame(frame, info)
def scan_frames(handle, frame, info): error = sensel.readSensor(handle) error, num_frames = sensel.getNumAvailableFrames(handle) # print('Available num frames:', num_frames) f_image = np.zeros((info.num_rows, info.num_cols)) for i in range(num_frames): error = sensel.getFrame(handle, frame) # print('Content bit mask: ', frame.content_bit_mask) f_image = print_frame(frame, info) return f_image
def scan_frames(frame, info): error = sensel.readSensor(handle) error, num_frames = sensel.getNumAvailableFrames(handle) for i in range(num_frames): error = sensel.getFrame(handle, frame) do_frame(frame, info)
def get_frame(self): logger.debug('getting frame into {} on handle {}'.format( self.frame, self.handle)) self.close_on_error(sensel.getFrame(self.handle, self.frame)) return self.frame