logInspectorInternal.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 
3 from logInspector import LogInspectorWindow
4 
5 import sys, os
6 from PyQt5 import QtCore
7 from PyQt5.QtWidgets import QWidget, QDialog, QApplication, QPushButton, QVBoxLayout, QTreeView, QFileSystemModel,\
8  QHBoxLayout, QGridLayout, QMainWindow, QSizePolicy, QSpacerItem, QFileDialog, QMessageBox, QLabel, QRadioButton,\
9  QAbstractItemView, QMenu, QTableWidget,QTableWidgetItem, QSpinBox, QCheckBox
10 from PyQt5.QtGui import QMovie, QPicture, QIcon, QDropEvent
11 from PyQt5.Qt import QApplication, QClipboard
12 import traceback
13 import yaml
14 
15 
16 class ChooseDevsDialog(QDialog):
17  def __init__(self, plotter, parent=None):
18  super(ChooseDevsDialog, self).__init__(parent)
19  self.setWindowTitle("Choose Devices")
20  self.parent = parent
21  self.mainLayout = QVBoxLayout()
22 
23  self.selectAllButton = QPushButton()
24  self.selectAllButton.setText("Select All")
25  self.selectAllButton.clicked.connect(self.selectAll)
26  self.mainLayout.addWidget(self.selectAllButton)
27 
28  self.selectNoneButton = QPushButton()
29  self.selectNoneButton.setText("Select None")
30  self.selectNoneButton.clicked.connect(self.selectNone)
31  self.mainLayout.addWidget(self.selectNoneButton)
32 
33  self.checkboxes = []
34  for i in range(parent.log.numDev):
35  checkbox = QCheckBox()
36  checkbox.setText(str(parent.log.serials[i]))
37  checkbox.setChecked(i in parent.plotter.active_devs)
38  checkbox.clicked.connect(self.updatePlot)
39  self.checkboxes.append(checkbox)
40  self.mainLayout.addWidget(checkbox)
41 
42  self.okbutton = QPushButton()
43  self.okbutton.setText("OK")
44  self.okbutton.clicked.connect(self.clickedOk)
45  self.mainLayout.addWidget(self.okbutton)
46 
47 
48  self.setLayout(self.mainLayout)
49 
50  def updatePlot(self):
51  active_serials = []
52  for i, checkbox in enumerate(self.checkboxes):
53  if checkbox.isChecked():
54  active_serials.append(self.parent.log.serials[i])
55  self.parent.plotter.setActiveSerials(active_serials)
56  self.parent.updatePlot()
57 
58  def clickedOk(self):
59  self.close()
60 
61  def selectAll(self):
62  for checkbox in self.checkboxes:
63  checkbox.setChecked(True)
64  self.updatePlot()
65 
66  def selectNone(self):
67  for checkbox in self.checkboxes:
68  checkbox.setChecked(False)
69  self.updatePlot()
70 
71 
73  def __init__(self, config, parent=None):
74  super(logInspectorInternal, self).__init__(config, parent)
75  self.page = 0
76 
77 
78  def createButtonColumn(self):
79  super(logInspectorInternal, self).createButtonColumn()
80  self.addButton('Debug Int', lambda: self.plot('debugiArr'))
81  self.addButton('Debug Float', lambda: self.plot('debugfArr'))
82  self.addButton('Debug Double', lambda: self.plot('debuglfArr'))
83  self.addButton('Delta Time', lambda: self.plot('deltatime'))
84  self.addButton('Mag Decl.', lambda: self.plot('magDec'))
85  self.addButton('EKF Biases', lambda: self.plot('ekfBiases'))
86  self.addButton('Phase Residuals', lambda: self.plot('rtkResiduals', ('phase', self.page)))
87  self.addButton('Code Residuals', lambda: self.plot('rtkResiduals', ('code', self.page)))
88  self.addButton('RTK Debug', lambda: self.plot('rtkDebug'))
89  self.addButton('RTK Dbg 2', lambda: self.plot('rtkDebug2'))
90  self.addButton('RTK Dbg 2 Sat', lambda: self.plot('rtkDebug2Sat'))
91  self.addButton('RTK Dbg 2 STD', lambda: self.plot('rtkDebug2Std'))
92  self.addButton('RTK Dbg 2 Lock', lambda: self.plot('rtkDebug2Lock'))
93  self.addButton('RTK Pos Misc', lambda: self.plot('rtkPosMisc'))
94  self.addButton('RTK Cmp Misc', lambda: self.plot('rtkCmpMisc'))
95  self.addButton('Wheel Encoder', lambda: self.plot('wheelEncoder'))
96  self.addButton('GPS Raw Time', lambda: self.plot('gpsRawTime'))
97  #self.addButton('RTK Rel', lambda: self.plot('rtkRel'))
98 
100  super(logInspectorInternal, self).createBottomToolbar()
101  # pageLabel = QLabel()
102  # pageLabel.setText("Page")
103  # self.pageInput = QSpinBox()
104  # self.pageInput.setValue(self.page)
105  # self.toolLayout.addWidget(pageLabel)
106  # self.toolLayout.addWidget(self.pageInput)
107  # self.pageInput.valueChanged.connect(self.changePage)
108  # self.toolLayout.addWidget(self.pageInput)
109 
110  def changePage(self, val):
111  self.page = val
112  if self.plotargs is not None:
113  self.plotargs = (self.plotargs[0], self.page)
114  self.updatePlot()
115 
116  def chooseDevs(self):
117  try:
118  dlg = ChooseDevsDialog(self.plotter, self)
119  dlg.show()
120  dlg.exec_()
121  except Exception as e:
122  self.showError(e)
123 
124  def RMS(self):
125  if self.log is not None:
126  self.log.calculateRMS()
127  self.log.printRMSReport()
128  self.log.openRMSReport()
129  # self.stopLoadingIndicator()
130 
132  super(logInspectorInternal, self).formatButtonColumn()
133  self.devicesLayout = QHBoxLayout()
134  self.addButton('RMS', self.RMS, layout=self.devicesLayout)
135  self.addButton('Choose Devices', self.chooseDevs, layout=self.devicesLayout)
136  self.controlLayout.addLayout(self.devicesLayout)
137 
138 if __name__ == '__main__':
139  app = QApplication(sys.argv)
140  MainWindow = QMainWindow()
141 
142  configFilePath = os.path.join(os.path.expanduser("~"), "Documents", "Inertial_Sense", "config.yaml")
143 
144  main = logInspectorInternal(configFilePath, MainWindow)
145  main.setupUi()
146  # main.load(config['directory'])
147  main.show()
148 
149  if len(sys.argv) > 1:
150  directory = sys.argv[1]
151  main.load(directory)
152 
153  app.exec_()
GeneratorWrapper< T > range(T const &start, T const &end, T const &step)
Definition: catch.hpp:4141
def addButton(self, name, function, multithreaded=True, layout=None)


inertial_sense_ros
Author(s):
autogenerated on Sun Feb 28 2021 03:17:57