diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c46b1fc --- /dev/null +++ b/.gitignore @@ -0,0 +1,63 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Editor stuff +*.*~ +.*.sw* + +!.gitignore diff --git a/Communication/client.pyc b/Communication/client.pyc deleted file mode 100644 index 6441434..0000000 Binary files a/Communication/client.pyc and /dev/null differ diff --git a/Communication/client.py~ b/Communication/client.py~ deleted file mode 100644 index b72ef2a..0000000 --- a/Communication/client.py~ +++ /dev/null @@ -1,26 +0,0 @@ -import socket -import sys -import sockmessage -import cPickle as pickle - -class client: - - MSGLEN = 4096 - - def __init__(self, sock=None): - if sock is None: - self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - else: - self.sock = sock - - def connect(self, host, port): - self.sock.connect((host, port)) - - def send(self, msg): - serialized_msg = pickle.dumps(msg, -1) - sent = self.sock.send(serialized_msg) - - def receive(self): - recieved_msg = self.sock.recv(2048) - msg = pickle.loads(recieved_msg) - return msg diff --git a/Communication/server.pyc b/Communication/server.pyc deleted file mode 100644 index 57a9689..0000000 Binary files a/Communication/server.pyc and /dev/null differ diff --git a/Communication/server.py~ b/Communication/server.py~ deleted file mode 100644 index 1bb7b2f..0000000 --- a/Communication/server.py~ +++ /dev/null @@ -1,60 +0,0 @@ -import socket -import select -import os -import sys -import client - -class server: - - def __init__(self, port): - self.messageNum = 0 - self.client = None - self.connections = [] - self.port = port - #TODO check ip - hostname = "128.205.54.9" - self.serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - #self.serv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) - self.serv.bind((hostname, int(port))) - self.serv.listen(10) - self.connections.append(self.serv) - self.connections.append(sys.stdin) - - def start(self): - while True: - readsock, writesock, errsock = select.select(self.connections, [], []) - for sock in readsock: - if sock == self.serv: - (clientsocket, address) = self.serv.accept() - self.connections.append(clientsocket) - self.client = client.client(clientsocket) - self.addr = address - self.receive() - elif sock == sys.stdin: - # TODO check port - port = 5000 - sstr = sys.stdin.readline() - msg = sstr - self.send(msg, "166.143.225.234", port) - else: - self.receive() - - def send(self, data, host, port): - if self.client is None: - self.client = client.client() - self.client.connect(host, port) - self.client.send(data) - - def receive(self): - print self.client.receive() - sys.stdout.flush() - - def ping(self, hostname): - if self.client is None or self.addr is None: - print "No client registered" - return - response = os.system("ping -c 1 " + addr) - if response == 0: - return True - else: - return False diff --git a/Communication/testserv.py~ b/Communication/testserv.py~ deleted file mode 100644 index 7de9407..0000000 --- a/Communication/testserv.py~ +++ /dev/null @@ -1,7 +0,0 @@ -import sys -import server - -port = 5000 - -s = server.server(port) -s.start() diff --git a/UX/scripts/client.pyc b/UX/scripts/client.pyc deleted file mode 100644 index 9fda03c..0000000 Binary files a/UX/scripts/client.pyc and /dev/null differ diff --git a/UX/scripts/server.pyc b/UX/scripts/server.pyc deleted file mode 100644 index eb78402..0000000 Binary files a/UX/scripts/server.pyc and /dev/null differ diff --git a/UX/scripts/xbox.py~ b/UX/scripts/xbox.py~ deleted file mode 100644 index 213c18c..0000000 --- a/UX/scripts/xbox.py~ +++ /dev/null @@ -1,141 +0,0 @@ -import pygame -import os -import time - -elbowPosition = 1.001 -shoulderPosition = 1.001 -basePosition = 5.001 -manipulatorPosition = 5.001 -clawState = 0; - -Command = ""; - -rightMotor = 5.001; -leftMotor = 5.001; - -clear = lambda: os.system('cls') - -pygame.init() - -# Set the width and height of the screen [width,height] -#size = [500, 700] -#screen = pygame.display.set_mode(size) - -#pygame.display.set_caption("My Game") - -#Loop until the user clicks the close button. -done = False - -# Used to manage how fast the screen updates -clock = pygame.time.Clock() - -# Initialize the joysticks -pygame.joystick.init() - -# -------- Main Program Loop ----------- -while done==False: - # EVENT PROCESSING STEP - for event in pygame.event.get(): # User did something - if event.type == pygame.QUIT: # If user clicked close - done=True # Flag that we are done so we exit this loop - - joystick = pygame.joystick.Joystick(0) - joystick.init() - - joystick2 = pygame.joystick.Joystick(0) - joystick2.init() - - joy1_left = joystick.get_axis( 1 ) - joy1_right = joystick.get_axis( 4 ) - joy1_lefttrigger = joystick.get_axis( 2 ) - joy1_righttrigger = joystick.get_axis( 5 ) - - joy2_left = joystick2.get_axis( 1 ) - joy2_right = joystick2.get_axis( 4 ) - - if (abs(joy1_left) < 0.15): - joy1_left = 0 - if (abs(joy1_right) < 0.15): - joy1_right = 0 - if (joy1_lefttrigger < 0): - joy1_lefttrigger = 0 - if (joy1_righttrigger < 0): - joy1_righttrigger = 0 - - - if (abs(joy2_left) < 0.15): - joy2_left = 0 - if (abs(joy2_right) < 0.15): - joy2_right = 0 - - if(joystick.get_button(0) == 1): - clawState = 1 - if(joystick.get_button(1) == 1): - clawState = 0 - - senservo = 4 - senbigact = 16 - sensmallact = 17 - - sensmotor = 4 - - if(joystick.get_button( 5 )): - manipulatorPosition += joy1_right/(-senservo) #X - else: - elbowPosition += joy1_right/(-sensmallact) #X - - shoulderPosition += joy1_left/(-senbigact) #Y - - basePosition += (joy1_righttrigger-joy1_lefttrigger)/(senservo) # - - rightMotor = -joy2_right/(sensmotor) - leftMotor = -joy2_left/(sensmotor) - - if (abs(elbowPosition) > 10): - elbowPosition = 10 - - if (abs(shoulderPosition) > 10): - shoulderPosition = 10 - - if (abs(basePosition) > 10): - basePosition = 10 - - if (abs(manipulatorPosition) > 10): - manipulatorPosition = 10 - - if (manipulatorPosition < 0): - manipulatorPosition = 0 - - if (elbowPosition < 0): - elbowPosition = 0 - - if (shoulderPosition < 0): - shoulderPosition = 0 - - if (basePosition < 0): - basePosition = 0 - - elbowSend = ((elbowPosition / 10) * 1000) + 1000 - shoulderSend = ((shoulderPosition / 10) * 1000) + 1000 - - baseSend = ((basePosition/10) * 800) + 1100 - - manipulatorSend = ((manipulatorPosition/10) * 1800) + 600 - - rightMotorSend = ((rightMotor) * 500) + 1500 - leftMotorSend = ((leftMotor) * 500) + 1500 - - command = "l" + str(int(round(elbowSend))) + "," + str(int(round(shoulderSend))) + "," + str(int(round(baseSend))) + "," + str(int(round(manipulatorSend))) + "," + str(int(round(clawState))) + "," + str(int(round(rightMotorSend))) + "," + str(int(round(leftMotorSend))) + ","; - - print command - command = "" - # Limit to 16 frames per second - time.sleep(0.0625) - #clock.tick(16) - #clear() - -# Close the window and quit. -# If you forget this line, the program will 'hang' -# on exit if running from IDLE. -pygame.quit () -