def __init__(self): Process.__init__(self) self.exit = Event() self.csv = CSVExport() self.i2cMux = PCA9547() self.settings0 = RTIMU.Settings(SETTINGS_FILE_0) self.settings1 = RTIMU.Settings(SETTINGS_FILE_1) self.settings2 = RTIMU.Settings(SETTINGS_FILE_2) self.settings3 = RTIMU.Settings(SETTINGS_FILE_3) self.settings4 = RTIMU.Settings(SETTINGS_FILE_4) self.settings5 = RTIMU.Settings(SETTINGS_FILE_5) self.imu0 = RTIMU.RTIMU(self.settings0) self.imu1 = RTIMU.RTIMU(self.settings1) self.imu2 = RTIMU.RTIMU(self.settings2) self.imu3 = RTIMU.RTIMU(self.settings3) self.imu4 = RTIMU.RTIMU(self.settings4) self.imu5 = RTIMU.RTIMU(self.settings5) self.settings = [ self.settings0, self.settings1, self.settings2, self.settings3, self.settings4, self.settings5 ] self.imus = [ self.imu0, self.imu1, self.imu2, self.imu3, self.imu4, self.imu5 ] self.detectedIMU = [False] * 6 self.detectImu() self.pollInterval = 2
def start(self): ## Reference for the Threaded serial adquisition # # Threaded adquisition for a serial device with interrupts # using Qt4 signals self.data = SerialThread(str(self.ui.cBox_IMU.currentText())) self.data.openPort(str(self.ui.cBox_Port.currentText()), int(self.ui.cBox_Speed.currentText())) ## Register the data object with the cube self.cube = Cube(self.data) # start file if self.ui.chBox_export.isChecked(): ## export data self.csv = CSVExport() self.ui.statusbar.showMessage("Exporting data") else: self.ui.statusbar.showMessage("Adquiring data") # start data thread self.data.start() # dataThread new data signal self.connect(self.data, QtCore.SIGNAL('newData()'), self.updateData) # update UI self.setUILocked(True) # start timer for updating plot self.timer.start(20) # start timer every second for activity self.timerActivity.start(1000) ## Reference for the activity detection algorithm # # Activity detection algorithm propossed by Dr. Pablo Reyes self.activity = ActivityDetection(70, 175, 20, .02) ## Reference for the fall detection algorithm # # Fall detection algorithm propossed by Dr. Pablo Reyes self.fall = FallDetection(.02, 2.8, .65) #~ self.fall = FallDetection(.02, 2.0, .65) ## Reference for self.posture = Posture()