""" Slightly better implementation of using the joystick Does not use the pytekkotsu AiboRobot class """ from pygame import * from time import sleep from listener import Listener from defs import PORTS, clip import struct ### variables and setup ####################################################### ip = "aibo4" #192.168.0.44 PS2BUTTONS= {0: "TRIANGLE", 1: "CIRCLE", 2: "CROSS", 3: "SQUARE", 4: "L1", 5: "R1", 6: "L2", 7: "R2", 8: "START", 9: "SELECT", 10: "L3", 11: "R3"} x,y,z = 0,0,0 p,t,r = 0,0,0 main_control = Listener(PORTS["Main Control"], ip) main_control.s.send("!reset\n") # reset menu main_control.s.send("!select \"%s\"\n" % "Walk Remote Control") #main_control.s.send("!select \"%s\"\n" % "UPenn Walk Remote Control") # woah! main_control.s.send("!select \"%s\"\n" % "Head Remote Control") walk_control = Listener(PORTS["Walk Remote Control"], ip) head_control = Listener(PORTS["Head Remote Control"], ip) ### functions ################################################################# def timestep(sec): while True: print "sleep" yield True sleep(sec) def makecc(control, amt): return struct.pack('