Changes

Jump to navigation Jump to search
m
Line 165: Line 165:  
     # ------ Column Definition ------ #
 
     # ------ Column Definition ------ #
 
     col1 = [     
 
     col1 = [     
                 [sg.Text('Bot Message response', size=(30, 1))],
+
                 [sg.Text('Bot Message response', size=(20, 1))],
                 [sg.Output(size=(40, 20), font=('Mono 8'))],
+
                 [sg.Output(size=(30, 20), font=('Mono 8'))],
                 [sg.Text('Bot Command Single Entry', size=(30, 1))],
+
                 [sg.Text('Bot Command Single Entry', size=(20, 1))],
 
                 [sg.InputText(size=(30, 0), key='-QUERY-')],
 
                 [sg.InputText(size=(30, 0), key='-QUERY-')],
 
                 [sg.Button('Send Command',size=(20,1), button_color=(sg.YELLOWS[0], sg.GREENS[0]), bind_return_key=True)],
 
                 [sg.Button('Send Command',size=(20,1), button_color=(sg.YELLOWS[0], sg.GREENS[0]), bind_return_key=True)],
Line 206: Line 206:  
                 ]     
 
                 ]     
 
     col3 = [
 
     col3 = [
                 [sg.Graph(GRAPH_SIZE, (0,0), GRAPH_SIZE, key='-GRAPH-', background_color='lightblue')],
+
                 [sg.Graph(GRAPH_SIZE, (10,10), GRAPH_SIZE, key='-GRAPH-', background_color='lightblue')],
 
                 ]
 
                 ]
 
     col4 = [
 
     col4 = [
                 [sg.Button('Gyroscope',size=(15,1),font=('Mono 9'), button_color=(sg.YELLOWS[0], sg.GREENS[0]))],
+
                 [sg.Button('Gyroscope',size=(16,1),font=('Mono 9'), button_color=(sg.YELLOWS[0], sg.GREENS[0]))],
                 [sg.Text('X',font=('Mono 9'), justification="center", size=(5, 1)),
+
                [sg.Text('x',size=(1, 1),pad=(0,0)),sg.Text(size=(4, 1),font=('Mono 8'), key='-Gx-'),
                 sg.Text('Y',font=('Mono 9'), justification="center", size=(5, 1)),
+
                sg.Text('y',size=(1, 1),pad=(0,0)),sg.Text(size=(4, 1),font=('Mono 8'), key='-Gy-'),
                 sg.Text('Z',font=('Mono 9'), justification="center", size=(5, 1))],
+
                sg.Text('z',size=(1, 1),pad=(0,0)),sg.Text(size=(4, 1),font=('Mono 8'), key='-Gz-'),],
 +
                [sg.Button('Acceleration',size=(15,1),font=('Mono 9'), button_color=(sg.YELLOWS[0], sg.GREENS[0]))],
 +
                 [sg.Text('x',size=(1, 1),pad=(0,0)),sg.Text(size=(4, 1),font=('Mono 8'), key='-Ax-'),
 +
                sg.Text('y',size=(1, 1),pad=(0,0)),sg.Text(size=(4, 1),font=('Mono 8'), key='-Ay-'),
 +
                 sg.Text('z',size=(1, 1),pad=(0,0)),sg.Text(size=(4, 1),font=('Mono 8'), key='-Az-'),],
 +
                [sg.Button('Magnetic',size=(15,1),font=('Mono 9'), button_color=(sg.YELLOWS[0], sg.GREENS[0]))],
 +
                [sg.Text('x',size=(1, 1),pad=(0,0)),sg.Text(size=(4, 1),font=('Mono 8'), key='-Mx-'),
 +
                 sg.Text('y',size=(1, 1),pad=(0,0)),sg.Text(size=(4, 1),font=('Mono 8'), key='-My-'),
 +
                sg.Text('z',size=(1, 1),pad=(0,0)),sg.Text(size=(4, 1),font=('Mono 8'), key='-Mz-'),],
 
                 ]             
 
                 ]             
 
     layout = [
 
     layout = [
Line 242: Line 250:  
             print ("Transmitting Message")
 
             print ("Transmitting Message")
 
             client.send(message_to_bot.encode())
 
             client.send(message_to_bot.encode())
         if event == 'Halt Everything':
+
         elif event == 'Halt Everything':
 
             message_to_bot = "SRS"
 
             message_to_bot = "SRS"
 
             client.send(message_to_bot.encode())
 
             client.send(message_to_bot.encode())
 
             break
 
             break
         if event == 'Gyroscope':
+
         elif event == 'Gyroscope':
 
             message_to_bot = "GYR"
 
             message_to_bot = "GYR"
 
             client.send(message_to_bot.encode())
 
             client.send(message_to_bot.encode())
         if event == '<<CCW':
+
         elif event == 'Acceleration':
 +
            message_to_bot = "ACC"
 +
            client.send(message_to_bot.encode())
 +
        elif event == 'Magnetic':
 +
            message_to_bot = "MAG"
 +
            client.send(message_to_bot.encode())           
 +
        elif event == '<<CCW':
 
             message_to_bot = "TST"
 
             message_to_bot = "TST"
 
             client.send(message_to_bot.encode())           
 
             client.send(message_to_bot.encode())           
         if event == 'Send Command':
+
         elif event == 'Send Command':
             message_to_bot = value['-QUERY-'].rstrip()
+
             message_to_bot = values['-QUERY-'].rstrip()
             client.send(message_to_bot.encode())
+
             client.send(message_to_bot.encode())  
 
         # --------------- Loop through all messages coming in from threads ---------------
 
         # --------------- Loop through all messages coming in from threads ---------------
 
         while True:                # loop executes until runs out of messages in Queue
 
         while True:                # loop executes until runs out of messages in Queue
Line 266: Line 280:  
                 # do a refresh because could be showing multiple messages before next Read
 
                 # do a refresh because could be showing multiple messages before next Read
 
                 main_window.refresh()
 
                 main_window.refresh()
                 print(message)
+
                 if message[:3] == "Sys":
 +
                        message = message[4:]
 +
                        if message[:2] == "G:":
 +
                            message = message[3:]
 +
                            xyz = message.split(',')
 +
                            main_window['-Gx-'].update(xyz[0])
 +
                            main_window['-Gy-'].update(xyz[1])
 +
                            main_window['-Gz-'].update(xyz[2])
 +
                        elif message[:2] == "A:":
 +
                            message = message[3:]
 +
                            xyz = message.split(',')
 +
                            main_window['-Ax-'].update(xyz[0])
 +
                            main_window['-Ay-'].update(xyz[1])
 +
                            main_window['-Az-'].update(xyz[2])
 +
                        elif message[:2] == "M:":
 +
                            message = message[3:]
 +
                            xyz = message.split(',')
 +
                            main_window['-Mx-'].update(xyz[0])
 +
                            main_window['-My-'].update(xyz[1])
 +
                            main_window['-Mz-'].update(xyz[2])
 +
                        else:
 +
                            print("-")
 +
                else:           
 +
                    print(message)              
 
                 if message == "RxAck:Engaging Robot Shutdown" : escape = False
 
                 if message == "RxAck:Engaging Robot Shutdown" : escape = False
 
     # if user exits the window, then close the window and exit the GUI func
 
     # if user exits the window, then close the window and exit the GUI func
4,000

edits

Navigation menu