示例#1
0
文件: main.py 项目: TheDudiB/ICM42605
    def __init__(self):
        super(MainUi, self).__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        monitor = QDesktopWidget().screenGeometry(0)
        #self.move(monitor.left(), monitor.top())
        #self.showFullScreen()
        self.settings = QSettings('Elbit', 'Minhal')
        self.AMatrix = array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
        self.SMatrix = array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
        self.external_select, self.IMU_select = 0, 0
        self.RawDataF, self.BiasF, self.align, self.recF, self.scale = 0, 0, 0, 0, 0
        self.rate, self.FLOS, self.cube = 0, 0, 0
        self.comport = None
        self.LOS = array([0, 0, 0])
        self.R = ang2u(self.LOS)
        self.RawSF = float(self.ui.qtSGyroSF.value())
        self.BiasX, self.BiasY, self.BiasZ = 0.0, 0.0, 0.0
        mapFunc = [self.ui.qtSBiasX,
                   self.ui.qtSBiasY,
                   self.ui.qtSBiasZ,
                   self.ui.qtSGyroSF]

        self.iStream = 0
        self.data = [[] for i in range(9)]
        self.data_LOS = [[] for i in range(3)]
        self.ui.qtBStream.clicked.connect(self.stremingData)
        self.ui.verticalLayoutW.removeWidget(self.ui.widget)
        self.ui.widget.close()
        self.ui.plot = PlotWidget(name='gyro data', title='Gyro data x-Red y-Green z-Blue')
        self.ui.plotx = self.ui.plot.plot(pen=red, name='Gyro X')
        self.ui.ploty = self.ui.plot.plot(pen=green, name='Gyro Y')
        self.ui.plotz = self.ui.plot.plot(pen=blue, name='Gyro Z')
        self.ui.plot.setLabel('bottom', 'smaple no')
        self.ui.plot.setLabel('left', 'rate (bit)')
        self.ui.verticalLayoutW.addWidget(self.ui.plot)  # need to improve
        self.ui.qtCRawData.clicked.connect(self.changed)
        self.ui.qtCBias.clicked.connect(self.changed)
        self.ui.qtCAlign.clicked.connect(self.changed)
        self.ui.qtCScale.clicked.connect(self.changed)
        self.ui.qtRERate.clicked.connect(self.external_disp)
        self.ui.qtRECube.clicked.connect(self.external_disp)
        self.ui.qtRELOS.clicked.connect(self.external_disp)
        self.ui.qtRILOS.clicked.connect(self.IMU_display)
        self.ui.qtRICube.clicked.connect(self.IMU_display)
        self.ui.qtRIBoth.clicked.connect(self.IMU_display)
        [x.valueChanged.connect(self.value_chane) for x in mapFunc]
        self.ui.actionAbout.triggered.connect(self.Help)
        self.ui.qtBResetLOS.clicked.connect(self.reset_los)
        for i in range(3):
            for j in range(3):
                cell = QDoubleSpinBox(self.ui.qtAlignMat)
                cell.setButtonSymbols(QAbstractSpinBox.NoButtons)
                cell.setMinimum(0.0001 if i == j else -99.9999)
                cell.setDecimals(4)
                cell.setMaximum(99.9999)
                cell.setValue(1 if i == j else 0)
                cell.cellLoc = (i, j)
                cell.who_ur_dady = 'qtAlignMat'
                cell.valueChanged.connect(self.cell_change)
                self.ui.qtAlignMat.setCellWidget(i, j, cell)
        for i in range(3):
            for j in range(3):
                cell = QDoubleSpinBox(self.ui.qtScaleMat)
                cell.setButtonSymbols(QAbstractSpinBox.NoButtons)
                cell.setMinimum(0.0001 if i == j else -99.9999)
                cell.setDecimals(4)
                cell.setMaximum(99.9999)
                cell.setValue(1 if i == j else 0)
                cell.cellLoc = (i, j)
                cell.who_ur_dady = 'qtScaleMat'
                cell.valueChanged.connect(self.cell_change)
                self.ui.qtScaleMat.setCellWidget(i, j, cell)
        self.update_data()