Skip to content

Commit 08eb1e4

Browse files
committed
autotune: add option for PID controller without closed-loop zero
1 parent 3d1a2cd commit 08eb1e4

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

autotune/autotune.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"""
3838

3939
import sys
40-
from PyQt5.QtWidgets import QDialog, QApplication, QLabel, QRadioButton, QSlider, QPushButton, QVBoxLayout, QHBoxLayout, QFormLayout, QFileDialog, QLineEdit, QSpinBox, QDoubleSpinBox, QMessageBox, QTableWidget, QTableWidgetItem, QHeaderView
40+
from PyQt5.QtWidgets import QDialog, QApplication, QLabel, QRadioButton, QSlider, QPushButton, QVBoxLayout, QHBoxLayout, QFormLayout, QFileDialog, QLineEdit, QSpinBox, QDoubleSpinBox, QMessageBox, QCheckBox, QTableWidget, QTableWidgetItem, QHeaderView
4141
from PyQt5.QtCore import Qt
4242

4343
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
@@ -269,7 +269,13 @@ def printImproperTfError(self):
269269
def createPidLayout(self):
270270
layout_pid = QFormLayout()
271271

272-
layout_pid.addRow(QLabel("Ideal/Standard: Kp * [1 + Ki + Kd]\t(Parallel: Kp + Ki + Kd)"))
272+
layout_structure = QHBoxLayout()
273+
layout_structure.addWidget(QLabel("Ideal/Standard: Kp * [1 + Ki + Kd]\t(Parallel: Kp + Ki + Kd)"))
274+
self.pid_no_zero_box = QCheckBox("PI no-zero", self)
275+
self.pid_no_zero_box.setChecked(False)
276+
self.pid_no_zero_box.stateChanged.connect(self.updateClosedLoop)
277+
layout_structure.addWidget(self.pid_no_zero_box)
278+
layout_pid.addRow(layout_structure)
273279

274280
layout_k = QHBoxLayout()
275281
self.slider_k = DoubleSlider(Qt.Horizontal)
@@ -585,7 +591,7 @@ def updateClosedLoop(self):
585591
p_control = ctrl.TransferFunction([kc], [1], dt, inputs='id_out', outputs='pid_out')
586592
sum_control = ctrl.summing_junction(inputs=['pid_out', 'ff_out'], output='u')
587593

588-
remove_zero = False
594+
remove_zero = self.pid_no_zero_box.isChecked()
589595
no_derivative_kick = True
590596

591597
if remove_zero:

0 commit comments

Comments
 (0)