本文整理汇总了Python中naoqi.ALProxy.goToPosture方法的典型用法代码示例。如果您正苦于以下问题:Python ALProxy.goToPosture方法的具体用法?Python ALProxy.goToPosture怎么用?Python ALProxy.goToPosture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类naoqi.ALProxy
的用法示例。
在下文中一共展示了ALProxy.goToPosture方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: exe
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import goToPosture [as 别名]
def exe(self, args=None, addr=None):
# create proxy
postureProxy = ALProxy("ALRobotPosture", Settings.naoHostName, Settings.naoPort)
# stand up
postureProxy.goToPosture("Stand", 0.8)
示例2: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import goToPosture [as 别名]
def main(robotIP, PORT=9559):
''' Example showing a hand ellipsoid
Warning: Needs a PoseInit before executing
'''
motionProxy = ALProxy("ALMotion", robotIP, PORT)
postureProxy = ALProxy("ALRobotPosture", robotIP, PORT)
# Wake up robot
motionProxy.wakeUp()
# Send robot to Stand Init
postureProxy.goToPosture("StandInit", 0.5)
#tts = ALProxy("ALTextToSpeech", "192.168.2.17", 9559)
tts = ALProxy("ALTextToSpeech", "168.156.34.195", 9559)
tts.say("Hello, I'm going to move my left arm.")
tts.say("Then I will go back to the rest position!")
effector = "LArm"
frame = motion.FRAME_TORSO
axisMask = almath.AXIS_MASK_VEL # just control position
useSensorValues = False
path = []
currentTf = motionProxy.getTransform(effector, frame, useSensorValues)
# point 1
targetTf = almath.Transform(currentTf)
targetTf.r2_c4 -= 0.05 # y
path.append(list(targetTf.toVector()))
# point 2
targetTf = almath.Transform(currentTf)
targetTf.r3_c4 += 0.04 # z
path.append(list(targetTf.toVector()))
# point 3
targetTf = almath.Transform(currentTf)
targetTf.r2_c4 += 0.04 # y
path.append(list(targetTf.toVector()))
# point 4
targetTf = almath.Transform(currentTf)
targetTf.r3_c4 -= 0.02 # z
path.append(list(targetTf.toVector()))
# point 5
targetTf = almath.Transform(currentTf)
targetTf.r2_c4 -= 0.05 # y
path.append(list(targetTf.toVector()))
# point 6
path.append(currentTf)
times = [0.5, 1.0, 2.0, 3.0, 4.0, 4.5] # seconds
motionProxy.transformInterpolations(effector, frame, path, axisMask, times)
# Go to rest position
motionProxy.rest()
示例3: ReactionModule
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import goToPosture [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)
示例4: __init__
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import goToPosture [as 别名]
class Nao:
def __init__(self,ip,port):
self.tts = ALProxy("ALTextToSpeech", ip, port)
self.motion = ALProxy("ALMotion", ip, port)
self.posture = ALProxy("ALRobotPosture", ip, port)
self.memory = ALProxy("ALMemory")
self.speech = ALProxy("ALSpeechRecognition",ip,port)
#Word Recognition
self.speech.setLanguage("English")
wordList=["hello","goodbye","yes","no", "exit", "sit down"]
pythonModule.WordDetection(wordList)
def sit_down(self):
self.posture.goToPosture("Sit", 0.3)
time.sleep(0.5)
self.motion.setStiffnesses("Body", 0.3)
fractionMaxSpeed=0.1
self.motion.setAngles(["LArm"],[ 0.96, 0.03,-0.71,-1.20, 0.00, 0.30],fractionMaxSpeed)
self.motion.setAngles(["RArm"],[ 0.96,-0.05, 0.71, 1.20, 0.00, 0.30],fractionMaxSpeed)
self.motion.setAngles(["RLeg"],[-0.84,-0.30,-1.50, 1.02, 0.92, 0.00],fractionMaxSpeed)
self.motion.setAngles(["LLeg"],[-0.84, 0.30,-1.50, 1.02, 0.92, 0.00],fractionMaxSpeed)
time.sleep(0.5)
self.motion.setStiffnesses("Body", 0.0)
time.sleep(0.25)
def __del__(self):
示例5: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import goToPosture [as 别名]
def main(robotIP, PORT=9559):
motionProxy = ALProxy("ALMotion", robotIP, PORT)
postureProxy = ALProxy("ALRobotPosture", robotIP, PORT)
# Wake up robot
motionProxy.wakeUp()
# Send robot to Stand Zero
postureProxy.goToPosture("StandZero", 0.5)
# We use the "Body" name to signify the collection of all joints and actuators
#pNames = "Body"
# Get the Number of Joints
#numBodies = len(motionProxy.getBodyNames(pNames))
# We prepare a collection of floats
#pTargetAngles = [0.0] * numBodies
# We set the fraction of max speed
#pMaxSpeedFraction = 0.3
# Ask motion to do this with a blocking call
#motionProxy.angleInterpolationWithSpeed(pNames, pTargetAngles, pMaxSpeedFraction)
# Go to rest position
motionProxy.rest()
示例6: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import goToPosture [as 别名]
def main(ip, port):
motionProxy = ALProxy("ALMotion", ip, port)
postureProxy = ALProxy("ALRobotPosture", ip, port)
#Hodanje bez tocke optimuma
postureProxy.goToPosture("StandInit", 0.5)
functions.set_camera_angle(motionProxy, -15)
time.sleep(5)
"""
picture = 'pictures/stairs_nao.png'
theta_horizont = [89.5, 90.5]
theta_kose = [10, 25, 160, 165]
faktor_odbacivanja_linija = 8
faktor_osjetljivosti_stepenica = 70 # sto je majni faktor, to su osjetljivije
parametri_stepenica, tocke_3D = functions.image_processing(ip, port, picture, theta_horizont, theta_kose, faktor_odbacivanja_linija, faktor_osjetljivosti_stepenica)
functions.walking(motionProxy, parametri_stepenica[0][0][0]-0.3, 0, 0)
"""
climbing.main(motionProxy, postureProxy)
time.sleep(3)
motionProxy.rest()
示例7: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import goToPosture [as 别名]
def main(robotIP, PORT=9559):
motionProxy = ALProxy("ALMotion", robotIP, PORT)
postureProxy = ALProxy("ALRobotPosture", robotIP, PORT)
# Wake up robot
motionProxy.wakeUp()
# Send robot to Pose Init
postureProxy.goToPosture("StandInit", 0.5)
# Example showing how to get a simplified robot position in world.
useSensorValues = False
result = motionProxy.getRobotPosition(useSensorValues)
print "Robot Position", result
# Example showing how to use this information to know the robot's diplacement.
useSensorValues = False
initRobotPosition = almath.Pose2D(motionProxy.getRobotPosition(useSensorValues))
# Make the robot move
motionProxy.moveTo(0.1, 0.0, 0.2)
endRobotPosition = almath.Pose2D(motionProxy.getRobotPosition(useSensorValues))
# Compute robot's' displacement
robotMove = almath.pose2DInverse(initRobotPosition)*endRobotPosition
print "Robot Move:", robotMove
# Go to rest position
motionProxy.rest()
示例8: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import goToPosture [as 别名]
def main(robotIP, PORT=9559):
motionProxy = ALProxy("ALMotion", robotIP, PORT)
postureProxy = ALProxy("ALRobotPosture", robotIP, PORT)
# Wake up robot
motionProxy.wakeUp()
# Send robot to Stand Init
postureProxy.goToPosture("StandInit", 0.5)
# TARGET VELOCITY
X = 1.0
Y = 0.0
Theta = 0.0
Frequency = 1.0
# Defined a limp walk
try:
motionProxy.moveToward(X, Y, Theta,[["Frequency", Frequency],
# LEFT FOOT
["LeftStepHeight", 0.02],
["LeftTorsoWy", 5.0*almath.TO_RAD],
# RIGHT FOOT
["RightStepHeight", 0.005],
["RightMaxStepX", 0.001],
["RightMaxStepFrequency", 0.0],
["RightTorsoWx", -7.0*almath.TO_RAD],
["RightTorsoWy", 5.0*almath.TO_RAD]] )
except Exception, errorMsg:
print str(errorMsg)
print "This example is not allowed on this robot."
exit()
示例9: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import goToPosture [as 别名]
def main(robotIP, PORT=9559):
motionProxy = ALProxy("ALMotion", robotIP, PORT)
postureProxy = ALProxy("ALRobotPosture", robotIP, PORT)
# Wake up robot
motionProxy.wakeUp()
# Send robot to Stand Init
postureProxy.goToPosture("StandInit", 0.2)
x = 0.3
y = 0.0
theta = 0.0
# This example show customization for the both foot
# with all the possible gait parameters
try:
motionProxy.moveTo(x, y, theta,
[ ["MaxStepX", 0.02], # step of 2 cm in front
["MaxStepY", 0.16], # default value
["MaxStepTheta", 0.4], # default value
["MaxStepFrequency", 0.0], # low frequency
["StepHeight", 0.01], # step height of 1 cm
["TorsoWx", 0.0], # default value
["TorsoWy", 0.1] ]) # torso bend 0.1 rad in front
except Exception, errorMsg:
print str(errorMsg)
print "This example is not allowed on this robot."
exit()
示例10: __init__
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import goToPosture [as 别名]
class NaoBehavior:
naoip = ""
bhname = ""
def __init__(self,naoipaddress,behaviorName):
self.naoip = naoipaddress
self.bhname = behaviorName
self.nNB = ALProxy("ALBehaviorManager", self.naoip, 9559)
self.nposture = ALProxy("ALRobotPosture", self.naoip, 9559)
def lanuchAndStopBehavior(self):
if (self.nNB.isBehaviorInstalled(self.bhname)):
if (not self.nNB.isBehaviorRunning(self.bhname)):
self.nNB.post.runBehavior(self.bhname)
time.sleep(5)
else:
print "Behavior is already running"
else:
print "Behavior is not found"
return
names = self.nNB.getRunningBehaviors()
print "Running behaviors:"
self.nposture.goToPosture("Stand", 0.5)
print names
if (self.nNB.isBehaviorRunning(self.bhname)):
self.nNB.stopBehavior(self.bhname)
time.sleep(1.0)
else:
print "Behavior is already stopped."
names = self.nNB.getRunningBehaviors()
print "Running behaviors:"
print names
示例11: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import goToPosture [as 别名]
def main(robotIP, PORT=9559):
''' Example showing a path of two positions
Warning: Needs a PoseInit before executing
'''
motionProxy = ALProxy("ALMotion", robotIP, PORT)
postureProxy = ALProxy("ALRobotPosture", robotIP, PORT)
# Wake up robot
motionProxy.wakeUp()
# Send robot to Stand Init
postureProxy.goToPosture("StandInit", 0.5)
tts = ALProxy("ALTextToSpeech", "192.168.2.17", 9559)
tts.say("I'm going to extend my left arm.")
moveArm(motionProxy, "LArm")
tts.say("Now I'm going to extend my right arm.")
moveArm(motionProxy, "RArm")
tts.say("Then I will go back to the rest position!")
# Go to rest position
motionProxy.rest()
示例12: init
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import goToPosture [as 别名]
def init(IP,PORT):
global motionProxy
global tts
global post
global sonarProxy
global memoryProxy
global cameraProxy
global videoClient
post = ALProxy("ALRobotPosture", IP, PORT)
tts = ALProxy("ALTextToSpeech", IP, PORT)
motionProxy = ALProxy("ALMotion", IP, PORT)
cameraProxy = ALProxy("ALVideoDevice", IP, PORT)
# init video
resolution = 0 # 0 : QQVGA, 1 : QVGA, 2 : VGA
colorSpace = 11 # RGB
camNum = 0 # 0:top cam, 1: bottom cam
fps = 1; # frame Per Second
cameraProxy.setParam(18, camNum)
try:
videoClient = cameraProxy.subscribe("python_client",
resolution, colorSpace, fps)
except:
cameraProxy.unsubscribe("python_client")
videoClient = cameraProxy.subscribe("python_client",
resolution, colorSpace, fps)
print "Start videoClient: ",videoClient
sonarProxy = ALProxy("ALSonar", IP, PORT)
sonarProxy.subscribe("myApplication")
memoryProxy = ALProxy("ALMemory", IP, PORT)
post.goToPosture("Crouch", 1.0)
time.sleep(2)
示例13: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import goToPosture [as 别名]
def main(robotIP, PORT=9559):
motionProxy = ALProxy("ALMotion", robotIP, PORT)
postureProxy = ALProxy("ALRobotPosture", robotIP, PORT)
# Wake up robot
motionProxy.wakeUp()
# Send robot to Stand Init
postureProxy.goToPosture("StandInit", 0.5)
# Initialize the walk process.
# Check the robot pose and take a right posture.
# This is blocking called.
motionProxy.moveInit()
# TARGET VELOCITY
X = 1.0
Y = 0.0
Theta = 0.0
Frequency = 1.0
# Default walk (MaxStepX = 0.04 m)
try:
motionProxy.moveToward(X, Y, Theta, [["Frequency", Frequency]])
except Exception, errorMsg:
print str(errorMsg)
print "This example is not allowed on this robot."
exit()
示例14: MoveAction_MoveFor
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import goToPosture [as 别名]
def MoveAction_MoveFor(robotIP, PORT=9559):
# 前进
motionProxy = ALProxy("ALMotion", robotIP, PORT)
postureProxy = ALProxy("ALRobotPosture", robotIP, PORT)
# Send robot to Stand
postureProxy.goToPosture("StandInit", 0.5)
#####################
## Enable arms control by Motion algorithm
#####################
motionProxy.setMoveArmsEnabled(True, True)
# motionProxy.setMoveArmsEnabled(False, False)
#####################
## FOOT CONTACT PROTECTION
#####################
#motionProxy.setMotionConfig([["ENABLE_FOOT_CONTACT_PROTECTION", False]])
motionProxy.setMotionConfig([["ENABLE_FOOT_CONTACT_PROTECTION", True]])
#TARGET VELOCITY
X = 0.8
Y = 0.0
Theta = 0.0
Frequency =1.0 # max speed
try:
motionProxy.moveToward(X, Y, Theta, [["Frequency", Frequency]])
except Exception, errorMsg:
print str(errorMsg)
print "This example is not allowed on this robot."
exit()
示例15: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import goToPosture [as 别名]
def main(robotIP, robotPort):
""" Example showing a path of two positions
Warning: Needs a PoseInit before executing
"""
# Init proxies.
try:
global motionProxy
motionProxy = ALProxy("ALMotion", robotIP, robotPort)
except Exception as e:
print("Could not create proxy to ALMotion \n Error was : ", e)
try:
postureProxy = ALProxy("ALRobotPosture", robotIP, robotPort)
except Exception as e:
print("Could not create proxy to ALRobotPosture")
print("Error was: ", e)
# Set NAO in Stiffness On
StiffnessOn(motionProxy)
# Send NAO to Pose Init
postureProxy.goToPosture("StandInit", 0.5)
customInit(robotIP)
try:
sayProxy = ALProxy("ALTextToSpeech", robotIP, robotPort)
ledProxy = ALProxy("ALLeds", robotIP, robotPort)
except Exception as e:
print("Could not create proxy to ALRobotPosture")
print("Error was: ", e)
hangmanInit.playGame(sayProxy, ledProxy, motionProxy)