Skip to content
Snippets Groups Projects
Commit f95a86ca authored by 488_MP-4's avatar 488_MP-4
Browse files

added connect button, needs testing

parent a80e237a
No related branches found
No related tags found
3 merge requests!104adding cflib to this branch,!94Merge cflib adapter into main,!84Pycrocart
Showing
with 56 additions and 3 deletions
from PyQt5.QtWidgets import QPushButton, QGridLayout, QWidget, QHBoxLayout, QComboBox
class Connection(QWidget):
def __init__(self):
super().__init__()
self.dropdown = QComboBox(self)
self.dropdown.addItem("radio://45/")
self.dropdown.addItem("radio://100/")
self.dropdown.setFixedWidth(150)
self.connect = QPushButton("Connect", self)
self.connect.setFixedWidth(100)
self.scan = QPushButton("Scan", self)
self.scan.setFixedWidth(100)
button_layout = QHBoxLayout()
button_layout.addWidget(self.dropdown)
button_layout.addWidget(self.connect)
button_layout.addWidget(self.scan)
button_layout.addStretch(1)
self.show()
...@@ -8,7 +8,7 @@ groundstation and launches the gui. ...@@ -8,7 +8,7 @@ groundstation and launches the gui.
""" """
import sys import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QTabWidget from PyQt5.QtWidgets import QApplication, QMainWindow, QTabWidget, QHBoxLayout, QVBoxLayout
import uCartCommander import uCartCommander
from CrazyflieProtoConnection import CrazyflieProtoConnection from CrazyflieProtoConnection import CrazyflieProtoConnection
from ControlTab import ControlTab from ControlTab import ControlTab
...@@ -32,6 +32,24 @@ class PyCroCart(QMainWindow): ...@@ -32,6 +32,24 @@ class PyCroCart(QMainWindow):
def __init__(self, cf: CrazyflieProtoConnection, def __init__(self, cf: CrazyflieProtoConnection,
setpoint_handler: SetpointHandler): setpoint_handler: SetpointHandler):
super().__init__() super().__init__()
self.dropdown = QComboBox(self)
self.dropdown.addItem("radio://45/")
self.dropdown.addItem("radio://100/")
self.dropdown.setFixedWidth(150)
self.connect = QPushButton("Connect", self)
self.connect.setFixedWidth(100)
self.scan = QPushButton("Scan", self)
self.scan.setFixedWidth(100)
button_layout = QHBoxLayout()
button_layout.addWidget(self.dropdown)
button_layout.addWidget(self.connect)
button_layout.addWidget(self.scan)
button_layout.addStretch(1)
self.joystick_reader = JoystickReader() self.joystick_reader = JoystickReader()
...@@ -51,7 +69,14 @@ class PyCroCart(QMainWindow): ...@@ -51,7 +69,14 @@ class PyCroCart(QMainWindow):
self.tabs.addTab(self.tab3, "Parameter Window") self.tabs.addTab(self.tab3, "Parameter Window")
self.tabs.addTab(self.tab4, "Logging Window") self.tabs.addTab(self.tab4, "Logging Window")
self.setCentralWidget(self.tabs) main_layout = QHBoxLayout()
main_layout.addLayout(button_layout)
main_layout.addWidget(self.tabs)
widget = QWidget()
widget.setLayout(main_layout)
self.setCentralWidget(widget)
# self.show() # self.show()
...@@ -61,7 +86,7 @@ if __name__ == '__main__': ...@@ -61,7 +86,7 @@ if __name__ == '__main__':
app = QApplication(sys.argv) app = QApplication(sys.argv)
cf1 = CrazyflieProtoConnection() cf1 = CrazyflieProtoConnection()
uri = 'radio://0/20/2M/E7E7E7E7E7' uri = 'radio://0/60/2M/E7E7E7E7E7'
cf1.connect(uri) cf1.connect(uri)
cf1.scf.cf.commander = uCartCommander.Commander(cf1.scf.cf) cf1.scf.cf.commander = uCartCommander.Commander(cf1.scf.cf)
......
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment