• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python naoqi.ALModule类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中naoqi.ALModule的典型用法代码示例。如果您正苦于以下问题:Python ALModule类的具体用法?Python ALModule怎么用?Python ALModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ALModule类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

 def __init__(self, ip, port, _myBroker):
     ALModule.__init__(self, "BasicMotions")
     myBroker=_myBroker
     bModulePresent = myBroker.isModulePresent("BasicMotions")
     print("BasicMotions module status:", bModulePresent)
     self.tts = ALProxy("ALTextToSpeech")
     global memory
     memory = ALProxy("ALMemory")
     self.SubscribeAllTouchEvent()
     self.NAOip = ip
     self.NAOport = port
     self.createEyeGroup()
     self.eyeColor={'happy': 0x0000FF00,
                    'sad': 0x00600088,
                    'scared1': 0x00000060,
                    'scared2': 0x00000060,
                    'fear': 0x00000060,
                    'hope': 0x00FFB428,
                    'anger': 0x00FF0000}
     self.eyeShape={'happy': "EyeTop",
                    'sad': "EyeBottom",
                    'scared1': "EyeNone",
                    'scared2': "EyeNone",
                    'fear': "EyeBottom",
                    'hope': "EyeTop",
                    'anger': "EyeTopBottom"}
     self.bScared = False
开发者ID:thealexhong,项目名称:starship,代码行数:27,代码来源:BasicMotions.py


示例2: __init__

	def __init__(self, name):
		# 基类初始化
		ALModule.__init__(self, name)
		self.name = name		# 记录实例的名称;订阅事件时要用到;
		# ----------> 类成员变量 <----------
		# 为机器人头部三块触摸区域指定编码;
		# 		Head/Touch/Front	=1
		#		Head/Touch/Middle	=2
		#		Head/Touch/Rear		=3
		self.HEAD_FRONT = 1
		self.HEAD_MIDDLE = 2
		self.HEAD_REAR = 3
		# 密码序列,只有按照下面序列依次触摸机器人,才会通过验证;
		# 密码元素: 单个数字、字符;后面语音反馈,机器人需要念出密码元素;
		self.password = [1,3,2,3,1,2]
		# 记录用户的输入密码,最后用来与正确密码做比较;
		self.input_passwd = []
		# 验证标志, 输入正确密码会设置标志为True; 默认为False;
		self.verify_flag = False
		
		# naoqi.ALProxy
		try:
			# 语音反馈
			self.tts = ALProxy("ALTextToSpeech")
			# 触摸事件订阅
			self.memory = ALProxy("ALMemory")
		except Exception, e:
			print "Could not create proxy by ALProxy in Class MP3player"
			print "Error: ", e
开发者ID:axmtec0eric,项目名称:Nao-Robot,代码行数:29,代码来源:touch_password.py


示例3: __init__

    def __init__(self, name):
        """ Initialise module. 

        """
        ALModule.__init__(self, name)

        # Globals for proxies
        global touchProxy
        global memoryProxy

        self.rightHandFlag = False
        self.leftHandFlag = False
        
        self.subscriptionListRight = [
                                "HandRightBackTouched",
                                "HandRightLeftTouched",
                                "HandRightRightTouched"
                                ]

        self.subscriptionListLeft = [
                                "HandLeftBackTouched",
                                "HandLeftLeftTouched",
                                "HandLeftRightTouched"
                                ]
        
        # Setup proxies
        try:
            touchProxy = ALProxy("ALTouch")
        except Exception, e:
            print "Could not create proxy to ALTouch. Error: ", e            
开发者ID:mikemcfarlane,项目名称:TickleMeNAO,代码行数:30,代码来源:stop_by_holding_both_hands.py


示例4: __init__

 def __init__(self):
     ALModule.__init__(self, 'sensorModule')
     modules.append(self)
     self.memory = ALProxy('ALMemory')
     try:
         self.memory.subscribeToEvent("FrontTactilTouched",
                                      "sensorModule",
                                      "onTactilTouched")
         self.memory.subscribeToEvent("RearTactilTouched",
                                      "sensorModule",
                                      "onTactilTouched")
         self.memory.subscribeToEvent("HandLeftLeftTouched",
                                      "sensorModule",
                                      "onTactilTouched")
         self.memory.subscribeToEvent("HandLeftRightTouched",
                                      "sensorModule",
                                      "onTactilTouched")
         self.memory.subscribeToEvent("HandLeftBackTouched",
                                      "sensorModule",
                                      "onTactilTouched")
         self.memory.subscribeToEvent("HandRightLeftTouched",
                                      "sensorModule",
                                      "onTactilTouched")
         self.memory.subscribeToEvent("HandRightRightTouched",
                                      "sensorModule",
                                      "onTactilTouched")
         self.memory.subscribeToEvent("HandRightBackTouched",
                                      "sensorModule",
                                      "onTactilTouched")
     except Exception, e:
         print e
开发者ID:ISNJeanMace,项目名称:NAO-play-poker,代码行数:31,代码来源:nao.py


示例5: __init__

	def __init__(self, name, robot_controller, color="red", diameter=0.2):
		ALModule.__init__(self, name)
		self.name = name
		self.blobDetector = robot_controller.blobProxy
		if color == "red":
			pprint("Looking for a red ball...")
			self.blobDetector.setColor(*self.red)
		elif color == "blue":
			pprint("Looking for a blue ball...")
			self.blobDetector.setColor(*self.blue)
		elif color == "yellow":
			pprint("Looking for a yellow ball...")
			self.blobDetector.setColor(*self.yellow)
		else:
			pwrite(">> Warning << Invalid color set in BallDetector! ")
			print("Defaulting to red...")
			self.blobDetector.setColor(*self.red)
		self.blobDetector.setObjectProperties(20, diameter, "Circle")
		self.memoryProxy = robot_controller.memoryProxy
		self.memoryProxy.subscribeToEvent("ALTracker/ColorBlobDetected",
			self.name, "onBlobDetection")
		self.motionProxy = robot_controller.motionProxy
		self.camProxy = robot_controller.camProxy
		pprint("BallDetector initialized!")
		self.lock = threading.Lock()
		self.info = None
开发者ID:aearm,项目名称:NAOFindingObjects,代码行数:26,代码来源:NAOFindingObjects.py


示例6: __init__

    def __init__(self, name): #contructor of the class, which takes two parameters, self refers to the instance of the class and the name parameter which is just a string
        ALModule.__init__(self, name) #calling of the contructpor of the ALModule
        self.tts = ALProxy("ALTextToSpeech", ip, 9559) #proxy creation on the tts module
        self.asr = ALProxy("ALSpeechRecognition", ip, 9559) #proxy creation on the asr module
        self.memory = ALProxy("ALMemory", ip, 9559) #proxy creation on the memory module

        self.num1 = random.randint(1, 10) #here are two integers randomly selected from 1 to 10
        self.num2 = random.randint(1, 10)
        self.operator = random.choice("-") #here is randomly choosen operator which is then applied to the equation
        self.tts.setLanguage("English")  #set the the language which NAO uses for talking

        if self.operator == "-": #NAO was programmed to create equations which have a positive result
            if self.num1 > self.num2: #the numbers are compared in order to asure that the larger number is first
                self.result = str(eval(str(self.num1) + self.operator + str(self.num2))) #the result is evaluated and put into a string so NOA can say it
                self.operator = " minus " #and so is the operator
                self.question = "What is the result of " + str(self.num1) + self.operator + str(self.num2) + "?" #the question is created
            else:
                self.result = str(eval(str(self.num2) + self.operator + str(self.num1)))
                self.operator = " minus "
                self.question = "What is the result of " + str(self.num2) + self.operator + str(self.num1) + "?"
        else:
            self.result = str(eval(str(self.num1) + self.operator + str(self.num2)))
            self.operator = " plus "
            self.question = "What is the result of " + str(self.num1) + self.operator + str(self.num2) + "?"

        print self.question #the question is printed to the terminal
        print self.result #the reslt is printed to the terminal
        self.tts.say(self.question) #NAO tells the question
        self.speech_recognition() #the speech_recognition method is called
开发者ID:peterhalachan,项目名称:nao,代码行数:29,代码来源:TellTheResult.py


示例7: __init__

 def __init__(self, ip, port, publisher):
     
     # Get a (unique) name for naoqi module which is based on the node name
     # and is a valid Python identifier (will be useful later)
     self.naoqi_name = "ros" + rospy.get_name().replace("/", "_")
     
     #Start ALBroker (needed by ALModule)
     self.broker = ALBroker(self.naoqi_name + "_broker",
         "0.0.0.0",   # listen to anyone
         0,           # find a free port and use it
         ip,    # parent broker IP
         port   # parent broker port
         )
     
     #Init superclassALModule
     ALModule.__init__( self, self.naoqi_name )
     
     self.memory = ALProxy("ALMemory")
     self.proxy = ALProxy("ALSpeechRecognition")
     
     #Keep publisher to send word recognized
     self.pub = publisher
     
     #Install global variables needed by Naoqi
     self.install_naoqi_globals()
开发者ID:PHPDOTSQL,项目名称:nao_robot,代码行数:25,代码来源:nao_speech.py


示例8: __init__

	def __init__(self, name):
		ALModule.__init__(self, name)
		
		try:
			redBallDetectionProxy = ALProxy("ALRedBallDetection", NAO_IP, 9559)
		except Exception, e:
			print "Couldn't create proxy to ALRedBallDetection.\nError was:", e
开发者ID:Satantarkov,项目名称:NaoPFC,代码行数:7,代码来源:ball_position.py


示例9: __init__

 def __init__(self, name, memory):
     
     ALModule.__init__(self, name)
     self.__name = name;
     self.__memory = memory;
     self.__faceDetectedEvent = "FaceDetected";
     self.__faceDetectedFunction = "onFaceDetected";
     self.__pictureDetectedEvent = "PictureDetected";
     self.__pictureDetectedFunction = "onPictureDetected";
     self.__speechDetectedEvent = "SpeechDetected";
     self.__speechDetectedFunction = "onSpeechDetected";
     self.__wordRecognizedEvent = "WordRecognized";
     self.__onWordRecognizedFunction = "onWordRecognized";
     self.__lastWordRecognizedEvent = "LastWordRecognized";
     self.__onLastWordRecognizedFunction = "onLastWordRecognized";
     self.__handRightBackTouched = "HandRightBackTouched";
     self.__handRightLeftTouched = "HandRightLeftTouched";
     self.__handRightRightTouched = "HandRightRightTouched";
     self.__handLeftBackTouched = "HandLeftBackTouched";
     self.__handLeftLeftTouched = "HandLeftLeftTouched";
     self.__handLeftRightTouched = "HandLeftRightTouched";
     self.__frontTactilTouched = "FrontTactilTouched";
     self.__middleTactilTouched = "MiddleTactilTouched";
     self.__rearTactilTouched = "RearTactilTouched";
     self.__onTactileEventFunction = "onTactileEvent";
开发者ID:AdrienVR,项目名称:NaoSimulator,代码行数:25,代码来源:NaoEvent.py


