make some python happen
This commit is contained in:
parent
fcfc605f77
commit
d88313f742
|
@ -1,3 +1,19 @@
|
|||
import aiohttp
|
||||
import orjson
|
||||
import threading
|
||||
|
||||
# connect to websocket - create thread that handles JSON events
|
||||
class TelemetryServer(QObject):
|
||||
"""Connection to upstream database"""
|
||||
|
||||
conn_url: str
|
||||
"Something like http://<some_ip>:8082"
|
||||
|
||||
callbacks: Dict[str, Signal]
|
||||
|
||||
def __init__(self, url: str, parent=None):
|
||||
super().__init__(parent)
|
||||
self.conn_url = url
|
||||
|
||||
|
||||
|
||||
|
|
58
py/pytelem/bms.py
Normal file
58
py/pytelem/bms.py
Normal file
|
@ -0,0 +1,58 @@
|
|||
from typing_extensions import TypedDict
|
||||
|
||||
from PySide6.QtCore import QObject
|
||||
from PySide6.QtWidgets import QDockWidget, QGridLayout, QGroupBox, QHBoxLayout, QLabel, QVBoxLayout, QWidget
|
||||
|
||||
ContactorStates = TypedDict("ContactorStates", {})
|
||||
|
||||
|
||||
class BMSState(QObject):
|
||||
"""Represents the BMS state, including history."""
|
||||
main_voltage: float
|
||||
aux_voltage: float
|
||||
current: float
|
||||
|
||||
def __init__(self, parent=None, upstream=None):
|
||||
super().__init__(parent)
|
||||
# uhh, take a connection to the upstream?
|
||||
|
||||
|
||||
class BMSModuleViewer(QDockWidget):
|
||||
"""BMS module status viewer (temp and voltage)"""
|
||||
|
||||
layout: QGridLayout
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
self.layout = QGridLayout(self)
|
||||
|
||||
|
||||
class BMSOverview(QWidget):
|
||||
layout: QGridLayout
|
||||
|
||||
|
||||
def __init__(self, parent=None) -> None:
|
||||
super().__init__(parent)
|
||||
self.layout = QGridLayout(self)
|
||||
main_voltage_label = QLabel("Main Voltage", self)
|
||||
self.layout.addWidget(main_voltage_label, row=1, column=0)
|
||||
aux_v_label= QLabel("Aux Voltage", self)
|
||||
self.layout.addWidget(aux_v_label, row=1, column=1)
|
||||
current_label = QLabel("Battery Current", self)
|
||||
self.layout.addWidget(current_label, row=1, column=2)
|
||||
|
||||
# now add widgets that display the numeric values.
|
||||
# then make slots that take floats and display them.
|
||||
|
||||
class BMSStatus(QDockWidget):
|
||||
|
||||
layout: QVBoxLayout
|
||||
contactors: QGroupBox
|
||||
|
||||
def __init__(self, parent = None):
|
||||
super().__init__("Battery Status", parent)
|
||||
|
||||
self.layout = QVBoxLayout(self)
|
||||
self.contactors = QGroupBox("Contactor State", self)
|
||||
self.layout.addWidget(self.contactors)
|
||||
|
|
@ -30,7 +30,7 @@ class PacketTree(QWidget):
|
|||
splitter = QtWidgets.QSplitter(self)
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
|
||||
splitter.setOrientation(Qt.Vertical)
|
||||
# splitter.setOrientation(Qt.Vertical)
|
||||
self.tree = QTreeView()
|
||||
self.prop_table = pyqtgraph.parametertree.ParameterTree()
|
||||
splitter.addWidget(self.tree)
|
||||
|
|
|
@ -77,7 +77,6 @@ def make_cubic(a, b, c, d):
|
|||
|
||||
|
||||
@jit
|
||||
@vmap
|
||||
def get_radiation_direct(yday, altitude_deg):
|
||||
"""Calculate the direct radiation at a given day of the year given the angle of the sun
|
||||
from the horizon."""
|
||||
|
|
Loading…
Reference in a new issue