def initCMMD(self): DES_CMMD = 2 sensor = Sensor(self.calMatrix) for i in range(6): current_command = 0 sensor.config_dac(i, current_command) sample = sensor.poll() while sample.sum[i] < DES_CMMD: current_command += 1 sensor.config_dac(i, current_command) sample = sensor.poll() while sample.sum[i] > DES_CMMD: current_command -= 0.1 sensor.config_dac(i, current_command) sample = sensor.poll() while sample.sum[i] < DES_CMMD: current_command += 0.01 sensor.config_dac(i, current_command) sample = sensor.poll() print "**************************************" print "Common-mode values of channels A to F:" print sample.sum print "**************************************" sensor.disconnect()
def __initOFS(self): self.calMatrix = np.eye(6) sensor = Sensor(self.calMatrix) # test all modules are working time.sleep(1) sample = sensor.poll() for cmmd in sample.sum: if cmmd < 0.5: cont = False print('Sum Signal too low (' + str(cmmd) + 'V)') sensor.disconnect() self.rep_ids = { 0x1: 'Accelerometer', 0x2: 'Gyroscope', 0x4: 'Linear Acceleration', 0x5: 'Rotation Vector', 0x8: 'Game Rotation Vector' } self.crc8_table = crc.calculate_CRC8_table() self.crc32_table = crc.calculate_CRC32_table()
if cmmd < 0.5: cont = False print('Sum Signal too low (' + str(cmmd) + 'V)') for i in range(6): current_command = 0 sensor.config_dac(i, current_command) sample = sensor.poll() while sample.sum[i] < DES_CMMD: current_command += 1 sensor.config_dac(i, current_command) sample = sensor.poll() while sample.sum[i] > DES_CMMD: current_command -= 0.1 sensor.config_dac(i, current_command) sample = sensor.poll() while sample.sum[i] < DES_CMMD: current_command += 0.01 sensor.config_dac(i, current_command) sample = sensor.poll() print "**************************************" print "Common-mode values of channels A to F:" print sample.sum print "**************************************" sensor.disconnect()