diff --git a/.idea/ECE-1140.iml b/.idea/ECE-1140.iml
index 905fa65b..74d515a0 100644
--- a/.idea/ECE-1140.iml
+++ b/.idea/ECE-1140.iml
@@ -4,7 +4,7 @@
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 7fca5256..db8786c0 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,5 +3,5 @@
-
+
\ No newline at end of file
diff --git a/Train Controller HW/test.txt b/Train Controller HW/test.txt
deleted file mode 100644
index e69de29b..00000000
diff --git a/Train Controller HW/test_lauren_ui.py b/Train Controller HW/test_lauren_ui.py
deleted file mode 100644
index 6ddb64c2..00000000
--- a/Train Controller HW/test_lauren_ui.py
+++ /dev/null
@@ -1,413 +0,0 @@
-# -*- coding: utf-8 -*-
-
-# Form implementation generated from reading ui file 'main.ui'
-#
-# Created by: PyQt5 UI code generator 5.15.10
-#
-# WARNING: Any manual changes made to this file will be lost when pyuic5 is
-# run again. Do not edit this file unless you know what you are doing.
-
-
-from PyQt5 import QtCore, QtGui, QtWidgets
-
-
-class Ui_MainWindow(object):
- def setupUi(self, MainWindow):
- MainWindow.setObjectName("MainWindow")
- MainWindow.resize(1054, 857)
- MainWindow.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
- MainWindow.setStyleSheet("alternate-background-color: rgb(255, 143, 148);")
- MainWindow.setTabShape(QtWidgets.QTabWidget.Rounded)
- self.centralwidget = QtWidgets.QWidget(MainWindow)
- self.centralwidget.setObjectName("centralwidget")
- self.gridLayout_2 = QtWidgets.QGridLayout(self.centralwidget)
- self.gridLayout_2.setObjectName("gridLayout_2")
- self.BrkAcelBox = QtWidgets.QGroupBox(self.centralwidget)
- self.BrkAcelBox.setMinimumSize(QtCore.QSize(525, 0))
- self.BrkAcelBox.setStyleSheet("background-color: rgb(233, 247, 255);")
- self.BrkAcelBox.setTitle("")
- self.BrkAcelBox.setObjectName("BrkAcelBox")
- self.gridLayout_6 = QtWidgets.QGridLayout(self.BrkAcelBox)
- self.gridLayout_6.setObjectName("gridLayout_6")
- self.horizontalLayout = QtWidgets.QHBoxLayout()
- self.horizontalLayout.setObjectName("horizontalLayout")
- self.verticalLayout_2 = QtWidgets.QVBoxLayout()
- self.verticalLayout_2.setObjectName("verticalLayout_2")
- self.label_10 = QtWidgets.QLabel(self.BrkAcelBox)
- font = QtGui.QFont()
- font.setPointSize(20)
- self.label_10.setFont(font)
- self.label_10.setAlignment(QtCore.Qt.AlignCenter)
- self.label_10.setObjectName("label_10")
- self.verticalLayout_2.addWidget(self.label_10)
- self.lcdBrk = QtWidgets.QLCDNumber(self.BrkAcelBox)
- self.lcdBrk.setDigitCount(3)
- self.lcdBrk.setObjectName("lcdBrk")
- self.verticalLayout_2.addWidget(self.lcdBrk)
- self.vertSliderBrk = QtWidgets.QSlider(self.BrkAcelBox)
- self.vertSliderBrk.setOrientation(QtCore.Qt.Vertical)
- self.vertSliderBrk.setObjectName("vertSliderBrk")
- self.verticalLayout_2.addWidget(self.vertSliderBrk)
- self.horizontalLayout.addLayout(self.verticalLayout_2)
- self.verticalLayout_5 = QtWidgets.QVBoxLayout()
- self.verticalLayout_5.setObjectName("verticalLayout_5")
- self.groupBox_2 = QtWidgets.QGroupBox(self.BrkAcelBox)
- self.groupBox_2.setMaximumSize(QtCore.QSize(300, 16777215))
- font = QtGui.QFont()
- font.setPointSize(20)
- self.groupBox_2.setFont(font)
- self.groupBox_2.setStyleSheet("selection-color: rgb(255, 14, 30);")
- self.groupBox_2.setAlignment(QtCore.Qt.AlignCenter)
- self.groupBox_2.setObjectName("groupBox_2")
- self.verticalLayout = QtWidgets.QVBoxLayout(self.groupBox_2)
- self.verticalLayout.setObjectName("verticalLayout")
- self.lcdPwrOut = QtWidgets.QLCDNumber(self.groupBox_2)
- self.lcdPwrOut.setObjectName("lcdPwrOut")
- self.verticalLayout.addWidget(self.lcdPwrOut)
- self.label_20 = QtWidgets.QLabel(self.groupBox_2)
- font = QtGui.QFont()
- font.setPointSize(20)
- self.label_20.setFont(font)
- self.label_20.setAlignment(QtCore.Qt.AlignCenter)
- self.label_20.setObjectName("label_20")
- self.verticalLayout.addWidget(self.label_20)
- self.PwrFail = QtWidgets.QCheckBox(self.groupBox_2)
- font = QtGui.QFont()
- font.setPointSize(19)
- self.PwrFail.setFont(font)
- self.PwrFail.setObjectName("PwrFail")
- self.verticalLayout.addWidget(self.PwrFail)
- self.SigFail = QtWidgets.QCheckBox(self.groupBox_2)
- font = QtGui.QFont()
- font.setPointSize(19)
- self.SigFail.setFont(font)
- self.SigFail.setObjectName("SigFail")
- self.verticalLayout.addWidget(self.SigFail)
- self.BrkFail = QtWidgets.QCheckBox(self.groupBox_2)
- font = QtGui.QFont()
- font.setPointSize(19)
- self.BrkFail.setFont(font)
- self.BrkFail.setObjectName("BrkFail")
- self.verticalLayout.addWidget(self.BrkFail)
- self.verticalLayout_5.addWidget(self.groupBox_2)
- self.horizontalLayout.addLayout(self.verticalLayout_5)
- self.verticalLayout_3 = QtWidgets.QVBoxLayout()
- self.verticalLayout_3.setObjectName("verticalLayout_3")
- self.label_11 = QtWidgets.QLabel(self.BrkAcelBox)
- font = QtGui.QFont()
- font.setPointSize(20)
- self.label_11.setFont(font)
- self.label_11.setAlignment(QtCore.Qt.AlignCenter)
- self.label_11.setObjectName("label_11")
- self.verticalLayout_3.addWidget(self.label_11)
- self.lcdPow_2 = QtWidgets.QLCDNumber(self.BrkAcelBox)
- self.lcdPow_2.setFrameShape(QtWidgets.QFrame.Box)
- self.lcdPow_2.setSmallDecimalPoint(False)
- self.lcdPow_2.setDigitCount(3)
- self.lcdPow_2.setObjectName("lcdPow_2")
- self.verticalLayout_3.addWidget(self.lcdPow_2)
- self.vertSliderPow = QtWidgets.QSlider(self.BrkAcelBox)
- self.vertSliderPow.setOrientation(QtCore.Qt.Vertical)
- self.vertSliderPow.setObjectName("vertSliderPow")
- self.verticalLayout_3.addWidget(self.vertSliderPow)
- self.horizontalLayout.addLayout(self.verticalLayout_3)
- self.gridLayout_6.addLayout(self.horizontalLayout, 0, 0, 1, 1)
- self.gridLayout_2.addWidget(self.BrkAcelBox, 1, 1, 2, 2)
- self.groupBox_9 = QtWidgets.QGroupBox(self.centralwidget)
- self.groupBox_9.setStyleSheet("background-color: rgb(233, 247, 255);")
- self.groupBox_9.setTitle("")
- self.groupBox_9.setObjectName("groupBox_9")
- self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.groupBox_9)
- self.verticalLayout_4.setObjectName("verticalLayout_4")
- self.DistanceTillStop = QtWidgets.QLabel(self.groupBox_9)
- font = QtGui.QFont()
- font.setPointSize(20)
- self.DistanceTillStop.setFont(font)
- self.DistanceTillStop.setAlignment(QtCore.Qt.AlignCenter)
- self.DistanceTillStop.setObjectName("DistanceTillStop")
- self.verticalLayout_4.addWidget(self.DistanceTillStop)
- self.lcdAuth = QtWidgets.QLCDNumber(self.groupBox_9)
- self.lcdAuth.setFrameShape(QtWidgets.QFrame.Box)
- self.lcdAuth.setObjectName("lcdAuth")
- self.verticalLayout_4.addWidget(self.lcdAuth)
- self.gridLayout_2.addWidget(self.groupBox_9, 2, 3, 1, 1)
- self.Mode_Box = QtWidgets.QGroupBox(self.centralwidget)
- self.Mode_Box.setMaximumSize(QtCore.QSize(400, 16777215))
- font = QtGui.QFont()
- font.setPointSize(20)
- self.Mode_Box.setFont(font)
- self.Mode_Box.setStyleSheet("background-color: rgb(233, 247, 255);")
- self.Mode_Box.setAlignment(QtCore.Qt.AlignCenter)
- self.Mode_Box.setObjectName("Mode_Box")
- self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.Mode_Box)
- self.horizontalLayout_2.setObjectName("horizontalLayout_2")
- self.buttonMan = QtWidgets.QPushButton(self.Mode_Box)
- self.buttonMan.setCheckable(True)
- self.buttonMan.setChecked(True)
- self.buttonMan.setObjectName("buttonMan")
- self.horizontalLayout_2.addWidget(self.buttonMan)
- self.buttonAuto = QtWidgets.QPushButton(self.Mode_Box)
- self.buttonAuto.setCheckable(True)
- self.buttonAuto.setObjectName("buttonAuto")
- self.horizontalLayout_2.addWidget(self.buttonAuto)
- self.gridLayout_2.addWidget(self.Mode_Box, 0, 0, 1, 1)
- self.Ebrake = QtWidgets.QPushButton(self.centralwidget)
- font = QtGui.QFont()
- font.setPointSize(25)
- self.Ebrake.setFont(font)
- self.Ebrake.setAutoFillBackground(False)
- self.Ebrake.setStyleSheet("background-color: rgb(255, 55, 62);\n"
-"selection-background-color: rgb(255, 52, 53);\n"
-"selection-color: rgb(255, 159, 154);")
- self.Ebrake.setCheckable(True)
- self.Ebrake.setChecked(False)
- self.Ebrake.setDefault(False)
- self.Ebrake.setFlat(False)
- self.Ebrake.setObjectName("Ebrake")
- self.gridLayout_2.addWidget(self.Ebrake, 6, 0, 1, 4)
- self.SpeakerOutputBox = QtWidgets.QGroupBox(self.centralwidget)
- self.SpeakerOutputBox.setMaximumSize(QtCore.QSize(400, 16777215))
- font = QtGui.QFont()
- font.setPointSize(11)
- self.SpeakerOutputBox.setFont(font)
- self.SpeakerOutputBox.setStyleSheet("background-color: rgb(233, 247, 255);")
- self.SpeakerOutputBox.setTitle("")
- self.SpeakerOutputBox.setAlignment(QtCore.Qt.AlignCenter)
- self.SpeakerOutputBox.setObjectName("SpeakerOutputBox")
- self.gridLayout_4 = QtWidgets.QGridLayout(self.SpeakerOutputBox)
- self.gridLayout_4.setObjectName("gridLayout_4")
- self.Announcement = QtWidgets.QLabel(self.SpeakerOutputBox)
- self.Announcement.setObjectName("Announcement")
- self.gridLayout_4.addWidget(self.Announcement, 2, 0, 1, 1)
- self.lineEditAnn = QtWidgets.QLineEdit(self.SpeakerOutputBox)
- self.lineEditAnn.setText("")
- self.lineEditAnn.setObjectName("lineEditAnn")
- self.gridLayout_4.addWidget(self.lineEditAnn, 2, 1, 1, 1)
- self.CurrentOutput = QtWidgets.QLabel(self.SpeakerOutputBox)
- self.CurrentOutput.setObjectName("CurrentOutput")
- self.gridLayout_4.addWidget(self.CurrentOutput, 3, 0, 1, 1)
- self.CurrentStation = QtWidgets.QLabel(self.SpeakerOutputBox)
- self.CurrentStation.setObjectName("CurrentStation")
- self.gridLayout_4.addWidget(self.CurrentStation, 1, 0, 1, 1)
- self.SpeakerOuputs = QtWidgets.QLabel(self.SpeakerOutputBox)
- font = QtGui.QFont()
- font.setPointSize(20)
- self.SpeakerOuputs.setFont(font)
- self.SpeakerOuputs.setAlignment(QtCore.Qt.AlignCenter)
- self.SpeakerOuputs.setObjectName("SpeakerOuputs")
- self.gridLayout_4.addWidget(self.SpeakerOuputs, 0, 0, 1, 2)
- self.CurStatOut = QtWidgets.QLabel(self.SpeakerOutputBox)
- self.CurStatOut.setAlignment(QtCore.Qt.AlignCenter)
- self.CurStatOut.setObjectName("CurStatOut")
- self.gridLayout_4.addWidget(self.CurStatOut, 1, 1, 1, 1)
- self.SpkrOut = QtWidgets.QLabel(self.SpeakerOutputBox)
- self.SpkrOut.setText("")
- self.SpkrOut.setObjectName("SpkrOut")
- self.gridLayout_4.addWidget(self.SpkrOut, 3, 1, 1, 1)
- self.gridLayout_2.addWidget(self.SpeakerOutputBox, 1, 3, 1, 1)
- self.Train_Select_Box = QtWidgets.QGroupBox(self.centralwidget)
- self.Train_Select_Box.setMaximumSize(QtCore.QSize(400, 16777215))
- self.Train_Select_Box.setStyleSheet("background-color: rgb(233, 247, 255);")
- self.Train_Select_Box.setTitle("")
- self.Train_Select_Box.setObjectName("Train_Select_Box")
- self.formLayout = QtWidgets.QFormLayout(self.Train_Select_Box)
- self.formLayout.setObjectName("formLayout")
- self.Train_Select = QtWidgets.QLabel(self.Train_Select_Box)
- self.Train_Select.setObjectName("Train_Select")
- self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.Train_Select)
- self.trainSel = QtWidgets.QComboBox(self.Train_Select_Box)
- self.trainSel.setObjectName("trainSel")
- self.trainSel.addItem("")
- self.trainSel.addItem("")
- self.trainSel.addItem("")
- self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.trainSel)
- self.gridLayout_2.addWidget(self.Train_Select_Box, 1, 0, 1, 1)
- self.groupBox_8 = QtWidgets.QGroupBox(self.centralwidget)
- self.groupBox_8.setStyleSheet("background-color: rgb(233, 247, 255);")
- self.groupBox_8.setTitle("")
- self.groupBox_8.setObjectName("groupBox_8")
- self.gridLayout_5 = QtWidgets.QGridLayout(self.groupBox_8)
- self.gridLayout_5.setObjectName("gridLayout_5")
- self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
- self.horizontalLayout_5.setObjectName("horizontalLayout_5")
- self.Speed_Limit = QtWidgets.QLabel(self.groupBox_8)
- font = QtGui.QFont()
- font.setPointSize(20)
- self.Speed_Limit.setFont(font)
- self.Speed_Limit.setAlignment(QtCore.Qt.AlignCenter)
- self.Speed_Limit.setObjectName("Speed_Limit")
- self.horizontalLayout_5.addWidget(self.Speed_Limit)
- self.Current_Speed = QtWidgets.QLabel(self.groupBox_8)
- font = QtGui.QFont()
- font.setPointSize(20)
- self.Current_Speed.setFont(font)
- self.Current_Speed.setAlignment(QtCore.Qt.AlignCenter)
- self.Current_Speed.setObjectName("Current_Speed")
- self.horizontalLayout_5.addWidget(self.Current_Speed)
- self.Commanded_Speed = QtWidgets.QLabel(self.groupBox_8)
- font = QtGui.QFont()
- font.setPointSize(20)
- self.Commanded_Speed.setFont(font)
- self.Commanded_Speed.setAlignment(QtCore.Qt.AlignCenter)
- self.Commanded_Speed.setObjectName("Commanded_Speed")
- self.horizontalLayout_5.addWidget(self.Commanded_Speed)
- self.gridLayout_5.addLayout(self.horizontalLayout_5, 0, 0, 1, 1)
- self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
- self.horizontalLayout_6.setObjectName("horizontalLayout_6")
- self.lcdSpdLim = QtWidgets.QLCDNumber(self.groupBox_8)
- self.lcdSpdLim.setDigitCount(2)
- self.lcdSpdLim.setObjectName("lcdSpdLim")
- self.horizontalLayout_6.addWidget(self.lcdSpdLim)
- self.lcdCurSpd_2 = QtWidgets.QLCDNumber(self.groupBox_8)
- self.lcdCurSpd_2.setDigitCount(2)
- self.lcdCurSpd_2.setObjectName("lcdCurSpd_2")
- self.horizontalLayout_6.addWidget(self.lcdCurSpd_2)
- self.lcdCmdSpd = QtWidgets.QLCDNumber(self.groupBox_8)
- self.lcdCmdSpd.setDigitCount(2)
- self.lcdCmdSpd.setObjectName("lcdCmdSpd")
- self.horizontalLayout_6.addWidget(self.lcdCmdSpd)
- self.gridLayout_5.addLayout(self.horizontalLayout_6, 1, 0, 1, 1)
- self.gridLayout_2.addWidget(self.groupBox_8, 4, 0, 1, 4)
- self.groupBox_3 = QtWidgets.QGroupBox(self.centralwidget)
- font = QtGui.QFont()
- font.setPointSize(20)
- self.groupBox_3.setFont(font)
- self.groupBox_3.setStyleSheet("background-color: rgb(233, 247, 255);")
- self.groupBox_3.setAlignment(QtCore.Qt.AlignCenter)
- self.groupBox_3.setObjectName("groupBox_3")
- self.gridLayout_3 = QtWidgets.QGridLayout(self.groupBox_3)
- self.gridLayout_3.setObjectName("gridLayout_3")
- self.lcdKi = QtWidgets.QLCDNumber(self.groupBox_3)
- self.lcdKi.setFrameShape(QtWidgets.QFrame.Box)
- self.lcdKi.setSmallDecimalPoint(True)
- self.lcdKi.setDigitCount(4)
- self.lcdKi.setObjectName("lcdKi")
- self.gridLayout_3.addWidget(self.lcdKi, 0, 0, 1, 1)
- self.lcdKp = QtWidgets.QLCDNumber(self.groupBox_3)
- self.lcdKp.setSmallDecimalPoint(True)
- self.lcdKp.setDigitCount(4)
- self.lcdKp.setObjectName("lcdKp")
- self.gridLayout_3.addWidget(self.lcdKp, 0, 1, 1, 1)
- self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
- self.horizontalLayout_4.setObjectName("horizontalLayout_4")
- self.label_4 = QtWidgets.QLabel(self.groupBox_3)
- self.label_4.setAlignment(QtCore.Qt.AlignCenter)
- self.label_4.setObjectName("label_4")
- self.horizontalLayout_4.addWidget(self.label_4)
- self.inputKp = QtWidgets.QDoubleSpinBox(self.groupBox_3)
- self.inputKp.setObjectName("inputKp")
- self.horizontalLayout_4.addWidget(self.inputKp)
- self.gridLayout_3.addLayout(self.horizontalLayout_4, 2, 1, 1, 1)
- self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
- self.horizontalLayout_3.setObjectName("horizontalLayout_3")
- self.label_3 = QtWidgets.QLabel(self.groupBox_3)
- self.label_3.setAlignment(QtCore.Qt.AlignCenter)
- self.label_3.setObjectName("label_3")
- self.horizontalLayout_3.addWidget(self.label_3)
- self.inputKi = QtWidgets.QDoubleSpinBox(self.groupBox_3)
- self.inputKi.setObjectName("inputKi")
- self.horizontalLayout_3.addWidget(self.inputKi)
- self.gridLayout_3.addLayout(self.horizontalLayout_3, 2, 0, 1, 1)
- self.gridLayout_2.addWidget(self.groupBox_3, 0, 1, 1, 2)
- self.CabinConditionsBox = QtWidgets.QGroupBox(self.centralwidget)
- self.CabinConditionsBox.setMaximumSize(QtCore.QSize(400, 16777215))
- font = QtGui.QFont()
- font.setPointSize(20)
- self.CabinConditionsBox.setFont(font)
- self.CabinConditionsBox.setStyleSheet("background-color: rgb(233, 247, 255);")
- self.CabinConditionsBox.setAlignment(QtCore.Qt.AlignCenter)
- self.CabinConditionsBox.setObjectName("CabinConditionsBox")
- self.gridLayout = QtWidgets.QGridLayout(self.CabinConditionsBox)
- self.gridLayout.setObjectName("gridLayout")
- self.label_14 = QtWidgets.QLabel(self.CabinConditionsBox)
- self.label_14.setObjectName("label_14")
- self.gridLayout.addWidget(self.label_14, 3, 0, 1, 1)
- self.buttonHDon = QtWidgets.QPushButton(self.CabinConditionsBox)
- self.buttonHDon.setCheckable(True)
- self.buttonHDon.setObjectName("buttonHDon")
- self.gridLayout.addWidget(self.buttonHDon, 0, 1, 1, 2)
- self.temp = QtWidgets.QSpinBox(self.CabinConditionsBox)
- self.temp.setProperty("value", 65)
- self.temp.setObjectName("temp")
- self.gridLayout.addWidget(self.temp, 3, 1, 1, 1)
- self.IntLights = QtWidgets.QLabel(self.CabinConditionsBox)
- self.IntLights.setObjectName("IntLights")
- self.gridLayout.addWidget(self.IntLights, 1, 0, 1, 1)
- self.buttonDoorL = QtWidgets.QPushButton(self.CabinConditionsBox)
- self.buttonDoorL.setCheckable(True)
- self.buttonDoorL.setObjectName("buttonDoorL")
- self.gridLayout.addWidget(self.buttonDoorL, 2, 1, 1, 2)
- self.label = QtWidgets.QLabel(self.CabinConditionsBox)
- self.label.setObjectName("label")
- self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
- self.buttonHDoff = QtWidgets.QPushButton(self.CabinConditionsBox)
- self.buttonHDoff.setCheckable(True)
- self.buttonHDoff.setObjectName("buttonHDoff")
- self.gridLayout.addWidget(self.buttonHDoff, 0, 3, 1, 2)
- self.buttonDoorR = QtWidgets.QPushButton(self.CabinConditionsBox)
- self.buttonDoorR.setCheckable(True)
- self.buttonDoorR.setObjectName("buttonDoorR")
- self.gridLayout.addWidget(self.buttonDoorR, 2, 3, 1, 2)
- self.label_13 = QtWidgets.QLabel(self.CabinConditionsBox)
- self.label_13.setObjectName("label_13")
- self.gridLayout.addWidget(self.label_13, 2, 0, 1, 1)
- self.IntLightSld = QtWidgets.QSlider(self.CabinConditionsBox)
- self.IntLightSld.setOrientation(QtCore.Qt.Horizontal)
- self.IntLightSld.setObjectName("IntLightSld")
- self.gridLayout.addWidget(self.IntLightSld, 1, 1, 1, 4)
- self.gridLayout_2.addWidget(self.CabinConditionsBox, 0, 3, 1, 1)
- MainWindow.setCentralWidget(self.centralwidget)
- self.statusbar = QtWidgets.QStatusBar(MainWindow)
- self.statusbar.setObjectName("statusbar")
- MainWindow.setStatusBar(self.statusbar)
-
- self.retranslateUi(MainWindow)
- self.buttonMan.clicked['bool'].connect(self.buttonAuto.toggle) # type: ignore
- self.buttonAuto.clicked['bool'].connect(self.buttonMan.toggle) # type: ignore
- self.inputKi.valueChanged['double'].connect(self.lcdKi.display) # type: ignore
- self.inputKp.valueChanged['double'].connect(self.lcdKp.display) # type: ignore
- self.buttonHDon.clicked['bool'].connect(self.buttonHDoff.toggle) # type: ignore
- self.buttonHDoff.clicked['bool'].connect(self.buttonHDon.toggle) # type: ignore
- self.lineEditAnn.textChanged['QString'].connect(self.SpkrOut.setText) # type: ignore
- QtCore.QMetaObject.connectSlotsByName(MainWindow)
-
- def retranslateUi(self, MainWindow):
- _translate = QtCore.QCoreApplication.translate
- MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
- self.label_10.setText(_translate("MainWindow", "Brake"))
- self.groupBox_2.setTitle(_translate("MainWindow", "POWER"))
- self.label_20.setText(_translate("MainWindow", "FAILURES"))
- self.PwrFail.setText(_translate("MainWindow", "Power Failure"))
- self.SigFail.setText(_translate("MainWindow", "Signal Failure"))
- self.BrkFail.setText(_translate("MainWindow", "Brake Failure"))
- self.label_11.setText(_translate("MainWindow", "Accelerate"))
- self.DistanceTillStop.setText(_translate("MainWindow", "Distance Till Stop"))
- self.Mode_Box.setTitle(_translate("MainWindow", "Mode"))
- self.buttonMan.setText(_translate("MainWindow", "Manual"))
- self.buttonAuto.setText(_translate("MainWindow", "Auto"))
- self.Ebrake.setText(_translate("MainWindow", "Emergency Brake"))
- self.Announcement.setText(_translate("MainWindow", "Annoucement :"))
- self.lineEditAnn.setPlaceholderText(_translate("MainWindow", "Annoucement"))
- self.CurrentOutput.setText(_translate("MainWindow", "Current Output : "))
- self.CurrentStation.setText(_translate("MainWindow", "Current Station : "))
- self.SpeakerOuputs.setText(_translate("MainWindow", "Speaker Outputs"))
- self.CurStatOut.setText(_translate("MainWindow", "Yard"))
- self.Train_Select.setText(_translate("MainWindow", "Train Select"))
- self.trainSel.setItemText(0, _translate("MainWindow", "Train 1"))
- self.trainSel.setItemText(1, _translate("MainWindow", "Train 2"))
- self.trainSel.setItemText(2, _translate("MainWindow", "Train 3"))
- self.Speed_Limit.setText(_translate("MainWindow", "Speed Limit"))
- self.Current_Speed.setText(_translate("MainWindow", "Current Speed"))
- self.Commanded_Speed.setText(_translate("MainWindow", "Commanded Speed"))
- self.groupBox_3.setTitle(_translate("MainWindow", "Power"))
- self.label_4.setText(_translate("MainWindow", "Kp"))
- self.label_3.setText(_translate("MainWindow", "Ki"))
- self.CabinConditionsBox.setTitle(_translate("MainWindow", "Cabin Conditions"))
- self.label_14.setText(_translate("MainWindow", "Cabin Temp"))
- self.buttonHDon.setText(_translate("MainWindow", "On"))
- self.IntLights.setText(_translate("MainWindow", "Int Litghs"))
- self.buttonDoorL.setText(_translate("MainWindow", "Left"))
- self.label.setText(_translate("MainWindow", "HeadLights"))
- self.buttonHDoff.setText(_translate("MainWindow", "Off"))
- self.buttonDoorR.setText(_translate("MainWindow", "Right"))
- self.label_13.setText(_translate("MainWindow", "Doors"))
diff --git a/Train Controller SW/Failure.py b/Train Controller SW/Failure.py
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/Train Controller SW/Failure.py
@@ -0,0 +1 @@
+
diff --git a/Train Controller HW/TestBench.py b/Train Controller SW/TestBench.py
similarity index 95%
rename from Train Controller HW/TestBench.py
rename to Train Controller SW/TestBench.py
index 8fc105de..391c84fc 100644
--- a/Train Controller HW/TestBench.py
+++ b/Train Controller SW/TestBench.py
@@ -23,26 +23,19 @@ def set_headlights(self):
self.ui.buttonHDoff.toggle()
def set_power_failure(self):
if(not(self.PowerFailure.isChecked())):
- self.ui.PwrFail.setStyleSheet("color: rgb(225, 225, 225);\n"
-"background-color: rgb(255, 255, 255);")
-
+ self.ui.Power_Failure_Disable()
else:
- self.ui.PwrFail.setStyleSheet("color: red;\n"
-"background-color: rgb(255, 255, 255);")
+ self.ui.Power_Failure_Enable()
def set_brake_failure(self):
if(not(self.BrakeFailure.isChecked())):
- self.ui.BrkFail.setStyleSheet("color: rgb(225, 225, 225);\n"
-"background-color: rgb(255, 255, 255);")
+ self.ui.Brake_Failure_Disable()
else:
- self.ui.BrkFail.setStyleSheet("color: red;\n"
-"background-color: rgb(255, 255, 255);")
+ self.ui.Brake_Failure_Enable()
def set_signal_failure(self):
if(not(self.SignalFailure.isChecked())):
- self.ui.SigFail.setStyleSheet("color: rgb(225, 225, 225);\n"
-"background-color: rgb(255, 255, 255);")
+ self.ui.Signal_Failure_Disable()
else:
- self.ui.SigFail.setStyleSheet("color: red;\n"
-"background-color: rgb(255, 255, 255);")
+ self.ui.Signal_Failure_Enable()
def set_interior_lights(self):
if self.CabinLights.value() == 2:
@@ -77,8 +70,11 @@ def set_speed_limit(self):
self.ui.lcdSpdLim.display(value)
def set_current_speed(self):
- value = int(self.CurSpeed.value())
- self.ui.lcdCurSpd_2.display(value)
+ # in future iterations, move this to the UI function
+ if (self.ui.lcdAuth.value() == 0):
+ self.ui.lcdCurSpd.display(0)
+ else:
+ self.ui.lcdCurSpd.display(self.CurSpeed.value())
def set_authority(self):
value = int(self.Authority.value())
@@ -120,6 +116,7 @@ def setupUi(self, TestBench):
self.label_7.setObjectName("label_7")
self.formLayout.setWidget(10, QtWidgets.QFormLayout.LabelRole, self.label_7)
self.Authority = QtWidgets.QDoubleSpinBox(self.centralwidget)
+ self.Authority.setRange(0,9999)
self.Authority.setObjectName("Authority")
self.Authority.editingFinished.connect( lambda : self.set_authority())
self.formLayout.setWidget(10, QtWidgets.QFormLayout.FieldRole, self.Authority)
@@ -247,11 +244,12 @@ def setupUi(self, TestBench):
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
self.Auto = QtWidgets.QPushButton(self.centralwidget, clicked = lambda : self.set_automatic_manual())
self.Auto.setCheckable(True)
- self.Auto.setChecked(True)
+ self.Auto.setChecked(False)
self.Auto.setObjectName("Auto")
self.horizontalLayout_5.addWidget(self.Auto)
self.Manual = QtWidgets.QPushButton(self.centralwidget, clicked = lambda : self.set_automatic_manual())
self.Manual.setCheckable(True)
+ self.Manual.setChecked(True)
self.Manual.setObjectName("Manual")
self.horizontalLayout_5.addWidget(self.Manual)
self.formLayout.setLayout(21, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_5)
@@ -333,6 +331,11 @@ def retranslateUi(self, TestBench):
self.Auto.setText(_translate("TestBench", "Auto"))
self.Manual.setText(_translate("TestBench", "Manual"))
+ self.Authority.valueChanged.connect(lambda : self.Trigger_Authoirty_Countdown())
+ self.CurSpeed.valueChanged.connect(lambda : self.ui.calSpeed())
+
+ def Trigger_Authoirty_Countdown(self):
+ self.ui.calcAuth()
def Open_Main_UI(self):
self.window = QtWidgets.QMainWindow()
self.ui = Ui_MainWindow()
diff --git a/Train Controller HW/main.ui b/Train Controller SW/main.ui
similarity index 96%
rename from Train Controller HW/main.ui
rename to Train Controller SW/main.ui
index 96165d12..7060f4e0 100644
--- a/Train Controller HW/main.ui
+++ b/Train Controller SW/main.ui
@@ -1,1023 +1,1023 @@
-
-
- MainWindow
-
-
-
- 0
- 0
- 1146
- 857
-
-
-
- PointingHandCursor
-
-
- MainWindow
-
-
- Qt::LeftToRight
-
-
- alternate-background-color: rgb(255, 143, 148);
-
-
- QTabWidget::Rounded
-
-
-
- -
-
-
-
- 525
- 0
-
-
-
- background-color: rgb(233, 247, 255);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 20
-
-
-
- Brake
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- 3
-
-
-
- -
-
-
-
- 10
- 5
-
-
-
-
- 16777215
- 200
-
-
-
- Qt::Vertical
-
-
-
-
-
- -
-
-
-
-
-
-
- 300
- 16777215
-
-
-
-
- 20
-
-
-
- selection-color: rgb(255, 14, 30);
-
-
- POWER
-
-
- Qt::AlignCenter
-
-
-
-
-
-
- -
-
-
-
- 20
-
-
-
- FAILURES
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 25
-
-
-
- color: rgb(225, 225, 225);
-background-color: rgb(255, 255, 255);
-
-
- Power
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 25
-
-
-
- color: rgb(225, 225, 225);
-background-color: rgb(255, 255, 255);
-
-
- Brake
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 25
-
-
-
- color: rgb(225, 225, 225);
-background-color: rgb(255, 255, 255);
-
-
- Signal
-
-
- Qt::AlignCenter
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
- 20
-
-
-
- Accelerate
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 16777215
- 400
-
-
-
- QFrame::Box
-
-
- false
-
-
- 3
-
-
-
- -
-
-
-
- 10
- 10
-
-
-
-
- 16777215
- 200
-
-
-
- Qt::Vertical
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
- 400
- 16777215
-
-
-
- background-color: rgb(233, 247, 255);
-
-
-
-
-
-
-
-
-
-
- 20
-
-
-
- Train Select
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- Qt::Vertical
-
-
- QSizePolicy::Fixed
-
-
-
- 20
- 30
-
-
-
-
- -
-
-
-
- 10
- 10
-
-
-
-
- 500
- 45
-
-
-
- background-color: rgb(255, 255, 255);
-
-
-
- 4
- 4
-
-
-
-
-
- Train 1
-
-
- -
-
- Train 2
-
-
- -
-
- Train 3
-
-
-
-
-
-
-
- -
-
-
-
- 25
-
-
-
- false
-
-
- background-color: rgb(255, 55, 62);
-selection-background-color: rgb(255, 52, 53);
-selection-color: rgb(255, 159, 154);
-
-
- Emergency Brake
-
-
- true
-
-
- false
-
-
- false
-
-
- false
-
-
-
- -
-
-
-
- 400
- 16777215
-
-
-
-
- 20
-
-
-
- background-color: rgb(233, 247, 255);
-
-
- Cabin Conditions
-
-
- Qt::AlignCenter
-
-
-
-
-
-
- Right
-
-
- true
-
-
-
- -
-
-
- Doors
-
-
-
- -
-
-
- Int Litghs
-
-
-
- -
-
-
- 65
-
-
-
- -
-
-
- On
-
-
- true
-
-
- true
-
-
- false
-
-
-
- -
-
-
- Left
-
-
- true
-
-
-
- -
-
-
- Off
-
-
- true
-
-
-
- -
-
-
- HeadLights
-
-
-
- -
-
-
- Cabin Temp
-
-
-
- -
-
-
- 2
-
-
- 1
-
-
- 2
-
-
- 0
-
-
- false
-
-
- Qt::Horizontal
-
-
- QSlider::TicksBothSides
-
-
- 1
-
-
-
-
-
-
- -
-
-
-
- 400
- 16777215
-
-
-
-
- 11
-
-
-
- background-color: rgb(233, 247, 255);
-
-
-
-
-
- Qt::AlignCenter
-
-
-
-
-
-
- Annoucement :
-
-
-
- -
-
-
-
-
-
- Annoucement
-
-
-
- -
-
-
- Current Output :
-
-
-
- -
-
-
- Current Station :
-
-
-
- -
-
-
-
- 20
-
-
-
- Speaker Outputs
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- Yard
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
-
-
-
-
-
-
- -
-
-
- background-color: rgb(233, 247, 255);
-
-
-
-
-
-
-
-
-
-
- 20
-
-
-
- Distance Till Stop
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- QFrame::Box
-
-
-
-
-
-
- -
-
-
-
- 400
- 16777215
-
-
-
-
- 20
-
-
-
- background-color: rgb(233, 247, 255);
-
-
- Mode
-
-
- Qt::AlignCenter
-
-
-
-
-
-
- Manual
-
-
- true
-
-
- false
-
-
-
- -
-
-
- Auto
-
-
- true
-
-
- true
-
-
-
-
-
-
- -
-
-
- background-color: rgb(233, 247, 255);
-
-
-
-
-
-
-
-
-
-
-
-
-
- 20
-
-
-
- Speed Limit
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 20
-
-
-
- Commanded Speed
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
- 20
-
-
-
- Current Speed
-
-
- Qt::AlignCenter
-
-
-
-
-
- -
-
-
-
-
-
- 2
-
-
-
- -
-
-
- 2
-
-
-
- -
-
-
- 2
-
-
-
-
-
-
-
-
- -
-
-
-
- 20
-
-
-
- background-color: rgb(233, 247, 255);
-
-
- Power
-
-
- Qt::AlignCenter
-
-
-
-
-
-
- QFrame::Box
-
-
- true
-
-
- 4
-
-
-
- -
-
-
- true
-
-
- 4
-
-
-
- -
-
-
-
-
-
- Kp
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
-
- -
-
-
-
-
-
- Ki
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- buttonMan
- clicked(bool)
- buttonAuto
- toggle()
-
-
- 64
- 97
-
-
- 154
- 97
-
-
-
-
- buttonAuto
- clicked(bool)
- buttonMan
- toggle()
-
-
- 154
- 97
-
-
- 64
- 97
-
-
-
-
- inputKi
- valueChanged(double)
- lcdKi
- display(double)
-
-
- 421
- 130
-
-
- 359
- 64
-
-
-
-
- inputKp
- valueChanged(double)
- lcdKp
- display(double)
-
-
- 673
- 130
-
-
- 611
- 64
-
-
-
-
- buttonHDon
- clicked(bool)
- buttonHDoff
- toggle()
-
-
- 919
- 45
-
-
- 1060
- 45
-
-
-
-
- buttonHDoff
- clicked(bool)
- buttonHDon
- toggle()
-
-
- 1060
- 45
-
-
- 919
- 45
-
-
-
-
- lineEditAnn
- textChanged(QString)
- SpkrOut
- setText(QString)
-
-
- 1009
- 425
-
-
- 1009
- 517
-
-
-
-
- CurStatOut
- windowIconTextChanged(QString)
- SpkrOut
- setText(QString)
-
-
- 957
- 283
-
-
- 957
- 356
-
-
-
-
- vertSliderBrk
- sliderMoved(int)
- lcdBrk
- display(int)
-
-
- 316
- 465
-
-
- 316
- 325
-
-
-
-
- vertSliderPow
- sliderMoved(int)
- lcdPow_2
- display(int)
-
-
- 651
- 465
-
-
- 651
- 325
-
-
-
-
-
- modeToggle()
-
-
+
+
+ MainWindow
+
+
+
+ 0
+ 0
+ 1146
+ 857
+
+
+
+ PointingHandCursor
+
+
+ MainWindow
+
+
+ Qt::LeftToRight
+
+
+ alternate-background-color: rgb(255, 143, 148);
+
+
+ QTabWidget::Rounded
+
+
+
+ -
+
+
+
+ 525
+ 0
+
+
+
+ background-color: rgb(233, 247, 255);
+
+
+
+
+
+
-
+
+
-
+
+
-
+
+
+
+ 20
+
+
+
+ Brake
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ 3
+
+
+
+ -
+
+
+
+ 10
+ 5
+
+
+
+
+ 16777215
+ 200
+
+
+
+ Qt::Vertical
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 300
+ 16777215
+
+
+
+
+ 20
+
+
+
+ selection-color: rgb(255, 14, 30);
+
+
+ POWER
+
+
+ Qt::AlignCenter
+
+
+
-
+
+
+ -
+
+
+
+ 20
+
+
+
+ FAILURES
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 25
+
+
+
+ color: rgb(225, 225, 225);
+background-color: rgb(255, 255, 255);
+
+
+ Power
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 25
+
+
+
+ color: rgb(225, 225, 225);
+background-color: rgb(255, 255, 255);
+
+
+ Brake
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 25
+
+
+
+ color: rgb(225, 225, 225);
+background-color: rgb(255, 255, 255);
+
+
+ Signal
+
+
+ Qt::AlignCenter
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 20
+
+
+
+ Accelerate
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 16777215
+ 400
+
+
+
+ QFrame::Box
+
+
+ false
+
+
+ 3
+
+
+
+ -
+
+
+
+ 10
+ 10
+
+
+
+
+ 16777215
+ 200
+
+
+
+ Qt::Vertical
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+ 400
+ 16777215
+
+
+
+ background-color: rgb(233, 247, 255);
+
+
+
+
+
+
-
+
+
+
+ 20
+
+
+
+ Train Select
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+ QSizePolicy::Fixed
+
+
+
+ 20
+ 30
+
+
+
+
+ -
+
+
+
+ 10
+ 10
+
+
+
+
+ 500
+ 45
+
+
+
+ background-color: rgb(255, 255, 255);
+
+
+
+ 4
+ 4
+
+
+
-
+
+ Train 1
+
+
+ -
+
+ Train 2
+
+
+ -
+
+ Train 3
+
+
+
+
+
+
+
+ -
+
+
+
+ 25
+
+
+
+ false
+
+
+ background-color: rgb(255, 55, 62);
+selection-background-color: rgb(255, 52, 53);
+selection-color: rgb(255, 159, 154);
+
+
+ Emergency Brake
+
+
+ true
+
+
+ false
+
+
+ false
+
+
+ false
+
+
+
+ -
+
+
+
+ 400
+ 16777215
+
+
+
+
+ 20
+
+
+
+ background-color: rgb(233, 247, 255);
+
+
+ Cabin Conditions
+
+
+ Qt::AlignCenter
+
+
+
-
+
+
+ Right
+
+
+ true
+
+
+
+ -
+
+
+ Doors
+
+
+
+ -
+
+
+ Int Litghs
+
+
+
+ -
+
+
+ 65
+
+
+
+ -
+
+
+ On
+
+
+ true
+
+
+ true
+
+
+ false
+
+
+
+ -
+
+
+ Left
+
+
+ true
+
+
+
+ -
+
+
+ Off
+
+
+ true
+
+
+
+ -
+
+
+ HeadLights
+
+
+
+ -
+
+
+ Cabin Temp
+
+
+
+ -
+
+
+ 2
+
+
+ 1
+
+
+ 2
+
+
+ 0
+
+
+ false
+
+
+ Qt::Horizontal
+
+
+ QSlider::TicksBothSides
+
+
+ 1
+
+
+
+
+
+
+ -
+
+
+
+ 400
+ 16777215
+
+
+
+
+ 11
+
+
+
+ background-color: rgb(233, 247, 255);
+
+
+
+
+
+ Qt::AlignCenter
+
+
+
-
+
+
+ Annoucement :
+
+
+
+ -
+
+
+
+
+
+ Annoucement
+
+
+
+ -
+
+
+ Current Output :
+
+
+
+ -
+
+
+ Current Station :
+
+
+
+ -
+
+
+
+ 20
+
+
+
+ Speaker Outputs
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Yard
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+ -
+
+
+ background-color: rgb(233, 247, 255);
+
+
+
+
+
+
-
+
+
+
+ 20
+
+
+
+ Distance Till Stop
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ QFrame::Box
+
+
+
+
+
+
+ -
+
+
+
+ 400
+ 16777215
+
+
+
+
+ 20
+
+
+
+ background-color: rgb(233, 247, 255);
+
+
+ Mode
+
+
+ Qt::AlignCenter
+
+
+
-
+
+
+ Manual
+
+
+ true
+
+
+ false
+
+
+
+ -
+
+
+ Auto
+
+
+ true
+
+
+ true
+
+
+
+
+
+
+ -
+
+
+ background-color: rgb(233, 247, 255);
+
+
+
+
+
+
-
+
+
-
+
+
+
+ 20
+
+
+
+ Speed Limit
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 20
+
+
+
+ Commanded Speed
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 20
+
+
+
+ Current Speed
+
+
+ Qt::AlignCenter
+
+
+
+
+
+ -
+
+
-
+
+
+ 2
+
+
+
+ -
+
+
+ 2
+
+
+
+ -
+
+
+ 2
+
+
+
+
+
+
+
+
+ -
+
+
+
+ 20
+
+
+
+ background-color: rgb(233, 247, 255);
+
+
+ Power
+
+
+ Qt::AlignCenter
+
+
+
-
+
+
+ QFrame::Box
+
+
+ true
+
+
+ 4
+
+
+
+ -
+
+
+ true
+
+
+ 4
+
+
+
+ -
+
+
-
+
+
+ Kp
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+
+ -
+
+
-
+
+
+ Ki
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ buttonMan
+ clicked(bool)
+ buttonAuto
+ toggle()
+
+
+ 64
+ 97
+
+
+ 154
+ 97
+
+
+
+
+ buttonAuto
+ clicked(bool)
+ buttonMan
+ toggle()
+
+
+ 154
+ 97
+
+
+ 64
+ 97
+
+
+
+
+ inputKi
+ valueChanged(double)
+ lcdKi
+ display(double)
+
+
+ 421
+ 130
+
+
+ 359
+ 64
+
+
+
+
+ inputKp
+ valueChanged(double)
+ lcdKp
+ display(double)
+
+
+ 673
+ 130
+
+
+ 611
+ 64
+
+
+
+
+ buttonHDon
+ clicked(bool)
+ buttonHDoff
+ toggle()
+
+
+ 919
+ 45
+
+
+ 1060
+ 45
+
+
+
+
+ buttonHDoff
+ clicked(bool)
+ buttonHDon
+ toggle()
+
+
+ 1060
+ 45
+
+
+ 919
+ 45
+
+
+
+
+ lineEditAnn
+ textChanged(QString)
+ SpkrOut
+ setText(QString)
+
+
+ 1009
+ 425
+
+
+ 1009
+ 517
+
+
+
+
+ CurStatOut
+ windowIconTextChanged(QString)
+ SpkrOut
+ setText(QString)
+
+
+ 957
+ 283
+
+
+ 957
+ 356
+
+
+
+
+ vertSliderBrk
+ sliderMoved(int)
+ lcdBrk
+ display(int)
+
+
+ 316
+ 465
+
+
+ 316
+ 325
+
+
+
+
+ vertSliderPow
+ sliderMoved(int)
+ lcdPow_2
+ display(int)
+
+
+ 651
+ 465
+
+
+ 651
+ 325
+
+
+
+
+
+ modeToggle()
+
+
diff --git a/Train Controller HW/mainControl.py b/Train Controller SW/mainControl.py
similarity index 75%
rename from Train Controller HW/mainControl.py
rename to Train Controller SW/mainControl.py
index 080dfa01..ac035b97 100644
--- a/Train Controller HW/mainControl.py
+++ b/Train Controller SW/mainControl.py
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
+from math import ceil
# Form implementation generated from reading ui file 'main.ui'
#
@@ -16,8 +17,11 @@ class Ui_MainWindow(object):
def __init__(self):
+ #internal power calculation
self.power = 0
+
self.lastSliderMoved = None
+
self.Ki = 0
self.Kp = 0
self.integral_error = 0
@@ -29,7 +33,6 @@ def __init__(self):
self.dt = 0.1
self.control_output = 0
-
self.tempTimer = QTimer()
self.tempTimer.setInterval(1000)
self.tempTimer.timeout.connect(self.updateTemperature)
@@ -42,9 +45,6 @@ def __init__(self):
self.speedTimer.setInterval(1000)
self.speedTimer.timeout.connect(self.speedControl)
-
-
-
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1146, 857)
@@ -74,10 +74,14 @@ def setupUi(self, MainWindow):
self.label_10.setAlignment(QtCore.Qt.AlignCenter)
self.label_10.setObjectName("label_10")
self.verticalLayout_2.addWidget(self.label_10)
+
+
+ ### BRAKE OUTPUT
self.lcdBrk = QtWidgets.QLCDNumber(self.BrkAcelBox)
self.lcdBrk.setDigitCount(3)
self.lcdBrk.setObjectName("lcdBrk")
self.verticalLayout_2.addWidget(self.lcdBrk)
+ ### BRAKE INPUT
self.vertSliderBrk = QtWidgets.QSlider(self.BrkAcelBox)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(10)
@@ -87,8 +91,9 @@ def setupUi(self, MainWindow):
self.vertSliderBrk.setMaximumSize(QtCore.QSize(16777215, 200))
self.vertSliderBrk.setOrientation(QtCore.Qt.Vertical)
self.vertSliderBrk.setObjectName("vertSliderBrk")
- self.vertSliderBrk.setMaximum(100)
+ self.vertSliderBrk.setMaximum(1)
self.verticalLayout_2.addWidget(self.vertSliderBrk)
+
self.horizontalLayout.addLayout(self.verticalLayout_2)
self.verticalLayout_5 = QtWidgets.QVBoxLayout()
self.verticalLayout_5.setObjectName("verticalLayout_5")
@@ -102,6 +107,8 @@ def setupUi(self, MainWindow):
self.groupBox_2.setObjectName("groupBox_2")
self.verticalLayout = QtWidgets.QVBoxLayout(self.groupBox_2)
self.verticalLayout.setObjectName("verticalLayout")
+
+ #### ACCELERATION PERCENT OUT
self.lcdPwrOut = QtWidgets.QLCDNumber(self.groupBox_2)
self.lcdPwrOut.setObjectName("lcdPwrOut")
self.verticalLayout.addWidget(self.lcdPwrOut)
@@ -112,6 +119,8 @@ def setupUi(self, MainWindow):
self.label_20.setAlignment(QtCore.Qt.AlignCenter)
self.label_20.setObjectName("label_20")
self.verticalLayout.addWidget(self.label_20)
+
+ ## POWER FAILURE INDICATOR
self.PwrFail = QtWidgets.QLabel(self.groupBox_2)
font = QtGui.QFont()
font.setPointSize(25)
@@ -121,6 +130,8 @@ def setupUi(self, MainWindow):
self.PwrFail.setAlignment(QtCore.Qt.AlignCenter)
self.PwrFail.setObjectName("PwrFail")
self.verticalLayout.addWidget(self.PwrFail)
+
+ ####BRAKE FAILURE INDICATION
self.BrkFail = QtWidgets.QLabel(self.groupBox_2)
font = QtGui.QFont()
font.setPointSize(25)
@@ -130,6 +141,8 @@ def setupUi(self, MainWindow):
self.BrkFail.setAlignment(QtCore.Qt.AlignCenter)
self.BrkFail.setObjectName("BrkFail")
self.verticalLayout.addWidget(self.BrkFail)
+
+ ###SIGNAL FAILURE INDICATOR
self.SigFail = QtWidgets.QLabel(self.groupBox_2)
font = QtGui.QFont()
font.setPointSize(25)
@@ -139,6 +152,7 @@ def setupUi(self, MainWindow):
self.SigFail.setAlignment(QtCore.Qt.AlignCenter)
self.SigFail.setObjectName("SigFail")
self.verticalLayout.addWidget(self.SigFail)
+
self.verticalLayout_5.addWidget(self.groupBox_2)
self.horizontalLayout.addLayout(self.verticalLayout_5)
self.verticalLayout_3 = QtWidgets.QVBoxLayout()
@@ -150,6 +164,8 @@ def setupUi(self, MainWindow):
self.label_11.setAlignment(QtCore.Qt.AlignCenter)
self.label_11.setObjectName("label_11")
self.verticalLayout_3.addWidget(self.label_11)
+
+ ### POWER OUTPUT DISPLAY
self.lcdPow_2 = QtWidgets.QLCDNumber(self.BrkAcelBox)
self.lcdPow_2.setMaximumSize(QtCore.QSize(16777215, 400))
self.lcdPow_2.setFrameShape(QtWidgets.QFrame.Box)
@@ -157,6 +173,8 @@ def setupUi(self, MainWindow):
self.lcdPow_2.setDigitCount(3)
self.lcdPow_2.setObjectName("lcdPow_2")
self.verticalLayout_3.addWidget(self.lcdPow_2)
+
+ ### ACELLERATE INPUT
self.vertSliderPow = QtWidgets.QSlider(self.BrkAcelBox)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(10)
@@ -171,6 +189,8 @@ def setupUi(self, MainWindow):
self.horizontalLayout.addLayout(self.verticalLayout_3)
self.horizontalLayout_8.addLayout(self.horizontalLayout)
self.gridLayout_2.addWidget(self.BrkAcelBox, 1, 1, 2, 2)
+
+ ### TRAIN SELECTION
self.Train_Select_Box = QtWidgets.QGroupBox(self.centralwidget)
self.Train_Select_Box.setMaximumSize(QtCore.QSize(400, 16777215))
self.Train_Select_Box.setStyleSheet("background-color: rgb(233, 247, 255);")
@@ -205,6 +225,8 @@ def setupUi(self, MainWindow):
self.Ebrake = QtWidgets.QPushButton(self.centralwidget)
font = QtGui.QFont()
font.setPointSize(25)
+
+ ####EBRAKE
self.Ebrake.setFont(font)
self.Ebrake.setAutoFillBackground(False)
self.Ebrake.setStyleSheet("background-color: rgb(255, 55, 62);\n"
@@ -216,6 +238,7 @@ def setupUi(self, MainWindow):
self.Ebrake.setFlat(False)
self.Ebrake.setObjectName("Ebrake")
self.gridLayout_2.addWidget(self.Ebrake, 6, 0, 1, 4)
+
self.CabinConditionsBox = QtWidgets.QGroupBox(self.centralwidget)
self.CabinConditionsBox.setMaximumSize(QtCore.QSize(400, 16777215))
font = QtGui.QFont()
@@ -226,6 +249,8 @@ def setupUi(self, MainWindow):
self.CabinConditionsBox.setObjectName("CabinConditionsBox")
self.gridLayout = QtWidgets.QGridLayout(self.CabinConditionsBox)
self.gridLayout.setObjectName("gridLayout")
+
+ ## RIGHT DOOR TRIGGER
self.buttonDoorR = QtWidgets.QPushButton(self.CabinConditionsBox)
self.buttonDoorR.setCheckable(True)
self.buttonDoorR.setObjectName("buttonDoorR")
@@ -233,14 +258,19 @@ def setupUi(self, MainWindow):
self.label_13 = QtWidgets.QLabel(self.CabinConditionsBox)
self.label_13.setObjectName("label_13")
self.gridLayout.addWidget(self.label_13, 2, 0, 1, 1)
+
self.IntLights = QtWidgets.QLabel(self.CabinConditionsBox)
self.IntLights.setObjectName("IntLights")
self.gridLayout.addWidget(self.IntLights, 1, 0, 1, 1)
+
+ ### TEMEPERATURE INPUT
self.temp = QtWidgets.QSpinBox(self.CabinConditionsBox)
self.temp.setProperty("minimum", 60)
self.temp.setProperty("maximum", 90)
self.temp.setObjectName("temp")
self.gridLayout.addWidget(self.temp, 3, 1, 1, 1)
+
+ ### TEMPERATURE OUTPUT
self.lcdCurTemp = QtWidgets.QLCDNumber(self.CabinConditionsBox)
self.lcdCurTemp.setObjectName("lcdCurTemp")
self.lcdCurTemp.display(self.temp.value())
@@ -249,12 +279,16 @@ def setupUi(self, MainWindow):
self.lcdCurTemp.setSmallDecimalPoint(False)
self.lcdCurTemp.setSegmentStyle(QtWidgets.QLCDNumber.Flat)
self.gridLayout.addWidget(self.lcdCurTemp, 3, 2, 1, 3)
+
+ ### HEADLIGHT CONTROLL
self.buttonHDon = QtWidgets.QPushButton(self.CabinConditionsBox)
self.buttonHDon.setCheckable(True)
self.buttonHDon.setChecked(True)
self.buttonHDon.setAutoDefault(False)
self.buttonHDon.setObjectName("buttonHDon")
self.gridLayout.addWidget(self.buttonHDon, 0, 1, 1, 2)
+
+ ### LEFT DOORS CONTROLL
self.buttonDoorL = QtWidgets.QPushButton(self.CabinConditionsBox)
self.buttonDoorL.setCheckable(True)
self.buttonDoorL.setObjectName("buttonDoorL")
@@ -269,6 +303,8 @@ def setupUi(self, MainWindow):
self.label_14 = QtWidgets.QLabel(self.CabinConditionsBox)
self.label_14.setObjectName("label_14")
self.gridLayout.addWidget(self.label_14, 3, 0, 1, 1)
+
+ ### INTERIOR LIGHTS INPUT
self.IntLightSld = QtWidgets.QSlider(self.CabinConditionsBox)
self.IntLightSld.setMaximum(2)
self.IntLightSld.setSingleStep(1)
@@ -281,6 +317,8 @@ def setupUi(self, MainWindow):
self.IntLightSld.setObjectName("IntLightSld")
self.gridLayout.addWidget(self.IntLightSld, 1, 1, 1, 4)
self.gridLayout_2.addWidget(self.CabinConditionsBox, 0, 3, 1, 1)
+
+ ##########SPEAKER SECTION~##################
self.SpeakerOutputBox = QtWidgets.QGroupBox(self.centralwidget)
self.SpeakerOutputBox.setMaximumSize(QtCore.QSize(400, 16777215))
font = QtGui.QFont()
@@ -292,6 +330,8 @@ def setupUi(self, MainWindow):
self.SpeakerOutputBox.setObjectName("SpeakerOutputBox")
self.gridLayout_4 = QtWidgets.QGridLayout(self.SpeakerOutputBox)
self.gridLayout_4.setObjectName("gridLayout_4")
+
+ ### ANNOUNCEMENT INPUT
self.Announcement = QtWidgets.QLabel(self.SpeakerOutputBox)
self.Announcement.setObjectName("Announcement")
self.gridLayout_4.addWidget(self.Announcement, 2, 0, 1, 1)
@@ -299,12 +339,18 @@ def setupUi(self, MainWindow):
self.lineEditAnn.setText("")
self.lineEditAnn.setObjectName("lineEditAnn")
self.gridLayout_4.addWidget(self.lineEditAnn, 2, 1, 1, 1)
+
+
self.CurrentOutput = QtWidgets.QLabel(self.SpeakerOutputBox)
self.CurrentOutput.setObjectName("CurrentOutput")
self.gridLayout_4.addWidget(self.CurrentOutput, 3, 0, 1, 1)
+
+ ### CURRENT STATION OUTPUT
self.CurrentStation = QtWidgets.QLabel(self.SpeakerOutputBox)
self.CurrentStation.setObjectName("CurrentStation")
self.gridLayout_4.addWidget(self.CurrentStation, 1, 0, 1, 1)
+
+ ###CURRENT SPEAKER OUTPUT
self.SpeakerOuputs = QtWidgets.QLabel(self.SpeakerOutputBox)
font = QtGui.QFont()
font.setPointSize(20)
@@ -334,9 +380,12 @@ def setupUi(self, MainWindow):
self.DistanceTillStop.setAlignment(QtCore.Qt.AlignCenter)
self.DistanceTillStop.setObjectName("DistanceTillStop")
self.verticalLayout_4.addWidget(self.DistanceTillStop)
+
+ #AUTHOIRTY OUTPUT
self.lcdAuth = QtWidgets.QLCDNumber(self.groupBox_9)
self.lcdAuth.setFrameShape(QtWidgets.QFrame.Box)
self.lcdAuth.setObjectName("lcdAuth")
+ self.lcdAuth.setDigitCount(4)
self.verticalLayout_4.addWidget(self.lcdAuth)
self.gridLayout_2.addWidget(self.groupBox_9, 2, 3, 1, 1)
self.Mode_Box = QtWidgets.QGroupBox(self.centralwidget)
@@ -349,14 +398,16 @@ def setupUi(self, MainWindow):
self.Mode_Box.setObjectName("Mode_Box")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout(self.Mode_Box)
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+ ## MANUAL MODE BUTTON
self.buttonMan = QtWidgets.QPushButton(self.Mode_Box)
self.buttonMan.setCheckable(True)
- self.buttonMan.setChecked(False)
+ self.buttonMan.setChecked(True)
self.buttonMan.setObjectName("buttonMan")
self.horizontalLayout_2.addWidget(self.buttonMan)
+ ## AUTOMATIC MODE BUTTON
self.buttonAuto = QtWidgets.QPushButton(self.Mode_Box)
self.buttonAuto.setCheckable(True)
- self.buttonAuto.setChecked(True)
+ self.buttonAuto.setChecked(False)
self.buttonAuto.setObjectName("buttonAuto")
self.horizontalLayout_2.addWidget(self.buttonAuto)
self.gridLayout_2.addWidget(self.Mode_Box, 0, 0, 1, 1)
@@ -396,14 +447,14 @@ def setupUi(self, MainWindow):
self.lcdSpdLim.setDigitCount(2)
self.lcdSpdLim.setObjectName("lcdSpdLim")
self.horizontalLayout_6.addWidget(self.lcdSpdLim)
- self.lcdCurSpd_2 = QtWidgets.QLCDNumber(self.groupBox_8)
- self.lcdCurSpd_2.setDigitCount(2)
- self.lcdCurSpd_2.setObjectName("lcdCurSpd_2")
- self.horizontalLayout_6.addWidget(self.lcdCurSpd_2)
self.lcdCmdSpd = QtWidgets.QLCDNumber(self.groupBox_8)
self.lcdCmdSpd.setDigitCount(2)
self.lcdCmdSpd.setObjectName("lcdCmdSpd")
self.horizontalLayout_6.addWidget(self.lcdCmdSpd)
+ self.lcdCurSpd = QtWidgets.QLCDNumber(self.groupBox_8)
+ self.lcdCurSpd.setDigitCount(2)
+ self.lcdCurSpd.setObjectName("lcdCurSpd")
+ self.horizontalLayout_6.addWidget(self.lcdCurSpd)
self.gridLayout_5.addLayout(self.horizontalLayout_6, 1, 0, 1, 1)
self.gridLayout_2.addWidget(self.groupBox_8, 4, 0, 1, 4)
self.groupBox_3 = QtWidgets.QGroupBox(self.centralwidget)
@@ -420,11 +471,13 @@ def setupUi(self, MainWindow):
self.lcdKi.setSmallDecimalPoint(True)
self.lcdKi.setDigitCount(4)
self.lcdKi.setObjectName("lcdKi")
+ self.lcdKi.display(70)
self.gridLayout_3.addWidget(self.lcdKi, 0, 0, 1, 1)
self.lcdKp = QtWidgets.QLCDNumber(self.groupBox_3)
self.lcdKp.setSmallDecimalPoint(True)
self.lcdKp.setDigitCount(4)
self.lcdKp.setObjectName("lcdKp")
+ self.lcdKp.display(30)
self.gridLayout_3.addWidget(self.lcdKp, 0, 1, 1, 1)
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
@@ -452,80 +505,102 @@ def setupUi(self, MainWindow):
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
+
+
self.retranslateUi(MainWindow)
- self.buttonMan.clicked['bool'].connect(self.buttonAuto.toggle) # type: ignore
- self.buttonAuto.clicked['bool'].connect(self.buttonMan.toggle) # type: ignore
- # self.inputKi.valueChanged['double'].connect(self.lcdKi.display) # type: ignore
- # self.inputKp.valueChanged['double'].connect(self.lcdKp.display) # type: ignore
+
+ self.buttonMan.clicked['bool'].connect(self.set_man) # type: ignore
+ self.buttonAuto.clicked['bool'].connect(self.set_auto) # type: ignore
+ #self.inputKi.valueChanged['double'].connect(self.lcdKi.display()) # type: ignore
+ #self.inputKp.valueChanged['double'].connect(self.lcdKp.display()) # type: ignore
self.buttonHDon.clicked['bool'].connect(self.buttonHDoff.toggle) # type: ignore
self.buttonHDoff.clicked['bool'].connect(self.buttonHDon.toggle) # type: ignore
self.lineEditAnn.textChanged['QString'].connect(self.SpkrOut.setText) # type: ignore
self.CurStatOut.windowIconTextChanged['QString'].connect(self.SpkrOut.setText) # type: ignore
- # self.vertSliderBrk.valueChanged.connect(self.lcdBrk.display)
- self.vertSliderBrk.valueChanged.connect(self.calBrakeOutput) # type: ignore
- # self.vertSliderPow.valueChanged.connect(self.lcdPow_2.display) # type: ignore
- self.vertSliderPow.valueChanged.connect(self.calPower) # type: ignore
+ self.vertSliderBrk.valueChanged.connect(lambda : self.calBrakeOutput())
+ self.vertSliderPow.valueChanged.connect(lambda : self.calAccelOutput()) # type: ignore
QtCore.QMetaObject.connectSlotsByName(MainWindow)
- self.inputKi.valueChanged['double'].connect(self.onKiValueChanged)
- self.inputKp.valueChanged['double'].connect(self.onKpValueChanged)
-
+ self.inputKp.valueChanged.connect(lambda : self.onKpValueChanged())
+ self.inputKi.valueChanged.connect(lambda : self.onKiValueChanged())
self.temp.valueChanged.connect(self.tempControl)
+ self.Ebrake.clicked.connect(lambda : self.ebrake_enable())
+
+ #if the button is checked, it will call HARDWARE FUCNTION ONLY
+
+ #self.buttonDoorR.clicked.connect(chad function)
+ #self.buttonDoorL.clicked.connect(chad function)
+
+
+ def calBrakeOutput(self):
+ self.lcdBrk.display(self.vertSliderBrk.value())
- def calBrakeOutput(self, value):
+ if(self.lcdBrk.value() != 0):
+ testvalue = self.lcdCurSpd.value() - 2.68433022233
- self.lcdBrk.display(value)
- value = (6 * 81000) * (value / 100)
- self.brakePower = value
- # print(f"brake value changed to: {value}")
- if self.lastSliderMoved != 'brk':
- self.lcdPow_2.display(0)
+ if (testvalue <= 0):
+ self.lcdCurSpd.display(0)
+ else:
+ self.lcdCurSpd.display(int(testvalue))
+ #value = (6 * 81000) * (self.vertSliderBrk.value() / 100)
+ #self.brakePower = value
+ # print(f"brake value changed to: {value}")
+ self.vertSliderPow.setValue(0);
+ #if self.lastSliderMoved != 'brk':
+ # self.lcdPow_2.display(0)
+ # self.vertSliderPow.setValue(0)
+ # self.lastSliderMoved = 'brk'
+
+ def calAccelOutput(self):
+ # if authority is zero, the power stays at zero
+ if self.lcdAuth.value() == 0:
self.vertSliderPow.setValue(0)
- self.lastSliderMoved = 'brk'
+ self.lcdPowOut = 0
+
+ self.lcdPow_2.display(self.vertSliderPow.value())
+
+ self.CalcPower()
+ if self.vertSliderPow.value() > 1:
+ self.vertSliderBrk.setValue(0)
+
+ def onKiValueChanged(self):
+ self.lcdKi.display(self.inputKi.value())
+ self.Ki = self.inputKi.value()
+ self.CalcPower()
- def onKiValueChanged(self, value):
- self.lcdKi.display(value)
- self.Ki = value
- # print(f"Ki set to: {self.Ki}")
- def onKpValueChanged(self, value):
- self.lcdKp.display(value)
- self.Kp = value
+ def onKpValueChanged(self):
+ self.lcdKp.display(self.inputKp.value())
+ self.Kp = self.inputKp.value()
+ self.CalcPower()
# print(f"Kp set to: {self.Kp}")
- def tempControl(self,value):
- #change temp to match the value
- if not self.tempTimer.isActive():
- self.tempTimer.start()
-
+
+ def CalcPower(self):
+ # at this point in development, since we do not have time integration, dt will be static
+ self.dt = 1
+ self.power = (self.inputKp.value() * self.inputKp.value() / self.dt) * (self.vertSliderPow.value()/100)
+ self.lcdPwrOut.display(self.power)
+
+ # need to fix this
+ def tempControl(self):
+ # change temp to match the value
+ if not self.tempTimer.isActive():
+ self.tempTimer.start()
+
def updateTemperature(self):
- #increase temp
+ # increase temp
if self.temp.value() > self.lcdCurTemp.value():
self.lcdCurTemp.display(self.lcdCurTemp.value() + 1)
- #decrease temp
+ # decrease temp
elif self.temp.value() < self.lcdCurTemp.value():
self.lcdCurTemp.display(self.lcdCurTemp.value() - 1)
-
- #target temp reached
+
+ # target temp reached
else:
self.tempTimer.stop()
-
- def calPower(self, value):
-
- if value != self.lcdPow_2.value():
- # Update Power related displays and values
- self.lcdPow_2.display(value)
- self.power = (120000) * (value / 100)
- self.lcdPwrOut.display(self.power/1000)
- # print(f"Power set to: {self.power}")
-
- if self.lastSliderMoved != 'pow': # Set the last moved slider
- self.lcdBrk.display(0)
- self.vertSliderBrk.setValue(0)
- self.lastSliderMoved = 'pow'
-
# if self.buttonMan.setChecked() == False:
# self.v_error = self.v_cmd - self.v_current
# self.integral_error += self.v_error * self.dt
@@ -538,68 +613,160 @@ def calPower(self, value):
# self.lcdPwrOut.display(self.control_output)
# print(f"Control output set to: {self.control_output}")
+ ################################################################################ vital stff
+ # called when speed changes
-################################################################################ vital stff
-
-
-
- #called when speed changes
-
def calSpeed(self):
- #update speed every second
+ # update speed every second
if not self.speedTimer.isActive():
- self.speedTimer.start()
+ self.speedTimer.start()
def speedControl(self):
+
+
# over speed limit
- if (self.lcdCmdSpd.value() > self.lcdSpdLim.value()) & (self.lcdCurSpd_2.value() < self.lcdCmdSpd.value()):
- self.lcdCmdSpd.display(self.lcdSpdLim.value())
- self.lcdCurSpd_2.display(self.lcdCurSpd_2.value() + 1)
- #if cmd is less than current speed and speed limit
- elif (self.lcdCmdSpd.value() > self.lcdCurSpd_2.value()) & (self.lcdCmdSpd.value() < self.lcdSpdLim.value()):
- self.lcdCurSpd_2.display(self.lcdCurSpd_2.value() - 1)
+ #if (self.lcdCmdSpd.value() > self.lcdSpdLim.value()) & (self.lcdCurSpd.value() < self.lcdCmdSpd.value()):
+ #self.lcdCmdSpd.display(self.lcdSpdLim.value())
+ #self.lcdCurSpd.display(self.lcdCurSpd.value() + 1)
- else:
- self.speedTimer.stop()
+ # if cmd is less than current speed and speed limit
+ #elif (self.lcdCmdSpd.value() > self.lcdCurSpd.value()) & (self.lcdCmdSpd.value() < self.lcdSpdLim.value()):
+ #self.lcdCurSpd.display(self.lcdCurSpd.value() - 1)
+ if(self.lcdCurSpd.value() == 0 and self.lcdAuth.value() == 0):
+ self.speedTimer.stop()
+ elif(self.lcdCurSpd.value() > self.lcdCmdSpd.value() or self.lcdCurSpd.value() > self.lcdSpdLim.value() and self.vertSliderBrk == 0):
+ self.vertSliderPow.setValue(0)
+ self.vertSliderBrk.setValue(1)
+ self.calBrakeOutput()
+ self.vertSliderPow.setDisabled(True)
+ elif(self.lcdCurSpd.value() < self.lcdCmdSpd.value() and self.lcdCurSpd.value() < self.lcdSpdLim.value()):
+ self.vertSliderBrk.setValue(0)
+ self.vertSliderPow.setValue(50)
+ self.lcdCurSpd.display(self.lcdCurSpd.value() + 1)
- def doorControl(self):
- # lauren i dont know how the door functions work but i think this is kinda close
- # doorControl() needs to be called when the buttons are pressed
- # we might need a doorControlL() and doorControlR()
- if self.lcdCurSpd_2.value() != 0:
- # disable the buttons from working
- self.buttonDoorR.setEnabled(False)
- self.buttonDoorL.setEnabled(False)
-
else:
- self.buttonDoorR.toggle()
- self.buttonDoorL.toggle()
+ self.speedTimer.stop()
+ self.vertSliderPow.setDisabled(False)
-
+ def doorControl(self,enable):
+ self.buttonDoorL.setEnabled(enable)
+ self.buttonDoorR.setEnabled(enable)
## we need to call this when auth is entered from TB and we have a speed
- def calAuth(self):
- #update auth every second
+ def calcAuth(self):
+ # update auth every second
+ self.calSpeed()
if not self.authTimer.isActive():
- self.authTimer.start()
+ self.authTimer.start()
def updateAuth(self):
- #decrease auth
- if (self.lcdAuth.value() != 0 & self.lcdCurSpd_2.value() != 0):
- rate = self.lcdCurSpd_2.value() * 1.46667
+ # decrease auth
+ if ((self.lcdAuth.value() != 0) & (self.lcdCurSpd.value() != 0)):
+ self.doorControl(False)
+ rate = self.lcdCurSpd.value() * 1.46667
self.lcdAuth.display(self.lcdAuth.value() - rate)
- #target auth reached
+ # target auth reached
else:
- self.authTimer.stop()
+ self.authTimer.stop()
+ self.doorControl(True)
+
+
+ def set_auto(self):
+ self.buttonMan.toggle()
+ self.buttonDoorL.setDisabled(True)
+ self.buttonDoorR.setDisabled(True)
+ self.temp.setDisabled(True)
+ self.buttonHDoff.setDisabled(True)
+ self.buttonHDon.setDisabled(True)
+ self.IntLightSld.setDisabled(True)
+ self.lineEditAnn.setDisabled(True)
+ self.inputKi.setDisabled(True)
+ self.inputKp.setDisabled(True)
+
+
+ def set_man(self):
+ self.buttonAuto.toggle()
+ self.buttonDoorL.setDisabled(False)
+ self.buttonDoorR.setDisabled(False)
+ self.temp.setDisabled(False)
+ self.buttonHDon.setDisabled(False)
+ self.buttonHDoff.setDisabled(False)
+ self.IntLightSld.setDisabled(False)
+ self.lineEditAnn.setDisabled(False)
+ self.inputKi.setDisabled(False)
+ self.inputKp.setDisabled(False)
+
+ def ebrake_enable(self):
+ if self.Ebrake.isChecked() == True:
+ enable = True
+ else :
+ enable = False
+
+ self.buttonMan.setDisabled(enable)
+ self.buttonMan.setDisabled(enable)
+ self.buttonDoorL.setDisabled(enable)
+ self.buttonDoorR.setDisabled(enable)
+ self.temp.setDisabled(enable)
+ self.buttonHDoff.setDisabled(enable)
+ self.buttonHDon.setDisabled(enable)
+ self.IntLightSld.setDisabled(enable)
+ self.lineEditAnn.setDisabled(enable)
+ self.vertSliderPow.setValue(0)
+ self.vertSliderBrk.setValue(0)
+ self.vertSliderBrk.setDisabled(enable)
+ self.vertSliderPow.setDisabled(enable)
+ self.inputKi.setDisabled(enable)
+ self.inputKp.setDisabled(enable)
+
+
+ def Signal_Failure_Enable(self):
+
+ self.SigFail.setStyleSheet("color: red;\n"
+ "background-color: rgb(255, 255, 255);")
+ self.vertSliderPow.setValue(0)
+ self.vertSliderBrk.setValue(1)
+ self.vertSliderPow.setDisabled(True)
+ self.vertSliderBrk.setDisabled(True)
+
+
+
+ def Signal_Failure_Disable(self):
+ self.SigFail.setStyleSheet("color: rgb(225, 225, 225);\n"
+ "background-color: rgb(255, 255, 255);")
+ self.vertSliderPow.setDisabled(False)
+ self.vertSliderBrk.setDisabled(False)
+
+ def Power_Failure_Enable(self):
+ self.PwrFail.setStyleSheet("color: red;\n"
+ "background-color: rgb(255, 255, 255);")
+ self.vertSliderPow.setValue(0)
+ self.vertSliderBrk.setValue(1)
+ self.vertSliderPow.setDisabled(True)
+ self.vertSliderBrk.setDisabled(True)
+
+ def Power_Failure_Disable(self):
+ self.PwrFail.setStyleSheet("color: rgb(225, 225, 225);\n"
+ "background-color: rgb(255, 255, 255);")
+ self.vertSliderPow.setDisabled(False)
+ self.vertSliderBrk.setDisabled(False)
-#################################################################################
-
+ def Brake_Failure_Enable(self):
+ self.BrkFail.setStyleSheet("color: red;\n"
+ "background-color: rgb(255, 255, 255);")
+ self.Ebrake.setChecked(True)
+ self.ebrake_enable()
+ def Brake_Failure_Disable(self):
+ self.BrkFail.setStyleSheet("color: rgb(225, 225, 225);\n"
+ "background-color: rgb(255, 255, 255);")
+ self.Ebrake.setChecked(False)
+ self.ebrake_enable()
+ #################################################################################
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
@@ -651,4 +818,4 @@ def retranslateUi(self, MainWindow):
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
- sys.exit(app.exec_())
+ sys.exit(app.exec_())
\ No newline at end of file
diff --git a/Train Controller HW/runUI.py b/Train Controller SW/runUI.py
similarity index 86%
rename from Train Controller HW/runUI.py
rename to Train Controller SW/runUI.py
index bbfd6ed5..e26654d9 100644
--- a/Train Controller HW/runUI.py
+++ b/Train Controller SW/runUI.py
@@ -1,19 +1,18 @@
-##from test_lauren_ui import *
-##from TestBench import *
-##from mainControl import *
-from TestBench import *
-
-
-
-
-if __name__ == "__main__":
- import sys
- app = QtWidgets.QApplication(sys.argv)
- MainWindow = QtWidgets.QMainWindow()
- ui = Ui_TestBench()
- ui.setupUi(MainWindow)
- ui.Open_Main_UI()
- MainWindow.show()
- sys.exit(app.exec_())
-
-
+##from TestBench import *
+##from mainControl import *
+from TestBench import *
+
+
+
+
+if __name__ == "__main__":
+ import sys
+ app = QtWidgets.QApplication(sys.argv)
+ MainWindow = QtWidgets.QMainWindow()
+ ui = Ui_TestBench()
+ ui.setupUi(MainWindow)
+ ui.Open_Main_UI()
+ MainWindow.show()
+ sys.exit(app.exec_())
+
+
diff --git a/Train Controller HW/testBench.ui b/Train Controller SW/testBench.ui
similarity index 96%
rename from Train Controller HW/testBench.ui
rename to Train Controller SW/testBench.ui
index 817ddf79..ddec2934 100644
--- a/Train Controller HW/testBench.ui
+++ b/Train Controller SW/testBench.ui
@@ -1,456 +1,456 @@
-
-
- TestBench
-
-
-
- 0
- 0
- 571
- 665
-
-
-
- MainWindow
-
-
-
- -
-
-
- Ki
-
-
-
- -
-
-
- -
-
-
- -
-
-
- -
-
-
- Authority
-
-
-
- -
-
-
- -
-
-
- Cabin Temp
-
-
-
- -
-
-
- 60.000000000000000
-
-
- 90.000000000000000
-
-
-
- -
-
-
- Doors
-
-
-
- -
-
-
-
-
-
- Open Left
-
-
- true
-
-
- true
-
-
-
- -
-
-
- Close Left
-
-
- true
-
-
-
- -
-
-
- Open Right
-
-
- true
-
-
- true
-
-
-
- -
-
-
- Close Right
-
-
- true
-
-
-
-
-
- -
-
-
- Cabin Lights
-
-
-
- -
-
-
- Headlights
-
-
-
- -
-
-
-
-
-
- On
-
-
- true
-
-
- true
-
-
-
- -
-
-
- Off
-
-
- true
-
-
-
-
-
- -
-
-
- Kp
-
-
-
- -
-
-
- -
-
-
- Power
-
-
-
- -
-
-
- Speed Limit
-
-
-
- -
-
-
- Current Speed
-
-
-
- -
-
-
- Brake
-
-
-
- -
-
-
- -
-
-
- -
-
-
- Commanded speed
-
-
-
- -
-
-
- -
-
-
- Announce
-
-
-
- -
-
-
- Station
-
-
-
- -
-
-
- -
-
-
- -
-
-
- Failures
-
-
-
- -
-
-
-
-
-
- Power
-
-
- true
-
-
-
- -
-
-
- Brake
-
-
- true
-
-
-
- -
-
-
- Signal
-
-
- true
-
-
-
-
-
- -
-
-
- Mode
-
-
-
- -
-
-
-
-
-
- Auto
-
-
- true
-
-
- true
-
-
-
- -
-
-
- Manual
-
-
- true
-
-
-
-
-
- -
-
-
-
- 20
- 0
-
-
-
- Qt::Horizontal
-
-
-
-
-
-
-
-
-
-
- Auto
- clicked(bool)
- Manual
- toggle()
-
-
- 170
- 586
-
-
- 250
- 586
-
-
-
-
- Manual
- clicked(bool)
- Auto
- toggle()
-
-
- 250
- 586
-
-
- 170
- 586
-
-
-
-
- HLightOff
- clicked(bool)
- HLightOn
- toggle()
-
-
- 228
- 438
-
-
- 165
- 438
-
-
-
-
- HLightOn
- clicked(bool)
- HLightOff
- toggle()
-
-
- 165
- 438
-
-
- 228
- 438
-
-
-
-
- OpenLeft
- clicked(bool)
- CloseLeft
- toggle()
-
-
- 186
- 344
-
-
- 291
- 344
-
-
-
-
- OpenRight
- clicked(bool)
- CloseRight
- toggle()
-
-
- 399
- 344
-
-
- 512
- 344
-
-
-
-
- CloseLeft
- clicked(bool)
- OpenLeft
- toggle()
-
-
- 291
- 344
-
-
- 186
- 344
-
-
-
-
- CloseRight
- clicked(bool)
- OpenRight
- toggle()
-
-
- 512
- 344
-
-
- 399
- 344
-
-
-
-
-
+
+
+ TestBench
+
+
+
+ 0
+ 0
+ 571
+ 665
+
+
+
+ MainWindow
+
+
+
+ -
+
+
+ Ki
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ Authority
+
+
+
+ -
+
+
+ -
+
+
+ Cabin Temp
+
+
+
+ -
+
+
+ 60.000000000000000
+
+
+ 90.000000000000000
+
+
+
+ -
+
+
+ Doors
+
+
+
+ -
+
+
-
+
+
+ Open Left
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Close Left
+
+
+ true
+
+
+
+ -
+
+
+ Open Right
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Close Right
+
+
+ true
+
+
+
+
+
+ -
+
+
+ Cabin Lights
+
+
+
+ -
+
+
+ Headlights
+
+
+
+ -
+
+
-
+
+
+ On
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Off
+
+
+ true
+
+
+
+
+
+ -
+
+
+ Kp
+
+
+
+ -
+
+
+ -
+
+
+ Power
+
+
+
+ -
+
+
+ Speed Limit
+
+
+
+ -
+
+
+ Current Speed
+
+
+
+ -
+
+
+ Brake
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ Commanded speed
+
+
+
+ -
+
+
+ -
+
+
+ Announce
+
+
+
+ -
+
+
+ Station
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ Failures
+
+
+
+ -
+
+
-
+
+
+ Power
+
+
+ true
+
+
+
+ -
+
+
+ Brake
+
+
+ true
+
+
+
+ -
+
+
+ Signal
+
+
+ true
+
+
+
+
+
+ -
+
+
+ Mode
+
+
+
+ -
+
+
-
+
+
+ Auto
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ Manual
+
+
+ true
+
+
+
+
+
+ -
+
+
+
+ 20
+ 0
+
+
+
+ Qt::Horizontal
+
+
+
+
+
+
+
+
+
+
+ Auto
+ clicked(bool)
+ Manual
+ toggle()
+
+
+ 170
+ 586
+
+
+ 250
+ 586
+
+
+
+
+ Manual
+ clicked(bool)
+ Auto
+ toggle()
+
+
+ 250
+ 586
+
+
+ 170
+ 586
+
+
+
+
+ HLightOff
+ clicked(bool)
+ HLightOn
+ toggle()
+
+
+ 228
+ 438
+
+
+ 165
+ 438
+
+
+
+
+ HLightOn
+ clicked(bool)
+ HLightOff
+ toggle()
+
+
+ 165
+ 438
+
+
+ 228
+ 438
+
+
+
+
+ OpenLeft
+ clicked(bool)
+ CloseLeft
+ toggle()
+
+
+ 186
+ 344
+
+
+ 291
+ 344
+
+
+
+
+ OpenRight
+ clicked(bool)
+ CloseRight
+ toggle()
+
+
+ 399
+ 344
+
+
+ 512
+ 344
+
+
+
+
+ CloseLeft
+ clicked(bool)
+ OpenLeft
+ toggle()
+
+
+ 291
+ 344
+
+
+ 186
+ 344
+
+
+
+
+ CloseRight
+ clicked(bool)
+ OpenRight
+ toggle()
+
+
+ 512
+ 344
+
+
+ 399
+ 344
+
+
+
+
+