示例10: __init__

	def __init__(self,name):
		ALModule.__init__(self, name)
		rospy.init_node('acore_state_server')
		self.moduleName = name
		self.connectNaoQi()
		self.startSubscriber()
		self.dataNamesList =   ["DCM/Time",
						"Device/SubDeviceList/InertialSensor/AngleX/Sensor/Value",
						"Device/SubDeviceList/InertialSensor/AngleY/Sensor/Value",
						"Device/SubDeviceList/InertialSensor/AngleZ/Sensor/Value",
						"Device/SubDeviceList/InertialSensor/GyroscopeX/Sensor/Value", 
						"Device/SubDeviceList/InertialSensor/GyroscopeY/Sensor/Value",
						"Device/SubDeviceList/InertialSensor/GyroscopeZ/Sensor/Value",
						"Device/SubDeviceList/InertialSensor/AccelerometerX/Sensor/Value",
						"Device/SubDeviceList/InertialSensor/AccelerometerY/Sensor/Value",
						"Device/SubDeviceList/InertialSensor/AccelerometerZ/Sensor/Value"]
		
		self.FSRdataList = ["Device/SubDeviceList/LFoot/FSR/FrontLeft/Sensor/Value",
							"Device/SubDeviceList/LFoot/FSR/FrontRight/Sensor/Value",
							"Device/SubDeviceList/LFoot/FSR/RearLeft/Sensor/Value",
							"Device/SubDeviceList/LFoot/FSR/RearRight/Sensor/Value",
							"Device/SubDeviceList/RFoot/FSR/FrontLeft/Sensor/Value",
							"Device/SubDeviceList/RFoot/FSR/FrontRight/Sensor/Value",
							"Device/SubDeviceList/RFoot/FSR/RearLeft/Sensor/Value",
							"Device/SubDeviceList/RFoot/FSR/RearRight/Sensor/Value"]
		self.MsgsInit()
开发者ID:rapp-project,项目名称:rapp-robot-nao,代码行数:26,代码来源:acore_state_server.py


示例11: __init__

    def __init__(self, name):
        ALModule.__init__(self, name)
        # No need for IP and port here because
        # we have our Python broker connected to NAOqi broker

        # HUE service
        self._hue = None
        self._teller = None

        # Create a proxy to ALTextToSpeech for later use
        global tts
        tts = ALProxy("ALTextToSpeech", NAO_IP, 9559)

        # Subscribe to the FaceDetected event:
        global memory
        self.leds = ALProxy("ALLeds", NAO_IP, 9559)
        memory = ALProxy("ALMemory")
        memory.subscribeToEvent("MiddleTactilTouched",
            "HumanGreeter",
            "onMiddleTouchSensed")
        # memory.unsubscribeToEvent("WordRecognized",
        #    "HumanGreeter")
        speechrecog = ALProxy("ALSpeechRecognition")
        speechrecog.setLanguage("French")
        wordList = ["bleu", "rouge", "vert", "jaune",
                    "porte", "température", "meteo"]

        try:
            speechrecog.setVocabulary(wordList, True)

        except Exception as ex:
            _logger.warning("Got exception: %s", ex)

        tts.say("Je suis prêt à recevoir des ordres")
开发者ID:WafaJohal,项目名称:demo-ipopo-nao,代码行数:34,代码来源:main.py


示例12: __init__

    def __init__(self, name):
        ALModule.__init__(self, name)

        self.memory = ALProxy("ALMemory")
        self.subscriptions = []

        print "... initialized " + self.getName()
开发者ID:kevywilly,项目名称:nao,代码行数:7,代码来源:nao_module.py


示例13: __init__

 def __init__(self, name):
     ALModule.__init__(self, name)
     try:
         self.asr = ALProxy("ALSpeechRecognition")
     except Exception as e:
         self.asr = None
     self.memory = ALProxy("ALMemory")
开发者ID:KatarzynaStudzinska,项目名称:ADlipiec,代码行数:7,代码来源:naos_speech_repo.py


