From 075ebc418dfcc62577c51b751c9893284995dcbb Mon Sep 17 00:00:00 2001 From: Guru Prasad Srinivasa Date: Mon, 6 Apr 2015 07:35:47 -0400 Subject: [PATCH 1/2] Added a gitignore Please use something better than gedit. Vim is a good alternate. Plus, you get nerd points :) --- .gitignore | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .gitignore 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 From cad6bf7d76d9fd8e67a09fa1edc6190aa0f679b1 Mon Sep 17 00:00:00 2001 From: Guru Prasad Srinivasa Date: Mon, 6 Apr 2015 07:38:10 -0400 Subject: [PATCH 2/2] Removed temporary files Try to avoid `git add .` in the future --- Communication/client.pyc | Bin 1711 -> 0 bytes Communication/client.py~ | 26 ------- Communication/server.pyc | Bin 2445 -> 0 bytes Communication/server.py~ | 60 ---------------- Communication/testserv.py~ | 7 -- UX/scripts/client.pyc | Bin 1693 -> 0 bytes UX/scripts/server.pyc | Bin 2374 -> 0 bytes UX/scripts/xbox.py~ | 141 ------------------------------------- 8 files changed, 234 deletions(-) delete mode 100644 Communication/client.pyc delete mode 100644 Communication/client.py~ delete mode 100644 Communication/server.pyc delete mode 100644 Communication/server.py~ delete mode 100644 Communication/testserv.py~ delete mode 100644 UX/scripts/client.pyc delete mode 100644 UX/scripts/server.pyc delete mode 100644 UX/scripts/xbox.py~ diff --git a/Communication/client.pyc b/Communication/client.pyc deleted file mode 100644 index 6441434ef2bced7b5efbe5a3c5f9ac242e5c1d06..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1711 zcmb_cK~EDw6n?V{OAAGiL_`ltJZ(JKlkuWPB-I$9>K203#7)@_ux)p?>`VzH^dj8+ z1^!NdfPU|70X>-*HaoL#W@o;6@B7{x|L6Sdi{E0apa4RTz0W*4QDlDjk zGnk#^CUpLQaX>UiMU(X7u|tqX@N38c?>v6bg$Ic70*@3#SDN5v)(xg%;CH zFlH316-)+9IO-XH`T-RS^zmqc@a~|TdowH^Hk5T-Dv=U016uz>6Uzb4hMYxGnVYS* z8;$0*IE7A*MY1e4(fsAA&Tt6PBCc7<=3btb>XwSh9d$S|ed}hiWbf2z8w089xO@}- za}%;jodH&-$NCt$+Bo`iA_SDMq8#`Psz2{}b NFF91pXDu*Q7Qlc 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 57a968941f2c9ee0de70f270d48c300c121883fd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2445 zcmb_d&2Af26h3#xcH;cD4WvS#64+oNaGEr!KthNT+6E9t8mB5mtw!$5O)`!>cIRG~ zRI*oL!JZ|rz>+uN4G>qquzD7N^ zcxHBvMKyskGwGCE(UqD+rGg~Db-Gf)*u!wYfIz@lBvxO@ z1ad6863V#TQnM$4_^NcPN^45zDFb8V+*`^ZsaH+HPgLCx;>kR(p{Qf zdS%HkOLs+2rGl`~&{hT_ZV6;-`=jRe&E4kiPV?hz0Sk>)5a<)>Tjx5*wl(T|y)?+J zMl$JTHuruJN0LFF+r(#s-07L&pzvk12g#}Rehz2u+>5_#-96Cr?Qi$Kj@t*(-81yh`3I^ceJd{VFOpE{qlTglnV~W3c z{HshVGR6<-59KtF;^!&ftq|XjaJnj!nl1)J&$z1DMXb75)d@idUJu1{GgQFtr(2Zm z>(X6N*}oI3ley_icaa(1$gjU4Jmbp$6JM2%PM%xI)jnAkQ__6S0`rJX{P5V6T= z0;csIy@7>tU!zP*(vI(F23UR?s>_IsYI+~y9WyC#f7Ps)wMHX3)cv=?l;>)S7wOD~7uCim_HGDe}-#1|zTC<)}AuCmI9=(WUr7Wj8S#V#V zfdfwUg| zk`TU;rvC$QFY>G0|9>o)Kw<1OsI{QJQeUgr>XlLfBNr**6B2Q;Y-AxhjLS1b!|+Mz P_@}H9HE0QO(r@rDej?Ud 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 9fda03c588526a98d7a0dada460fa23f7de4138b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1693 zcmb_cQBM;=5T3n*qlF?!BBBpUe7g8x6BFZ$8j)0EgsN8vS`#njdcd{4y>h!HkkA+5 z&0pZ}^atoSvju!J5ih%Qb9+0pGv7C}{?GZ@=PPsD2~8d!@0XaS4$;L>G$3kU>WbQm zx*m0>sO!@?(HYU_Hog_L!fDuKzwk6|05ut8skWD{JuJP#G*2K>IE5of*iN(gIb6f3 z$4=W=5%2AQPvVssidrFi&1ey>*%?occOBC_g*X+D{R)*2$tvn8k)BAO&OACLil<0d zd8gA6K`T_SZA$cZiq%4=l7K0aeroLu*4AFfZ<~!RI|se>e*InC+KL)$o3fv`g&d6g zN(XxpBN1XcVID)P9~607H@kyOkB;l>MV^mzmUL`Z=D@1BK9o_ z92CZiGAv4a?Ia=&{064svq=eaj4~f8fq#Vp{>L62f8?mG5Q)J1MCE7630#6a$>~0R zjD0%w*{1JNxj`1XWcp2!hB3DKbQ}H-tF$A@^I6Rdg3JmF;dOPAJ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(T{qC)@8Q+k4wO&|56=^VVvQavNQO z2+l-MRs9%Zl-gmmMKSYvyEkyQLK`5njl^@-!*D4h(jjo!eK=sF2;TNeL4aL=o&+)MT-%O}j7rnC_>H=0|` pdb3tqXU-x8-bHd0mLrNe)uXTH7Mg%h%aA`~Z|H5-kRkmG{sj=D#jOAU 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 () -