Esempio n. 1
0
def ik(args):
    global broker, nao_motion, nao_video
    data.IP = args['--ip']
    data.PORT = int(args['--port'])
    broker = ALBroker("myBroker", "0.0.0.0", 0, data.IP, data.PORT)
    nao_motion = MotionController()
    nao_video = VideoController()
    nao_motion.stand()
    nao_tts = ALProxy("ALTextToSpeech", data.IP, data.PORT)
    try:
        loop = LogicalLoop(nao_motion=nao_motion, nao_video=nao_video, nao_tts=nao_tts,
                           ppA=float(args['--ppA']), cA=float(args['--cA']), rA=float(args['--rA']),
                           min_detections=1, wait_disc_func=lambda: None)
        if not args['--no-grab']:
            wait_for_disc()
        else:
            nao_motion.motion_proxy.closeHand("LHand")
            nao_motion.setLeftArmRaised(secure=True)
        loop.inverseKinematicsConvergence(int(args['--hole']))
        nao_motion.crouch()
    except KeyboardInterrupt:
        print "Keyboard interrupt"
        broker.shutdown()
    return 0