def chickenDance(): robot = maestor() crouch(robot) moveArmsUp(robot) twistAndDance(robot) moveArmsDown(robot) stand(robot)
def main(): robot = maestor() robot.command("InitializeSensors", "") for i in range(0, 1000): print "LAT " + str(time()) + " " + robot.getProperties("LAT", "m_x m_y f_z") print "RAT " + str(time()) + " " + robot.getProperties("RAT", "m_x m_y f_z")
def main(): #combines everything, this is the aggregatee robot = maestor() armsout(robot) handflip(robot) handhead(robot) handhips(robot) twerkin(robot) clear(robot)
def main(): #create the maestor robot object robot = maestor() robot.setProperty(joint, "velocity", .3) #constant velocity robot.setProperty(joint, "position", minLim) #start at the min lim for i in range(0, 10): robot.setProperty(joint, "position", maxLim) robot.waitForJoint(joint) robot.setProperty(joint, "position", minLim) robot.waitForJoint(joint)
def stayAlive(): robot = maestor() crouch(robot) robot.setProperty("WST", "velocity", 0.3) for i in xrange(0, 5): armUp(robot) waitForJoints(robot) armDown(robot) waitForJoints(robot) upperToZero(robot) robot.setProperty("WST", "velocity", 1) stand(robot)
def __init__(self, port="/dev/ttyACM0", baudrate=9600, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, timeout=1, xonxoff=False): #Create and configure the serial reader self.ser = serial.Serial() self.ser.port = port self.ser.baudrate = baudrate self.ser.bytesize = bytesize self.ser.parity = parity self.ser.stopbits = stopbits self.ser.timeout = timeout self.ser.xonxoff = xonxoff #Used for movement self.increment = -.1 #Create variables for moving the elbow self.elbowCurrentPos = -.75 self.elbowPosMax = -1.7 self.elbowPosMin = -.1 #Create variables for moving the RSP self.RSPCurrentPos = 0 self.RSPPosMax = -1 self.RSPPosMin = 1 #Create variables for moving the RSR self.RSRCurrentPos = 0 self.RSRPosMax = -1.3 self.RSRPosMin = 0 #Create variables for moving the RSY self.RSYCurrentPos = 0 self.RSYPosMax = -1.35 self.RSYPosMin = 1.35 #Create the maestor object to talk to MAESTOR self.robot = maestor() self.robot.setProperty("REP", "velocity", .5) self.robot.setProperty("RSP", "velocity", .5) self.robot.setProperty("RSR", "velocity", .5) self.robot.setProperty("RSY", "velocity", .5) self.robot.setProperty("REP", "position", self.elbowCurrentPos) self.robot.setProperty("RSP", "position", self.RSPCurrentPos) self.robot.setProperty("RSR", "position", self.RSRCurrentPos) self.robot.setProperty("RSY", "position", self.RSYCurrentPos) #Create a list of the functions to call map to each sensor number self.responses = [self.moveElbowUp, self.moveElbowDown, self.doNothing, self.doNothing, self.doNothing, self.doNothing, self.doNothing, self.doNothing ] #self.moveRSYRight, self.moveRSYLeft, self.moveRSRUp, self.moveRSRDown, self.moveRSPUp, self.moveRSPDown] self.thresholds = [2, 2, 2, 2, 2, 2, 2, 2] #Open up the serial connection try: self.ser.open() except Exception, e: print "Serial Connection could not be opened: " + str(e)
def doTheYMCA(): robot = maestor() crouch(robot) for i in xrange(0,2): #for(int i=0; i < 3; i ++) theY(robot) waitForJoints(robot) theM(robot) waitForJoints(robot) theC(robot) waitForJoints(robot) theA(robot) waitForJoints(robot) upperBodyHome(robot) waitForJoints(robot) stand(robot)
def doTheYMCA(): robot = maestor() crouch(robot) for i in xrange(0, 3): #for(int i=0; i < 3; i ++) theY(robot) waitForJoints(robot) theM(robot) waitForJoints(robot) theC(robot) waitForJoints(robot) theA(robot) waitForJoints(robot) upperBodyHome(robot) waitForJoints(robot) stand(robot)
def walkLikeAnEgyptian(): robot = maestor() crouch(robot) for i in xrange(0, 2): for i in xrange(0, 2): one_way_S(robot) wait_for_joint(robot) one_way_extended(robot) wait_for_joint(robot) for i in xrange(0, 2): other_way_S(robot) wait_for_joint(robot) other_way_extended(robot) wait_for_joint(robot) upper_body_home(robot) wait_for_joint(robot) stand(robot)
#!/usr/bin/env python from Maestor import maestor robot = maestor() def main(): setVelocities() bendDown() doTheRobot() standUp() resetVelocities() def setVelocities(): robot.setProperties("RSP RSR RSY REP NKY", "velocity velocity velocity velocity velocity", "1.5 1.5 1.5 1.5 1.5") def resetVelocities(): robot.setProperties("RSP RSR RSY REP NKY", "velocity velocity velocity velocity velocity", "1 1 1 1 1") def bendDown(): robot.setProperties("RFZ LFZ", "position position", "-.54 -.54") robot.waitForJoint("RFZ") robot.waitForJoint("LFZ")
def main(): robot = maestor() for i in range(0, 200): print robot.getProperties("ZMP", "")
def theRobot(): robot = maestor() bendDown(robot) for i in range(0, 3): doTheRobot(robot) standUp(robot)
def main(): global listening global danceStop signal.signal(signal.SIGINT, signal_handler) config = { "database": { "host": "127.0.0.1", "user": "******", "passwd": "hubo", "db": "dejavu", } } listener = songListener(config) listener.start() theRobot = maestor() listening = True #Used for knowing where in a dance we are ##Used for knowing which part of the dance to do index = 0 danceList = [] #crouch crouch(theRobot) #loop in main thread and dance if we should be dancing. while(listening): if danceStop: continue if chickenDance: #Get the chicken dance list danceList = ChickenDance.getDanceList() elif robotDance: #Get the robot dance list danceList = robot.getDanceList() elif discoDance: #Get the disco dance list danceList = disco.getDanceList() elif egyptianDance: #Get the egyptian dance list danceList = walkLikeAnEgyptian.getDanceList() elif ymcaDance: #Get the ymca dance list danceList = YMCA.getDanceList() else: #In here we need to stop/do nothing. #Set the robot back to home upperHome(theRobot) waitForJoints(theRobot) #Reset the index index = 0; #Reset dance stop danceStop = True print "It is now save to end the demo with ctrl-c" continue #Do a step of the dance stepper(index, danceList, theRobot) if( index < len(danceList) - 1): index += 1 else: index = 0 #Stand up stand(theRobot) listener.stop()
def theRobot(): robot = maestor() bendDown(robot) doTheRobot(robot) standUp(robot)
#!/usr/bin/env python from Maestor import maestor import time leftHit = 0 leftBase = 0 rightHit = 0 rightBase = 0 robot = maestor() #EP SP SR SY WY WP def loadJointValues(): global leftHit global rightHit global leftBase global rightBase f = open("hitConfig.txt", "r") for line in f: words = line.split(" ") if words[0] == "Left:": leftHit = float(words[1]) elif words[0] == "Right:": rightHit = float(words[1]) leftBase = leftHit + .05 rightHit = rightHit + .02 rightBase = rightHit - .05 print leftBase print leftHit