mirror of
https://github.com/OSURoboticsClub/Rover_2017_2018.git
synced 2025-11-08 10:11:14 +00:00
Equipment servicing now working and integrated. Will have to have the ip changed after we know what it is.
This commit is contained in:
40
software/scripts/equipment_servicing_interface.py
Normal file
40
software/scripts/equipment_servicing_interface.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import socket
|
||||
import sys
|
||||
|
||||
# Create a UDP socket
|
||||
messages = ["HELP", "LOGIN MTECH GITRDONE", "STATUS", "START", "STOP", "LOGOUT"]
|
||||
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
|
||||
server_address = (sys.argv[1], 4547)
|
||||
|
||||
commands = []
|
||||
commands.append(sys.argv[2])
|
||||
|
||||
if len(sys.argv) > 3:
|
||||
commands.append(sys.argv[3])
|
||||
|
||||
for command in commands:
|
||||
if command in messages:
|
||||
sent = sock.sendto(command, server_address)
|
||||
|
||||
data, server = sock.recvfrom(4096)
|
||||
print data
|
||||
|
||||
# while True:
|
||||
# try:
|
||||
# # Send data
|
||||
# message = raw_input()
|
||||
# # print type(message)
|
||||
# if message not in messages:
|
||||
# print "Invalid command. Please try again."
|
||||
# continue
|
||||
#
|
||||
# sent = sock.sendto(message, server_address)
|
||||
#
|
||||
# # Receive response
|
||||
# # print 'waiting to receive'
|
||||
# data, server = sock.recvfrom(4096)
|
||||
# print data
|
||||
# except:
|
||||
# pass
|
||||
Reference in New Issue
Block a user