Line 134: |
Line 134: |
| import PySimpleGUI as sg | | import PySimpleGUI as sg |
| import socket | | import socket |
− | | + | |
| def worker_thread1(thread_name, gui_queue): | | def worker_thread1(thread_name, gui_queue): |
| """ | | """ |
Line 147: |
Line 147: |
| #print (message_from_bot) | | #print (message_from_bot) |
| #if message_from_bot == "RxAck:Engaging Robot Shutdown" : escape = False | | #if message_from_bot == "RxAck:Engaging Robot Shutdown" : escape = False |
− | | + | |
| def worker_thread2(thread_name, run_freq, gui_queue): | | def worker_thread2(thread_name, run_freq, gui_queue): |
| gui_queue.put('{} - {}'.format(thread_name)) | | gui_queue.put('{} - {}'.format(thread_name)) |
Line 201: |
Line 201: |
| sg.InputText(size=(5, 0), justification="center", key='-Bearing-'),], | | sg.InputText(size=(5, 0), justification="center", key='-Bearing-'),], |
| [sg.Text('Speed:',font=('Mono 9'), justification="Left", size=(8, 1)), | | [sg.Text('Speed:',font=('Mono 9'), justification="Left", size=(8, 1)), |
− | sg.Slider(range=(1,255),key='speed', default_value=127, size=(22,15), orientation='horizontal', font=('Helvetica', 12)),], | + | sg.Slider(range=(1,255),enable_events=False, key='-velocity-', default_value=128, size=(22,15), orientation='horizontal', font=('Helvetica', 12)),], |
| [sg.Button('Execute Move',size=(15,1),font=('Mono 9'), button_color=(sg.YELLOWS[0], sg.GREENS[0])), | | [sg.Button('Execute Move',size=(15,1),font=('Mono 9'), button_color=(sg.YELLOWS[0], sg.GREENS[0])), |
| sg.Button('Execute Move with Spin',size=(30,1),font=('Mono 9'), button_color=(sg.YELLOWS[0], sg.GREENS[0])),], | | sg.Button('Execute Move with Spin',size=(30,1),font=('Mono 9'), button_color=(sg.YELLOWS[0], sg.GREENS[0])),], |
Line 263: |
Line 263: |
| elif event == 'Magnetic': | | elif event == 'Magnetic': |
| message_to_bot = "MAG" | | message_to_bot = "MAG" |
| + | client.send(message_to_bot.encode()) |
| + | elif event == '-velocity-': |
| + | #this reads the speed, then sends the speed message |
| + | print("Speed Adjustment") |
| + | elif event == '<<Input CCW': |
| + | #this reads the number of degrees to rotate and gets the speed, then sends the messages |
| + | message_to_bot = "SPD" + str(int((values['-velocity-']))).rstrip() |
| + | client.send(message_to_bot.encode()) |
| + | message_to_bot = "ROT" + values['-Rotate-'].rstrip() |
| + | client.send(message_to_bot.encode()) |
| + | elif event == 'Input CW>>': |
| + | #this reads the number of degrees to rotate and gets the speed, then sends the messages |
| + | message_to_bot = "SPD" + str(int((values['-velocity-']))).rstrip() |
| + | client.send(message_to_bot.encode()) |
| + | message_to_bot = "ROT-" + values['-Rotate-'].rstrip() |
| + | client.send(message_to_bot.encode()) |
| + | elif event == '<<CCW': |
| + | #this code does the jitter test in the CCW direction |
| + | message_to_bot = "SPD" + str(int((values['-velocity-']))).rstrip() |
| + | client.send(message_to_bot.encode()) |
| + | message_to_bot = "TST1" |
| + | client.send(message_to_bot.encode()) |
| + | elif event == 'CW>>': |
| + | #this code does the jitter test in the CW direction |
| + | message_to_bot = "SPD" + str(int((values['-velocity-']))).rstrip() |
| client.send(message_to_bot.encode()) | | client.send(message_to_bot.encode()) |
− | elif event == '<<CCW':
| + | message_to_bot = "TST2" |
− | message_to_bot = "TST" | |
| client.send(message_to_bot.encode()) | | client.send(message_to_bot.encode()) |
| + | elif event == 'S2S-F2B': |
| + | #this code does the jitter test in the F/R S/S directions |
| + | message_to_bot = "SPD" + str(int((values['-velocity-']))).rstrip() |
| + | client.send(message_to_bot.encode()) |
| + | message_to_bot = "TST3" |
| + | client.send(message_to_bot.encode()) |
| + | |
| elif event == 'Send Command': | | elif event == 'Send Command': |
| message_to_bot = values['-QUERY-'].rstrip() | | message_to_bot = values['-QUERY-'].rstrip() |
Line 330: |
Line 361: |
| client.close() | | client.close() |
| print ("You ended the Robot Server Session") | | print ("You ended the Robot Server Session") |
| + | |
| + | |
| </source> | | </source> |
| | | |