本文整理汇总了Python中naoqi.ALProxy.getPostureFamily方法的典型用法代码示例。如果您正苦于以下问题:Python ALProxy.getPostureFamily方法的具体用法?Python ALProxy.getPostureFamily怎么用?Python ALProxy.getPostureFamily使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类naoqi.ALProxy
的用法示例。
在下文中一共展示了ALProxy.getPostureFamily方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ReactionModule
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getPostureFamily [as 别名]
class ReactionModule(ALModule):
""" A basic module to test events """
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")
def handleDetection(self, key, value, message):
""" A method that handles detection of the ball. """
self.memory.unsubscribeToEvent("HandDetectedEvent", self.name)
if value == 0 and self.posture.getPostureFamily() != "Sitting":
self.posture.goToPosture("Sit", 1.0)
elif value == 1 and self.posture.getPostureFamily() != "Standing":
self.posture.goToPosture("Stand", 1.0)
self.memory.subscribeToEvent("HandDetectedEvent", self.name, "handleDetection")
def disconnect(self):
try:
self.memory.unsubscribeToEvent("HandDetectedEvent", self.getName())
except BaseException, err:
print "Error while disconnecting from gesture reaction module: " + str(err)
示例2: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getPostureFamily [as 别名]
def main(robotIP, PORT=9559):
# tts = ALProxy("ALTextToSpeech", robotIP, PORT)
# tts.post.say("看,我要坐下了.")
# alBehaviorManager = ALProxy("ALBehaviorManager", robotIP, PORT)
# alBehaviorManager.getRunningBehaviors ()
# alBehaviorManager.stopAllBehaviors ()
postureProxy = ALProxy("ALRobotPosture", robotIP, 9559)
postureProxy.post.goToPosture("Sit", 0.8)
# postureProxy.post.goToPosture("SitRelax", 0.8)
print postureProxy.getPostureFamily()
示例3: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getPostureFamily [as 别名]
def main(robotIP, PORT=9559):
# 连环动作
postureProxy = ALProxy("ALRobotPosture", robotIP, 9559)
postureProxy.goToPosture("StandInit", 0.8)
postureProxy.goToPosture("SitRelax", 0.8)
postureProxy.goToPosture("StandZero", 0.8)
postureProxy.goToPosture("LyingBelly", 0.8)
postureProxy.goToPosture("LyingBack", 0.8)
postureProxy.goToPosture("Stand", 0.8)
postureProxy.goToPosture("Crouch", 0.8)
postureProxy.goToPosture("Sit", 0.8)
print postureProxy.getPostureFamily()
示例4: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getPostureFamily [as 别名]
def main(IP, PORT=9559):
# Declare the proxies we will be using
atts = ALProxy("ALAnimatedSpeech", IP, PORT)
motion = ALProxy("ALMotion", IP, PORT)
proxyPosture = ALProxy("ALRobotPosture", IP, PORT)
# Wake up the robot to make it able to move (enable the motors)
motion.wakeUp()
# Configure the body language
configuration = {"bodyLanguageMode":"contextual"}
# Text to be read
atts.say("Bonjour, je vais te raconter l'histoire du vieux grand-père.\\pau=1500\\")
atts.say("\\rspd=90\\Il était une fois un pauvre homme bien vieux, \\pau=200\\qui avait les yeux trouble, \\pau=200\\"\
"l’oreille dure et les genoux tremblants. \\pau=600\\Quand il était à table,\\pau=200\\ il pouvait à peine tenir "\
"sa cui yère ;\\pau=450\\ il reaipandait de la soupe sur la nappe,\\pau=200\\ et quelquefois mème en laissait échapper "\
"de sa bouche.\\pau=600\\ La femme de son fils,\\pau=200\\ et son fils lui-mème en avaient pris un grand \\rspd=85\\daigoût, \\pau=200\\"\
"\\rspd=100\\et à la fin ils le reléguaire dans un coin derrière le poil, \\pau=200\\ où ils lui donnaient à manger une "\
"chaitive pitance dans une vieille écuelle de terre.\\pau=600\\ Le vieillard avaient souvent les larmes aux yeux,\\pau=200\\ "\
"et regardait tristement du coter de la table...\\pau=800\\", configuration)
atts.say("\\rspd=90\\Un jour, \\pau=200\\ l'écuelle,\\pau=200\\ que tenaient mal ses mains tremblantes,\\pau=200\\ tomba À terre et se brisa."\
"\\pau=600\\La jeune femme s'emporta en reproches:\\pau=400\\ il n'osa rien répondre et baissa la tête en soupirant.\\pau=600\\"\
"On lui \\rspd=90\\acheuta \\rspd=100\\ pour deux liards une écuelle de bois dans laquelle désormais on lui donnait à manger."\
"\\pau=800\\", configuration)
atts.say("\\rspd=90\\Quelques jours après,\\pau=200\\ son fils et sa belle-fille virent leur enfant qui avait quatre ans,\\pau=200\\ occupé \\pau=120\\"\
"à assembler par terre de petites planchettes.\\pau=600\\ \\rspd=95\\ \\vct=70\\Que fais-tu là ?\\vct=100\\ \\rspd=100\\ Demanda "\
"son père.\\pau=600\\ \\vct=150\\C'est un auget, \\pau=200\\ \\vct=100\\ répondit l'enfant,\\pau=200\\ \\vct=150\\pour donner À manger "\
"à papa et \\rspd=85\\maman quand ils seront vieux.\\vct=100\\ \\pau=800\\", configuration)
atts.say("\\rspd=90\\Le mari et la femme se regardère un instant sans rien dire,\\pau=200\\ puis ils se mirent à pleurer, \\pau=200\\ reprirent le "\
"vieux grand-père à table,\\pau=200\\ et désormais le firent toujours manger à table avec eux,\\pau=200\\ sans plus jamais le rudoyer.", configuration)
# Get the current posture of the robot
posture = proxyPosture.getPostureFamily()
# Set the robot to a 'Standard posture'
if posture == "Standing":
proxyPosture.goToPosture("Stand", 0.5)
else:
proxyPosture.goToPosture("Sit", 0.5)
# Make it rest (disable the motors)
motion.rest()
print("done \n")
示例5: Motion
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getPostureFamily [as 别名]
#.........这里部分代码省略.........
#self.update_battery()
# Reads the file ip_and_name and puts in a temporay list the first line of the txt which is the ip address of the robot
# Then according this value of the first line two conditions are checked.
# If the value equals to Discconeccted then a message is thrown and warns the user which action has to follow.
# If the value is a proper IP address then imports naoqi library,creates all the modules that will be used from the robot
# and changes the values of some variables.
def connection(self):
filein = open("ip_and_name.txt", "r")
temporary_list = filein.readlines()
temporary_list = [lines.rstrip() for lines in temporary_list]
self.ip.set(temporary_list[0])
#The file that has been opened for reading closes here
filein.close()
try:
# Import naoqi library and creates all the relevant modules that will be used within the class
from naoqi import ALProxy
self.memory = ALProxy("ALMemory", self.ip.get() , 9559)
self.memory.ping()
self.tts = ALProxy("ALTextToSpeech", self.ip.get() , 9559)
self.motion = ALProxy("ALMotion", self.ip.get() , 9559)
self.posture = ALProxy("ALRobotPosture", self.ip.get(), 9559)
self.speechrec = ALProxy("ALSpeechRecognition", self.ip.get() , 9559)
self.battery = ALProxy("ALBattery", self.ip.get() , 9559)
# Sets the position of the robot variable according the value is returned from the getpostureFamily method
# Enables both arms of the robot
# Initializes the command origin variable by setting the value to 0
self.robot_position.set(self.posture.getPostureFamily())
self.arms_status = self.motion.getWalkArmsEnabled()
self.command_origin.set(0)
# Set the stifness of all the joints of the robot to 1.0
# imports the words declared at the beginning of the class into the momory's vocabulary of the robot
self.motion.setStiffnesses("Body", 1.0)
except BaseException:
self.turn_left_bt.config(state="disabled")
self.turn_right_bt.config(state="disabled")
self.move_left_bt.config(state="disabled")
self.move_right_bt.config(state="disabled")
self.move_back_bt.config(state = "disabled")
self.move_forward_bt.config(state = "disabled")
self.sit_down_bt.config(state="disabled")
self.stand_up_bt.config(state="disabled")
self.crouch_bt.config(state="disabled")
self.stop_conversation_bt.config(state="disabled")
self.start_conversation_bt.config(state="disabled")
tkMessageBox.showwarning("Error - Nao is Disconnected", " You haven't\n connected NAO.\n\n"
"1) Go to 'How to connect Nao' on the main panel to see a guide about how NAO has to be connected")
return
# Checks initially the position of the robot and then acts according to conditions.
# if robot is sitting down a voice message from the robot informs the user that he is going to stand up straight away.
示例6: ALProxy
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getPostureFamily [as 别名]
from naoqi import ALProxy
import sys
posture = sys.argv[1]
postureProxy = ALProxy('ALRobotPosture','localhost',9559)
postureProxy.goToPosture(posture, 1.0)
print postureProxy.getPostureFamily()
示例7: ALProxy
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getPostureFamily [as 别名]
#-*- coding: utf-8 -*-
from naoqi import ALProxy
# ----------> Connect to robot <----------
robot_ip = "192.168.1.100"
robot_port = 9559 # default port : 9559
postureProxy = ALProxy("ALRobotPosture", robot_ip, robot_port)
# ----------> Set Posture <----------
postureProxy.goToPosture("StandInit", 1.0)
# std::string ALRobotPostureProxy::getPosture()
# Returns the name of the current predefined postures.
# If the current posture is not in the predefined postures, it returns “Unknown”.
print "posture:", postureProxy.getPosture()
# Nao Robot H25, 支持的预设姿势
postureProxy.goToPosture("SitRelax", 1.0)
postureProxy.goToPosture("StandZero", 1.0)
postureProxy.goToPosture("LyingBelly", 1.0)
postureProxy.goToPosture("LyingBack", 1.0)
postureProxy.goToPosture("Stand", 1.0)
postureProxy.goToPosture("Crouch", 1.0)
postureProxy.goToPosture("Sit", 1.0)
print "posture list:", postureProxy.getPostureList()
print "robot posture family[now]:", postureProxy.getPostureFamily()
示例8: __init__
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import getPostureFamily [as 别名]
#.........这里部分代码省略.........
self.memory = ALProxy("ALMemory", self.ip.get(), 9559)
self.memory.ping()
self.tts = ALProxy("ALTextToSpeech", self.ip.get(), 9559)
self.motion = ALProxy("ALMotion", self.ip.get(), 9559)
self.posture = ALProxy("ALRobotPosture", self.ip.get(), 9559)
self.speechrec = ALProxy("ALSpeechRecognition", self.ip.get(), 9559)
# self.stop_bt.config(state = "disabled")
except BaseException:
self.ip.set("Disconnected")
self.speak_bt.config(state="disabled")
self.stop_bt.config(state="disabled")
tkMessageBox.showwarning(
"Error - Nao is Disconnected",
" You haven't\n connected NAO.\n\n"
"1) Go to 'How to connect Nao' on the main panel to see a guide about how NAO has to be connected",
)
return
# Opens a url address everytime is called
def open_url(self, url):
webbrowser.open(url)
# When is called opens a dialog window between the user and the robot that lasts 3 seconds.During that time the robot listens
# the words that the user says ,retrieves from memory the list of the predefined words given at the beginning and
# with the help of the getMostConfWord method acts in a different way every time depending on the word has been received.
# At the beggining of the dialog robot speaks to the user and informs him that is ready to accept any words want to provide.
def start_vocabulary(self):
# Imports the words declared at the beginning of the class into the momory's vocabulary of the robot
self.speechrec.setVocabulary(self.vocabulary, True)
if self.posture.getPostureFamily() == "Sitting":
self.posture.goToPosture("Stand", 0.8)
else:
pass
if (self.speech_counter) == True:
self.tts.say("Hello everyone.My name is" + self.robot_name.get())
self.read_text_info("intro_message.txt")
else:
pass
while self.speech_counter == True:
self.speechrec.subscribe("tts")
print("subscribed")
time.sleep(4)
list = self.memory.getData("WordRecognized")
self.getMostConfWord(list, 0.30)
self.speechrec.unsubscribe("tts")
print("unsubscribed")
else:
self.tts.say(
"You have selected to stop the induction to the lab.Thank you very much for your time today.Anytime you want any information about the lab don't hesitate to come back.Bye bye and I will see you next time"
)
pass
return
# Selects the word with the highest level of confidentiality from a list of predefined
# words (that has been set at initialization) when users speaks to the robot.
def getMostConfWord(self, recogList, threshold):
# Declaration of local variables used within the method
i = 0