def init(qi_url=None): "Returns a QiApplication object, possibly with interactive input." if qi_url: sys.argv.extend(["--qi-url", qi_url]) else: args = check_commandline_args('Run the app.') if bool(args.qi_url): qi_url = args.qi_url elif not is_on_robot(): print "no --qi-url parameter given; interactively getting debug robot." debug_robot = get_debug_robot() if debug_robot: sys.argv.extend(["--qi-url", debug_robot]) qi_url = debug_robot else: raise RuntimeError("No robot, not running.") qiapp = None sys.argv[0] = str(sys.argv[0]) # In versions bellow 2.3, look for --qi-url in the arguemnts and call accordingly the Application if qi_url and hasattr(qi, "__version__") and LooseVersion(qi.__version__) < LooseVersion("2.3"): qiapp = qi.Application(url="tcp://"+qi_url+":9559") # In versions greater than 2.3 the ip can simply be passed through argv[0] else: # In some environments sys.argv[0] has unicode, which qi rejects qiapp = qi.Application() qiapp.start() return qiapp
def __init__(self,ip,port): connection_url = "tcp://" + ip + ":" + str(port) app = qi.Application(["SubscriptionMaster", "--qi-url=" + connection_url]) super(SubscriptionMaster, self).__init__() app.start() self.memory = app.session.service("ALMemory") self.subscriber = {}
def main(): parser = argparse.ArgumentParser() parser.add_argument("--pip", type=str, default=os.environ['PEPPER_IP'], help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.") parser.add_argument("--pport", type=int, default=9559, help="Naoqi port number") args = parser.parse_args() pip = args.pip pport = args.pport #Starting application try: connection_url = "tcp://" + pip + ":" + str(pport) app = qi.Application(["TabletModule", "--qi-url=" + connection_url ]) except RuntimeError: print ("Can't connect to Naoqi at ip \"" + pip + "\" on port " + str(pport) +".\n" "Please check your script arguments. Run with -h option for help.") sys.exit(1) app.start() session = app.session #Starting services tablet_service = session.service("ALTabletService") idTTouch = tablet_service.onTouchDown.connect(onTouched) app.run()
def init(): global app, memory_service parser = argparse.ArgumentParser() parser.add_argument( "--pip", type=str, default=os.environ['PEPPER_IP'], help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.") parser.add_argument("--pport", type=int, default=9559, help="Naoqi port number") parser.add_argument("-c", type=str, default="", help="condition") args = parser.parse_args() pip = args.pip pport = args.pport cond = args.c #Starting application try: connection_url = "tcp://" + pip + ":" + str(pport) print "Connecting to ", connection_url app = qi.Application(["Conditions --qi-url=" + connection_url]) except RuntimeError: print( "Can't connect to Naoqi at ip \"" + pip + "\" on port " + str(pport) + ".\n" "Please check your script arguments. Run with -h option for help.") sys.exit(1) app.start() return [app, cond]
def main(): app = qi.Application() app.start() session = app.session myLibotDialog = LibotDialog(app) session.registerService("LibotDialog", myLibotDialog) app.run()
def __init__(self): qiApp = qi.Application(sys.argv) qiApp.start() self.get_service(qiApp) # 将展示图片写作类内函数,更方便调用 self.show_image() qiApp.stop()
def __init__(self): self.connection_url = "tcp://128.237.226.149:9559" self.app = qi.Application( ["PredictionDemo", "--qi-url=" + self.connection_url]) self.app.start() self.session = self.app.session self.motion = self.session.service("ALMotion") self.names = [ "HeadYaw", "HeadPitch", "RShoulderPitch", "RShoulderRoll", "RElbowYaw", "RElbowRoll", "RWristYaw", "LShoulderPitch", "LShoulderRoll", "LElbowYaw", "LElbowRoll", "LWristYaw" ] self.angles = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] self.fractionMaxSpeed = 0.1 self.centerPelvisIndex = 0 self.midBodyIndex = 12 self.neckBaseIndex = 13 self.noseIndex = 14 self.headIndex = 15 self.rightShoulderIndex = 17 self.rightElbowIndex = 18 self.rightHandIndex = 19 self.rightWristIndex = 20 self.rightThumbIndex = 21 self.rightFingerTipIndex = 22 self.leftShoulderIndex = 25 self.leftElbowIndex = 26 self.leftHandIndex = 27 self.leftWristIndex = 28 self.leftThumbIndex = 29 self.leftFingerTipIndex = 30
def main(): parser = argparse.ArgumentParser() parser.add_argument( "--pip", type=str, default=os.environ['PEPPER_IP'], help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.") parser.add_argument("--pport", type=int, default=9559, help="Naoqi port number") args = parser.parse_args() pip = args.pip pport = args.pport try: connection_url = "tcp://" + pip + ":" + str(pport) print "Connecting to ", connection_url app = qi.Application(["BehaviorInit", "--qi-url=" + connection_url]) except RuntimeError: print( "Can't connect to Naoqi at ip \"" + pip + "\" on port " + str(pport) + ".\n" "Please check your script arguments. Run with -h option for help.") sys.exit(1) app.start() do_init(app.session)
def main(): app = qi.Application(url='tcp://169.254.254.250:9559') app.start() session = app.session myAnimation = MyAnimation() session.registerService("MyAnimation", myAnimation) app.run()
def run(): if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument( "--ip", type=str, default="127.0.0.1", help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.") parser.add_argument("--port", type=int, default=9559, help="Naoqi port number") args = parser.parse_args() try: # Initialize qi framework. connection_url = "tcp://" + args.ip + ":" + str(args.port) app = qi.Application(["Hangman", "--qi-url=" + connection_url]) except RuntimeError: print( "Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) + ".\n" "Please check your script arguments. Run with -h option for help." ) sys.exit(1) hangman = game.Hangman(app) hangman.play()
def main(): parser = argparse.ArgumentParser() parser.add_argument( "--pip", type=str, default=os.environ['PEPPER_IP'], help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.") parser.add_argument("--pport", type=int, default=9559, help="Naoqi port number") args = parser.parse_args() pip = args.pip pport = args.pport #Starting application try: connection_url = "tcp://" + pip + ":" + str(pport) app = qi.Application(["google_client", "--qi-url=" + connection_url]) except RuntimeError: print( "Can't connect to Naoqi at ip \"" + pip + "\" on port " + str(pport) + ".\n" "Please check your script arguments. Run with -h option for help.") sys.exit(1) gc = GoogleClient("en-US", "resources/cloud_google_keys.txt", app) app.run() gc.quit()
def main(): """ Registers ALTactileGesture as a naoqi service. """ register_as_service(ALTactileGesture) app = qi.Application() app.run()
def main(): app = qi.Application() app.start() session = app.session myService = ALTabletServiceModule() session.registerService("ALTabletService", myService) app.run()
def __init__(self): app = qi.Application( ["simplescript", "--qi-url=tcp://10.0.137.152:9559"]) app.start() self.videoCapture = app.session.service("ALVideoDevice") self.animatedSpeech = app.session.service("ALAnimatedSpeech")
def __init__(self): """ Initialisation of qi framework and event detection. """ super(HumanGreeter, self).__init__() try: # Initialize qi framework. connection_url = "tcp://" + environ["robot_ip"] + ":" + environ[ "robot_port"] app = qi.Application( ["HumanGreeter", "--qi-url=" + connection_url]) except RuntimeError: print( "Can't connect to Naoqi at ip \"" + environ["robot_ip"] + "\" on port " + environ["robot_port"] + ".\n" "Please check your script arguments. Run with -h option for help." ) sys.exit(1) app.start() session = app.session # Get the service ALMemory. self.memory = session.service("ALMemory") # Connect the event callback. self.subscriber = self.memory.subscriber("PeoplePerception/PeopleList") print str(self.subscriber) #self.subscriber.signal.connect(self.on_human_tracked) # Get the services ALTextToSpeech and ALFaceDetection. self.tts = session.service("ALTextToSpeech") self.face_detection = session.service("ALPeoplePerception") self.face_detection.subscribe("HumanGreeter") self.got_face = False
def main(): parser = argparse.ArgumentParser() parser.add_argument( "--ip", type=str, default="192.168.0.100", help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.") parser.add_argument("--port", type=int, default=9559, help="Naoqi port number") parser.add_argument("--state", type=str, default="robot", help="Insert robot or human") args = parser.parse_args() state = args.state try: # Initialize qi framework. connection_url = "tcp://" + args.ip + ":" + str(args.port) app = qi.Application( ["SoundProcessingModule", "--qi-url=" + connection_url]) except RuntimeError: print( "Can't connect to Naoqi at ip \"" + args.ip + "\" on port " + str(args.port) + ".\n" "Please check your script arguments. Run with -h option for help.") sys.exit(1) MySoundProcessingModule = ad.SoundProcessingModule(app) app.session.registerService("SoundProcessingModule", MySoundProcessingModule) doJoke(MySoundProcessingModule, state)
def main(): parser = argparse.ArgumentParser() parser.add_argument("--pip", type=str, default=os.environ['PEPPER_IP'], help="Robot IP address. On robot or Local Naoqi: use '127.0.0.1'.") parser.add_argument("--pport", type=int, default=9559, help="Naoqi port number") args = parser.parse_args() pip = args.pip pport = args.pport #Starting application try: connection_url = "tcp://" + pip + ":" + str(pport) app = qi.Application(["alltasksconfirmed", "--qi-url=" + connection_url ]) except RuntimeError: print ("Can't connect to Naoqi at ip \"" + pip + "\" on port " + str(pport) +".\n" "Please check your script arguments. Run with -h option for help.") sys.exit(1) app.start() session = app.session init(session) #Program stays at this point until we stop it app.run() quit()
def main(): # qi App Session qiApp = qi.Application(sys.argv) # Bullet Simulator simulation_manager = SimulationManager() client_id = simulation_manager.launchSimulation(gui=True) pepperSim = simulation_manager.spawnPepper(client_id, translation=[0, 0, 0], quaternion=[0, 0, 0, 1], spawn_ground_plane=True) # wrap qi App Session with Simulated Pepper wrap = NaoqibulletWrapper.NaoqibulletWrapper( qiApp, pepperSim) # /!\ keep wrap instance to keep thread pybullet.setAdditionalSearchPath(pybullet_data.getDataPath()) pybullet.loadURDF("table.urdf", basePosition=[-2, 0, 0], globalScaling=1, physicsClientId=client_id) pybullet.loadURDF("totem.urdf", basePosition=[-1.5, 0, 1], globalScaling=0.7, physicsClientId=client_id) pybullet.loadURDF("totempomme.urdf", basePosition=[-1.5, -0.25, 1], globalScaling=0.7, physicsClientId=client_id) pybullet.loadURDF("totemwine.urdf", basePosition=[-1.5, 0.25, 1], globalScaling=0.7, physicsClientId=client_id) qiSession = qiApp.session motionService = qiSession.service("ALMotion") #add function here init_cam(pepperSim) motionService.setAngles(["LShoulderPitch", "RShoulderPitch"], [1, 1], [1, 1]) #take photo turn(motionService, pi) take_picture(pepperSim) #go to the object move_right_obj(motionService) #go to the box move_to_Blue(motionService) # block until stop is called. qiApp.run() # close nicely wrap.close()
def _setup(self): self._running = True self._app = qi.Application(url=self._ipaddress) self._app.start() self._appthread = threading.Thread(target=self._appspin).start() self._mem = self._app.session.service("ALMemory") self._tts = self._app.session.service("ALAnimatedSpeech") self._behav = self._app.session.service("ALBehaviorManager")
def main(): """Register and start ALRALManagerModule service.""" app = qi.Application() app.start() session = qi.Session() session.connect('tcp://127.0.0.1:9559') startService(session) app.run()
def main(): app = qi.Application() app.start() session = app.session service = SurveyService() session.registerService('SurveyService', service) app.run()
def __init__(self, ip, port): self.qiapp = qi.Application(url="tcp://" + ip + ":" + port) self.qiapp.start() self.s = stk.services.ServiceCache(self.qiapp.session) # Prepare the robot self.s.ALRobotPosture.goToPosture("Stand", 0.5) self.s.ALMotion.setBreathEnabled("Body", True) self.s.ALAnimatedSpeech.setBodyLanguageMode(0)
def __init__(self): qiApp = qi.Application() qiApp.start() self.get_service(qiApp) self.set_parameter() self.disable_auto_mode() self.move() qiApp.stop()
def __init__(self): qiApp = qi.Application() qiApp.start() self.count = 0 self.get_service(qiApp) self.disable_auto_mode() self.data_process() self.__del__() qiApp.stop()
def __init__(self, outputmanager, qiapp=None, nao_ip=None): self.output = None self.is_interrupted = False self.last_known_child_location = None self.outputmanager = outputmanager self.is_face_tracking = False self.robot_volume_enabled = False self.variables = {} if qiapp != None: self.qiapp = qiapp else: qi_url = "192.168.100.110" if nao_ip != None: qi_url = nao_ip if qi_url.find(':') == -1: qi_url += ':9559' # Default port self.qiapp = qi.Application(url="tcp://" + qi_url) self.qiapp.start() self.s = stk.services.ServiceCache(self.qiapp.session) self.events = stk.events.EventHelper(self.qiapp.session) self.s.ALAnimatedSpeech.setBodyLanguageMode(0) # Turn off the volume for the tablet condition, just in case something goes wrong with rerouting. self.toggle_robot_volume(False) # Disable some basic awareness try: self.s.ALBasicAwareness.setStimulusDetectionEnabled("Sound", False) self.s.ALBasicAwareness.setStimulusDetectionEnabled( "Movement", False) self.s.ALBasicAwareness.setStimulusDetectionEnabled("Touch", False) self.s.ALBasicAwareness.setStimulusDetectionEnabled( "People", False) except: pass self._toggle_facetracking_callback(False) self.s.ALRobotPosture.goToPosture("Crouch", 0.5) self.s.ALLeds.on('AllLeds') # Go to crouching position and disable stiffness in legs names = [ 'RKneePitch', 'LKneePitch', 'RAnklePitch', 'LAnklePitch', 'RAnkleRoll', 'LAnkleRoll' ] stiffnesses = 0.0 self.s.ALMotion.setStiffnesses(names, stiffnesses) self.lock = threading.Lock() self.events.subscribe("toggle_tablet", "OutputRealizer", self.outputmanager.tablet_screen_callback) self.events.subscribe("toggle_facetracking", "OutputRealizer", self._toggle_facetracking_callback) self.events.subscribe("trigger_facial_expression", "OutputRealizer", self._trigger_facial_expression) self.events.subscribe("accept_answer", "OutputRealizer", self.outputmanager.accept_answer_callback) self.events.subscribe("move", "OutputRealizer", self.outputmanager.move_object_callback) self.s.ALBehaviorManager.behaviorStopped.connect( self._behavior_stopped) self.om_sensor_touch_callback = self.outputmanager.sensor_touched_callback
def __init__(self): qiApp = qi.Application() qiApp.start() self.init_ros() self.get_service(qiApp) self.set_parameter() self.disable_auto_mode() dest_point = self.get_destination() self.go_to_waypoint(dest_point) qiApp.stop()
def main(): import sys app = qi.Application(sys.argv) app.start() gfService = GFService(app.session) id = app.session.registerService("GoogleForm", gfService) app.run() sys.exit()
def main(): # Create and Start the Application app = qi.Application() app.start() # Create the ALGenerateKnowledge Service ps = ALSetDateTime(app) # Register It app.session.registerService("ALSetDateTime", ps) # Run the Application app.run()
def __init__(self, ip_address, port=9559): self.session = qi.Session() self.session.connect("tcp://{0}:{1}".format(ip_address, port)) self.ip_address = ip_address self.port = port connection_url = "tcp://" + ip_address + ":" + str(port) ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.load_system_host_keys() ssh.connect(hostname=self.ip_address, username="******", password="******") self.scp = SCPClient(ssh.get_transport()) self.app = qi.Application( ["ReactToTouch", "HumanGreeter", "--qi-url=" + connection_url]) self.human_reco = HumanGreeter(self.app) self.posture_service = self.session.service("ALRobotPosture") self.motion_service = self.session.service("ALMotion") self.tracker_service = self.session.service("ALTracker") self.tts_service = self.session.service("ALAnimatedSpeech") self.tablet_service = self.session.service("ALTabletService") self.autonomous_life_service = self.session.service("ALAutonomousLife") self.system_service = self.session.service("ALSystem") self.navigation_service = self.session.service("ALNavigation") self.battery_service = self.session.service("ALBattery") self.awareness_service = self.session.service("ALBasicAwareness") self.led_service = self.session.service("ALLeds") self.audio_device = self.session.service("ALAudioDevice") self.camera_device = self.session.service("ALVideoDevice") self.face_detection_service = self.session.service("ALFaceDetection") self.memory_service = self.session.service("ALMemory") self.audio_service = self.session.service("ALAudioPlayer") self.animation_service = self.session.service("ALAnimationPlayer") self.behavior_service = self.session.service("ALBehaviorManager") self.face_characteristic = self.session.service( "ALFaceCharacteristics") self.people_perception = self.session.service("ALPeoplePerception") self.speech_service = self.session.service("ALSpeechRecognition") self.dialog_service = self.session.service("ALDialog") self.audio_recorder = self.session.service("ALAudioRecorder") self.slam_map = None self.localization = None self.camera_link = None self.recognizer = speech_recognition.Recognizer() self.autonomous_blinking_service = self.session.service( "ALAutonomousBlinking") self.eye_blinking_enabled = True self.voice_speed = 100 self.voice_shape = 100 print("[INFO]: Robot is initialized at " + ip_address + ":" + str(port))
def readBodyID(): try: app = qi.Application(sys.argv) app.start() almemory = app.session.service("ALMemory") id = almemory.getData("Device/DeviceList/ChestBoard/BodyId") print(id) exit(0) except RuntimeError, e: print("Fail") exit(1)