def run(self): MS_INIT_WAIT = 3000 secs = int(MS_INIT_WAIT / 1000.0) self.man = None init_worked = False num_connect_attempts = 0 while not self.man: print "waiting %s seconds" % (secs) for i in xrange(int(MS_INIT_WAIT/BASIC_TIME_STEP)+1): if self.step(BASIC_TIME_STEP) == -1: return num_connect_attempts += 1 print "connection attempt %s" % num_connect_attempts if not init_worked: try: print "burst.init called" burst.init() except Exception, e: print e else: init_worked = True print "connected to soap" if init_worked: try: self.man = burst.ALProxy('Man') except Exception, e: print e
def __init__(self, main_behavior_class=None): super(SimpleMainLoop, self).__init__(main_behavior_class = main_behavior_class) self._keep_the_loop = True # need to call burst.init first burst.init() self.initMainObjectsAndPlayer()
def __init__(self, main_behavior_class=None): super(ExternalMainLoop, self).__init__(main_behavior_class = main_behavior_class) self._keep_the_loop = True # need to call burst.init first burst.init() self.initMainObjectsAndPlayer() self.preMainLoopInit() # Start point for Player / GameController
def main(): import burst if '--help' in sys.argv or '-h' in sys.argv: print default_help() raise SystemExit burst.init() broker = burst.getBroker() from bodyposition import BodyPosition bp = BodyPosition(broker=broker) while True: bp.update() bp.pprint() sleep(0.1)
def main(ip=None): if '--help' in sys.argv or '-h' in sys.argv: print burst.default_help() raise SystemExit kw = {} if ip is not None: kw['ip'] = ip burst.init(**kw) # call once, connects to the naoqi server # broker = burst.getBroker() # use broker ... # create proxy try: alsonarProxy = burst.ALProxy("ALSonar",burst.ip,burst.port) except RuntimeError,e: print "error while creation alsonar's proxy" exit(1)
def run(): global robotStatus robotStatus = "at rest" joystick = JoystickWrapper(0,1) burst.init() while True: joystickStatus = joystick.getStatus() try: for command in Registrat.registered: if command.isTriggeredBy(joystickStatus, robotStatus): command.trigger(joystickStatus) break except QuitException: break time.sleep(0.001) # In either case, go to sleep for a while, so it's not THAT bad of a busy-wait. burst.shutdown()
# TODO: This entire file looks like shit. import time import burst burst.init() motion = burst.motion def do(): broker = burst.getBroker() motionProxy = burst.getMotionProxy() # Define The Initial Position kneeAngle = 60.0 * burst.motion.TO_RAD torsoAngle = 0.0 * burst.motion.TO_RAD wideAngle = -3.0 * burst.motion.TO_RAD #Get the Number of Joints NumJoints = len(motionProxy.getBodyJointNames()) # Define The Initial Position if (NumJoints == 22) : InitialPosition = [0.0 * motion.TO_RAD, 0.0 * motion.TO_RAD, 120.0 * motion.TO_RAD, 15.0 * motion.TO_RAD, -80.0 * motion.TO_RAD, -80.0 * motion.TO_RAD, 0.0, wideAngle, -kneeAngle/2-torsoAngle, kneeAngle, -kneeAngle/2, -wideAngle, 0.0, -wideAngle, -kneeAngle/2-torsoAngle, kneeAngle, -kneeAngle/2, wideAngle, 120.0 * motion.TO_RAD, -15.0 * motion.TO_RAD, 80.0 * motion.TO_RAD, 80.0 * motion.TO_RAD] elif (NumJoints == 26) : InitialPosition = [0.0 * motion.TO_RAD, 0.0 * motion.TO_RAD, 120.0 * motion.TO_RAD, 15.0 * motion.TO_RAD, -80.0 * motion.TO_RAD, -80.0 * motion.TO_RAD, 0.0 * motion.TO_RAD,0.0,
def main(): if '--help' in sys.argv or '-h' in sys.argv: print burst.default_help() raise SystemExit burst.init() # call once, connects to the naoqi server broker = burst.getBroker()