本文整理汇总了Python中naoqi.ALProxy.wakeUp方法的典型用法代码示例。如果您正苦于以下问题:Python ALProxy.wakeUp方法的具体用法?Python ALProxy.wakeUp怎么用?Python ALProxy.wakeUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类naoqi.ALProxy
的用法示例。
在下文中一共展示了ALProxy.wakeUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import wakeUp [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()
示例2: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import wakeUp [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()
示例3: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import wakeUp [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()
示例4: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import wakeUp [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()
示例5: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import wakeUp [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
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.5 # backward
Y = 0.0
Theta = 0.0
Frequency =0.0 # low 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()
示例6: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import wakeUp [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()
示例7: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import wakeUp [as 别名]
def main(IP, PORT, faceSize):
print "Connecting to", IP, "with port", PORT
motion = ALProxy("ALMotion", IP, PORT)
tracker = ALProxy("ALTracker", IP, PORT)
# First, wake up.
motion.wakeUp()
# Add target to track.
targetName = "Face"
faceWidth = faceSize
tracker.registerTarget(targetName, faceWidth)
# Then, start tracker.
tracker.track(targetName)
print "ALTracker successfully started, now show your face to robot!"
print "Use Ctrl+c to stop this script."
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
print
print "Interrupted by user"
print "Stopping..."
# Stop tracker.
tracker.stopTracker()
tracker.unregisterAllTargets()
motion.rest()
print "ALTracker stopped."
示例8: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import wakeUp [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()
示例9: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import wakeUp [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()
示例10: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import wakeUp [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)
effector = "LArm"
frame = motion.FRAME_TORSO
axisMask = almath.AXIS_MASK_VEL # just control position
useSensorValues = False
path = []
currentTf = motionProxy.getTransform(effector, frame, useSensorValues)
targetTf = almath.Transform(currentTf)
targetTf.r1_c4 += 0.03 # x
targetTf.r2_c4 += 0.03 # y
path.append(list(targetTf.toVector()))
path.append(currentTf)
# Go to the target and back again
times = [2.0, 4.0] # seconds
motionProxy.transformInterpolations(effector, frame, path, axisMask, times)
# Go to rest position
motionProxy.rest()
示例11: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import wakeUp [as 别名]
def main():
""" Simple code to test above motion data. """
# Choregraphe simplified export in Python.
from naoqi import ALProxy
from pprint import pprint
names = list()
times = list()
keys = list()
leftArmMovementList = [leftArmMovementList0, leftArmMovementList1, leftArmMovementList2, leftArmMovementList3]
choice = 2
for n, t, k in leftArmMovementList[1]:
names.append(n)
times.append(t)
keys.append(k)
try:
# uncomment the following line and modify the IP if you use this script outside Choregraphe.
IP = "mistcalf.local"
motion = ALProxy("ALMotion", IP, 9559)
posture = ALProxy("ALRobotPosture", IP, 9559)
motion.wakeUp()
posture.goToPosture("StandInit", 0.8)
# motion = ALProxy("ALMotion")
motion.angleInterpolation(names, keys, times, True)
posture.goToPosture("Crouch", 0.8)
motion.rest()
except BaseException, err:
print err
开发者ID:mikemcfarlane,项目名称:TickleMeNAO,代码行数:36,代码来源:python_motion_data_export_from_Choregraph_inc_run_code.py
示例12: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import wakeUp [as 别名]
def main(robotIP, PORT=9559):
motionProxy = ALProxy("ALMotion", robotIP, PORT)
# Wake up robot
motionProxy.wakeUp()
# motionProxy.moveInit()
# Example showing the use of moveToward
# The parameters are fractions of the maximums
# Here we are asking for full speed forwards, 即x = 1.0
x = 1.0
y = 0.0
theta = 0.0
frequency = 1.0
motionProxy.moveToward(x, y, theta, [["Frequency", frequency]])
# If we don't send another command, he will move forever
# Lets make him slow down(step length) and turn after 3 seconds
time.sleep(3) # 延时3秒运动
x = 0.5
theta = 0.6
motionProxy.moveToward(x, y, theta, [["Frequency", frequency]])
# Lets make him slow down(frequency) after 3 seconds
time.sleep(3)
frequency = 0.5 # 频率1为最快, 0.5表示50%的频率运动
motionProxy.moveToward(x, y, theta, [["Frequency", frequency]])
# Lets make him stop after 3 seconds
time.sleep(3)
motionProxy.stopMove()
# 详细的Move Config配置
##################################
#
# 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()
示例13: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import wakeUp [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)
###############################
# First we defined each step
###############################
footStepsList = []
# 1) Step forward with your left foot
footStepsList.append([["LLeg"], [[0.06, 0.1, 0.0]]])
# 2) Sidestep to the left with your left foot
footStepsList.append([["LLeg"], [[0.00, 0.16, 0.0]]])
# 3) Move your right foot to your left foot
footStepsList.append([["RLeg"], [[0.00, -0.1, 0.0]]])
# 4) Sidestep to the left with your left foot
footStepsList.append([["LLeg"], [[0.00, 0.16, 0.0]]])
# 5) Step backward & left with your right foot
footStepsList.append([["RLeg"], [[-0.04, -0.1, 0.0]]])
# 6)Step forward & right with your right foot
footStepsList.append([["RLeg"], [[0.00, -0.16, 0.0]]])
# 7) Move your left foot to your right foot
footStepsList.append([["LLeg"], [[0.00, 0.1, 0.0]]])
# 8) Sidestep to the right with your right foot
footStepsList.append([["RLeg"], [[0.00, -0.16, 0.0]]])
###############################
# Send Foot step
###############################
stepFrequency = 0.8
clearExisting = False
nbStepDance = 2 # defined the number of cycle to make
for j in range( nbStepDance ):
for i in range( len(footStepsList) ):
try:
motionProxy.setFootStepsWithSpeed(
footStepsList[i][0],
footStepsList[i][1],
[stepFrequency],
clearExisting)
except Exception, errorMsg:
print str(errorMsg)
print "This example is not allowed on this robot."
exit()
示例14: TestModule
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import wakeUp [as 别名]
class TestModule(ALModule):
"""A module used for testing Nao's functionality"""
def __init__(self, var_name):
"""Define the module's attributes and initialize their value"""
# Request the parent module to initialize and register the module
ALModule.__init__(self, var_name)
# Declare the memory
global memory
memory = ALProxy("ALMemory")
# Initialize a motion module
self.motion = ALProxy("ALMotion")
# Initialize a posture module
self.posture = ALProxy("ALRobotPosture")
def initialize(self):
"""Initialize the inner modules of the module"""
# Wake the robot up
self.motion.wakeUp()
# Enable the whole body motion
self.motion.wbEnable(True)
def shutdown(self):
"""Shut the module down gracefully"""
# Disable the whole body motion
self.motion.wbEnable(False)
# Put the robot to rest
self.motion.rest()
def kick(self):
"""Define the procedure to follow to accomplish a kick"""
# Go to stand init posture
self.posture.goToPosture("StandInit", 0.5)
# Define the joints we are interested in
hip_joints = ["RHipRoll", "LHipRoll"]
# Get the angles for HipRolls
angles = self.motion.getAngles(hip_joints, True)
# Modify the value of the hip rolls
angles[0] -= 10 * almath.TO_RAD
angles[1] += 10 * almath.TO_RAD
# Set the angles to have Nao stand on one foot
self.motion.setAngles(hip_joints, angles, 0.2)
# Wait for some time
sleep(5)
# Go back to stand init posture
self.posture.goToPosture("StandInit", 0.5)
示例15: main
# 需要导入模块: from naoqi import ALProxy [as 别名]
# 或者: from naoqi.ALProxy import wakeUp [as 别名]
def main(robotIP, PORT = 9559, steps=1):
motionProxy = ALProxy("ALMotion", robotIP, PORT)
postureProxy = ALProxy("ALRobotPosture", robotIP, PORT)
motionProxy.wakeUp()
postureProxy.goToPosture("StandInit", 0.5)
motionProxy.setMoveArmsEnabled(True, True)
motionProxy.setExternalCollisionProtectionEnabled("All", False)
motionProxy.moveTo(steps / 4.0, 0, 0) # X, Y, Theta