Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 5 additions & 26 deletions GUI5.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from brainflow.board_shim import BoardShim, BrainFlowInputParams, BoardIds
from GUI5_ManualDroneControl.cameraview.camera_controller import CameraController
from NAO6.nao_connection import send_command
from PySide6.QtCore import Property
# from Developers.hofCharts import main as hofCharts, ticketsByDev_text NA

from Developers import devCharts
Expand Down Expand Up @@ -57,7 +56,6 @@ class BrainwavesBackend(QObject):
logMessage = Signal(str)
naoStarted = Signal()
naoEnded = Signal()
isConnectedChanged = Signal()

@Slot()
def startNaoManual(self):
Expand Down Expand Up @@ -94,15 +92,7 @@ def nao_stand_up(self):
self.fligt_log.insert(0, "Nao failed to stand up.")
self.flightLogUpdated.emit(self.flight_log)

def get_is_connected(self):
return self.isConnectedChanged

def set_is_connected(self, value):
if self.is_connected != value:
self.is_connected = value
self.isConnectedChanged.emit()

is_connected_prop = Property(bool, get_is_connected, set_is_connected, notify=isConnectedChanged)


@Slot(result=str)
Expand Down Expand Up @@ -211,7 +201,6 @@ def __init__(self):
self.image_paths = [] # Store converted image paths
self.plots_dir = os.path.abspath("plotscode/plots") # Base plots directory
self.current_dataset = "refresh" # Default dataset to display
self.is_connected = False
try:
self.tello = Tello()
except Exception as e:
Expand Down Expand Up @@ -373,20 +362,11 @@ def keepDroneAlive(self):

@Slot(str)
def getDroneAction(self, action):
if action == 'connect':
try:
try:
if action == 'connect':
self.tello.connect()
self.is_connected = True
self.logMessage.emit("Connected to Tello Drone")
except:
self.is_connected = False
self.logMessage.emit("Error during connect: {e}")
return
elif not self.is_connected:
self.logMessage.emit(f"Drone not connected. Aborting command '{action}'.")
return
try:
if action == 'up':
elif action == 'up':
self.tello.move_up(30)
self.logMessage.emit("Moving up")
elif action == 'down':
Expand All @@ -399,7 +379,7 @@ def getDroneAction(self, action):
self.tello.move_back(30)
self.logMessage.emit("Moving backward")
elif action == 'left':
self.tello.move_lef(30)
self.tello.move_left(30)
self.logMessage.emit("Moving left")
elif action == 'right':
self.tello.move_right(30)
Expand All @@ -409,7 +389,7 @@ def getDroneAction(self, action):
self.logMessage.emit("Rotating left")
elif action == 'turn_right':
self.tello.rotate_clockwise(45)
self.logMessage.emit("Rotationg right")
self.logMessage.emit("Rotating right")
elif action == 'takeoff':
self.tello.takeoff()
self.logMessage.emit("Taking off")
Expand All @@ -429,7 +409,6 @@ def getDroneAction(self, action):
except Exception as e:
self.logMessage.emit(f"Error during {action}: {e}")


# Method for returning to home (an approximation)
def go_home(self):
# Assuming the home action means moving backward and upwards
Expand Down
14 changes: 0 additions & 14 deletions ManualDroneControl.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import "GUI5_ManualDroneControl/cameraview"
// Manual Drone Control Tab view
Rectangle {
color: "#718399"
property bool is_connected: backend.is_connected_prop

Row {
anchors.fill: parent
Expand Down Expand Up @@ -62,7 +61,6 @@ Rectangle {
MouseArea {
anchors.fill: parent
onEntered: {
enabled: root.is_connected
buttonBackground.color = "white";
buttonText.color = "black";
}
Expand Down Expand Up @@ -103,7 +101,6 @@ Rectangle {

MouseArea {
anchors.fill: parent
enabled: root.is_connected
onEntered: {
upButtonBackground.color = "white";
upButtonText.color = "black";
Expand Down Expand Up @@ -179,7 +176,6 @@ Rectangle {

MouseArea {
anchors.fill: parent
enabled: root.is_connected
onEntered: parent.color = "white"
onExited: parent.color = "#242c4d"
onClicked: backend.getDroneAction("forward")
Expand Down Expand Up @@ -221,7 +217,6 @@ Rectangle {

MouseArea {
anchors.fill: parent
enabled: root.is_connected
onEntered: parent.color = "white"
onExited: parent.color = "#242c4d"
onClicked: backend.getDroneAction("turn_left")
Expand Down Expand Up @@ -254,7 +249,6 @@ Rectangle {

MouseArea {
anchors.fill: parent
enabled: root.is_connected
onEntered: parent.color = "white"
onExited: parent.color = "#242c4d"
onClicked: backend.getDroneAction("left")
Expand Down Expand Up @@ -287,7 +281,6 @@ Rectangle {

MouseArea {
anchors.fill: parent
enabled: root.is_connected
onEntered: parent.color = "white"
onExited: parent.color = "#242c4d"
onClicked: backend.getDroneAction("stream")
Expand Down Expand Up @@ -320,7 +313,6 @@ Rectangle {

MouseArea {
anchors.fill: parent
enabled: root.is_connected
onEntered: parent.color = "white"
onExited: parent.color = "#242c4d"
onClicked: backend.getDroneAction("right")
Expand Down Expand Up @@ -353,7 +345,6 @@ Rectangle {

MouseArea {
anchors.fill: parent
enabled: root.is_connected
onEntered: parent.color = "white"
onExited: parent.color = "#242c4d"
onClicked: backend.getDroneAction("turn_right")
Expand Down Expand Up @@ -395,7 +386,6 @@ Rectangle {

MouseArea {
anchors.fill: parent
enabled: root.is_connected
onEntered: parent.color = "white"
onExited: parent.color = "#242c4d"
onClicked: backend.getDroneAction("backward")
Expand Down Expand Up @@ -442,7 +432,6 @@ Rectangle {

MouseArea {
anchors.fill: parent
enabled: !root.is_connected
onEntered: parent.color = "white"
onExited: parent.color = "#242c4d"
onClicked: backend.getDroneAction("connect")
Expand Down Expand Up @@ -475,7 +464,6 @@ Rectangle {

MouseArea {
anchors.fill: parent
enabled: root.is_connected
onEntered: parent.color = "white"
onExited: parent.color = "#242c4d"
onClicked: backend.getDroneAction("down")
Expand Down Expand Up @@ -508,7 +496,6 @@ Rectangle {

MouseArea {
anchors.fill: parent
enabled: root.is_connected
onEntered: parent.color = "white"
onExited: parent.color = "#242c4d"
onClicked: backend.getDroneAction("takeoff")
Expand Down Expand Up @@ -541,7 +528,6 @@ Rectangle {

MouseArea {
anchors.fill: parent
enabled: root.is_connected
onEntered: parent.color = "white"
onExited: parent.color = "#242c4d"
onClicked: backend.getDroneAction("land")
Expand Down