-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_window.py
163 lines (155 loc) · 7.71 KB
/
main_window.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'main_window.ui'
#
# Created: Fri Jun 24 13:46:24 2016
# by: PyQt4 UI code generator 4.11.2
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
from PyQt4.Qwt5 import QwtPlot
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName(_fromUtf8("MainWindow"))
MainWindow.resize(1251, 901)
self.centralwidget = QtGui.QWidget(MainWindow)
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.pv = QtGui.QLCDNumber(self.centralwidget)
self.pv.setGeometry(QtCore.QRect(990, 120, 81, 31))
font = QtGui.QFont()
font.setBold(False)
font.setWeight(50)
font.setKerning(False)
self.pv.setFont(font)
self.pv.setFrameShape(QtGui.QFrame.Panel)
self.pv.setFrameShadow(QtGui.QFrame.Plain)
self.pv.setNumDigits(5)
self.pv.setDigitCount(5)
self.pv.setSegmentStyle(QtGui.QLCDNumber.Flat)
self.pv.setObjectName(_fromUtf8("pv"))
self.sp = QtGui.QSpinBox(self.centralwidget)
self.sp.setGeometry(QtCore.QRect(130, 120, 81, 31))
self.sp.setMinimum(100)
self.sp.setMaximum(15000)
self.sp.setSingleStep(100)
self.sp.setProperty("value", 2000)
self.sp.setObjectName(_fromUtf8("sp"))
self.layoutWidget = QtGui.QWidget(self.centralwidget)
self.layoutWidget.setGeometry(QtCore.QRect(40, 350, 131, 41))
self.layoutWidget.setObjectName(_fromUtf8("layoutWidget"))
self.formLayout_2 = QtGui.QFormLayout(self.layoutWidget)
self.formLayout_2.setFieldGrowthPolicy(QtGui.QFormLayout.AllNonFixedFieldsGrow)
self.formLayout_2.setMargin(0)
self.formLayout_2.setObjectName(_fromUtf8("formLayout_2"))
self.Ts = QtGui.QSpinBox(self.layoutWidget)
self.Ts.setMinimum(10)
self.Ts.setMaximum(100)
self.Ts.setProperty("value", 15)
self.Ts.setObjectName(_fromUtf8("Ts"))
self.formLayout_2.setWidget(0, QtGui.QFormLayout.LabelRole, self.Ts)
self.label_4 = QtGui.QLabel(self.layoutWidget)
self.label_4.setObjectName(_fromUtf8("label_4"))
self.formLayout_2.setWidget(0, QtGui.QFormLayout.FieldRole, self.label_4)
self.Kp = QtGui.QDoubleSpinBox(self.centralwidget)
self.Kp.setGeometry(QtCore.QRect(490, 60, 81, 31))
self.Kp.setAutoFillBackground(False)
self.Kp.setDecimals(3)
self.Kp.setMaximum(999.9)
self.Kp.setSingleStep(0.01)
self.Kp.setProperty("value", 1.0)
self.Kp.setObjectName(_fromUtf8("Kp"))
self.Kd = QtGui.QDoubleSpinBox(self.centralwidget)
self.Kd.setGeometry(QtCore.QRect(470, 240, 81, 31))
self.Kd.setDecimals(3)
self.Kd.setMaximum(999.9)
self.Kd.setSingleStep(0.001)
self.Kd.setObjectName(_fromUtf8("Kd"))
self.Ki = QtGui.QDoubleSpinBox(self.centralwidget)
self.Ki.setGeometry(QtCore.QRect(470, 150, 81, 31))
self.Ki.setDecimals(3)
self.Ki.setMaximum(999.9)
self.Ki.setSingleStep(0.01)
self.Ki.setObjectName(_fromUtf8("Ki"))
self.pid_off = QtGui.QLabel(self.centralwidget)
self.pid_off.setEnabled(True)
self.pid_off.setGeometry(QtCore.QRect(60, 40, 1021, 301))
font = QtGui.QFont()
font.setKerning(True)
self.pid_off.setFont(font)
self.pid_off.setText(_fromUtf8(""))
self.pid_off.setPixmap(QtGui.QPixmap(_fromUtf8("pid_off.png")))
self.pid_off.setScaledContents(True)
self.pid_off.setObjectName(_fromUtf8("pid_off"))
self.layoutWidget1 = QtGui.QWidget(self.centralwidget)
self.layoutWidget1.setGeometry(QtCore.QRect(20, 410, 1171, 431))
self.layoutWidget1.setObjectName(_fromUtf8("layoutWidget1"))
self.horizontalLayout = QtGui.QHBoxLayout(self.layoutWidget1)
self.horizontalLayout.setMargin(0)
self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout"))
self.plot = QwtPlot(self.layoutWidget1)
self.plot.setObjectName(_fromUtf8("plot"))
self.horizontalLayout.addWidget(self.plot)
self.plot_e = QwtPlot(self.layoutWidget1)
self.plot_e.setObjectName(_fromUtf8("plot_e"))
self.horizontalLayout.addWidget(self.plot_e)
self.e = QtGui.QLCDNumber(self.centralwidget)
self.e.setGeometry(QtCore.QRect(290, 130, 71, 31))
font = QtGui.QFont()
font.setBold(False)
font.setWeight(50)
font.setKerning(False)
self.e.setFont(font)
self.e.setFrameShape(QtGui.QFrame.Panel)
self.e.setFrameShadow(QtGui.QFrame.Plain)
self.e.setNumDigits(5)
self.e.setSegmentStyle(QtGui.QLCDNumber.Flat)
self.e.setObjectName(_fromUtf8("e"))
self.pid_on = QtGui.QLabel(self.centralwidget)
self.pid_on.setEnabled(True)
self.pid_on.setGeometry(QtCore.QRect(60, 40, 1021, 301))
font = QtGui.QFont()
font.setKerning(True)
self.pid_on.setFont(font)
self.pid_on.setText(_fromUtf8(""))
self.pid_on.setPixmap(QtGui.QPixmap(_fromUtf8("pid_on.png")))
self.pid_on.setScaledContents(True)
self.pid_on.setObjectName(_fromUtf8("pid_on"))
self.layoutWidget2 = QtGui.QWidget(self.centralwidget)
self.layoutWidget2.setGeometry(QtCore.QRect(10, 10, 178, 33))
self.layoutWidget2.setObjectName(_fromUtf8("layoutWidget2"))
self.formLayout = QtGui.QFormLayout(self.layoutWidget2)
self.formLayout.setMargin(0)
self.formLayout.setObjectName(_fromUtf8("formLayout"))
self.boton_pid_on = QtGui.QPushButton(self.layoutWidget2)
self.boton_pid_on.setObjectName(_fromUtf8("boton_pid_on"))
self.formLayout.setWidget(0, QtGui.QFormLayout.LabelRole, self.boton_pid_on)
self.boton_pid_off = QtGui.QPushButton(self.layoutWidget2)
self.boton_pid_off.setEnabled(False)
self.boton_pid_off.setObjectName(_fromUtf8("boton_pid_off"))
self.formLayout.setWidget(0, QtGui.QFormLayout.FieldRole, self.boton_pid_off)
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
QtCore.QObject.connect(self.boton_pid_on, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.on)
QtCore.QObject.connect(self.boton_pid_off, QtCore.SIGNAL(_fromUtf8("clicked()")), MainWindow.off)
QtCore.QObject.connect(self.Ts, QtCore.SIGNAL(_fromUtf8("editingFinished()")), MainWindow.set_param)
QtCore.QObject.connect(self.Ki, QtCore.SIGNAL(_fromUtf8("editingFinished()")), MainWindow.set_param)
QtCore.QObject.connect(self.Kp, QtCore.SIGNAL(_fromUtf8("editingFinished()")), MainWindow.set_param)
QtCore.QObject.connect(self.Kd, QtCore.SIGNAL(_fromUtf8("editingFinished()")), MainWindow.set_param)
QtCore.QObject.connect(self.sp, QtCore.SIGNAL(_fromUtf8("editingFinished()")), MainWindow.set_param)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(_translate("MainWindow", "Control PID con Arduino", None))
self.label_4.setText(_translate("MainWindow", "Ts [ms]", None))
self.boton_pid_on.setText(_translate("MainWindow", "ON", None))
self.boton_pid_off.setText(_translate("MainWindow", "OFF", None))