示例14: __init__

    def __init__(self, name):
        ALModule.__init__(self, name)

        # Create proxies for the instance.
        global memory
        memory = ALProxy("ALMemory")

        self.tts = ALProxy("ALTextToSpeech")
        self.leds = ALProxy("ALLeds")
        self.motion = ALProxy("ALMotion")

        # Write empty valence and arousal values to memory.
        valence = 0
        arousal = 0
        param1 = 'null'
        current_emotion = [(valence, arousal), ("valence_mood", "arousal_mood"), ("personality"), (param1, "param2")]
        memory.insertData("Emotion/Current", current_emotion)

        # Disable ALAutonomousLife to better demonstrate emotional actions.
        self.autonomous_life = ALProxy("ALAutonomousLife")
        if (self.autonomous_life.getState() != "disabled"):
            self.autonomous_life.setState("disabled")
        time.sleep(1.0)
        self.motion.wakeUp()

        # Run behaviour when a tactile touched.
        memory.subscribeToEvent("VAChanged", self.getName(), "express_current_emotion")
开发者ID:Sandy4321,项目名称:nao-emotional-framework,代码行数:27,代码来源:standalone_emotional_demo.py


示例15: __init__

	def __init__(self, name):
		ALModule.__init__(self, name)
		self.name = name
		self.tts = ALProxy("ALTextToSpeech")
		self.posture = ALProxy("ALRobotPosture")
		self.memory = ALProxy("ALMemory")
		self.memory.subscribeToEvent("HandDetectedEvent", name, "handleDetection")
开发者ID:knawrot,项目名称:nao-objects-recognition,代码行数:7,代码来源:reaction.py


示例16: __init__

	def __init__(self, name):
		ALModule.__init__(self, name)
		self.name = name
		#self.tts = ALProxy("ALTextToSpeech")
		self.memory = ALProxy("ALMemory")
		self.motion = ALProxy("ALMotion")
		self.memory.subscribeToEvent("RedBallDetectedEvent", name, "handleBallDetection")
开发者ID:knawrot,项目名称:nao-objects-recognition,代码行数:7,代码来源:naoScript.py


示例17: _validate

    def _validate(self, context):
        """
        Component validated
        """
        _logger.debug("Validating speech...")

        # Register the module as a global in __main__
        constants.register_almodule(self._name, self)

        # Initialize the module
        ALModule.__init__(self, self._name)

        # Get the "memory" proxy, to register to callbacks
        self._memory = ALProxy("ALMemory")

        # Just to be sure...
        try:
            self._memory.unsubscribeToEvent("WordRecognized", self._name)
        except:
            _logger.debug("Speech wasn't yet registered")

        # Create the proxy
        self._recog = ALProxy("ALSpeechRecognition")
        self._recog.setLanguage("French")

        # We're ready
        self._can_recog.set()

        _logger.debug("Speech ready")
开发者ID:tcalmant,项目名称:demo-ipopo-nao,代码行数:29,代码来源:speech.py


示例18: __init__

    def __init__(self, name, state):
        ALModule.__init__(self, name)

        self.state = state

        self.leds = ALProxy("ALLeds")
        self.logs.display("Subscribed to an ALLeds proxy",
                          "Good")
开发者ID:NSenaud,项目名称:NaoChallengeProject,代码行数:8,代码来源:ihm.py


示例19: __init__

 def __init__(self, name, spelling):
     self.al = ALNetworkManager()
     self.tts = ALProxy("ALTextToSpeech", NAO_IP, 9559)
     self.memory = ALProxy("ALMemory")
     self.module_name = name
     self.spelling = spelling
     self.connected = False
     ALModule.__init__(self, name)
开发者ID:zaheerm,项目名称:naowificonnector,代码行数:8,代码来源:naowifi.py


示例20: __init__

 def __init__(self, name, event_root_path):
     ALModule.__init__(self, name)
     self.memory = ALProxy("ALMemory")
     self.name = name
     self.event_root_path = event_root_path
     self.status = "stop"
     self.status_handler = None
     self.subscribed_on_received_status = False
开发者ID:snakazawa,项目名称:qibluemix,代码行数:8,代码来源:memory.py



注:本文中的naoqi.ALModule类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python naoqi.ALProxy类代码示例发布时间:2022-05-27
下一篇:
Python naoqi.ALBroker类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap