python控制控制nao机器人身体动作实例详解机器人身体动作实例详解
本文实例为大家分享了python控制nao机器人身体动作的具体代码,供大家参考,具体内容如下
今天读的代码,顺便写了出来,与文档的对比,差不多。
import sys
import motion
import almath
import naoqi from ALProxy
def StiffnessOn(proxy):
pName="Body"
pStiffnessLists
pTime=1.0
proxy.stiffnessInterpolation(pName,pStiffnessLists,pTime)
def main(robotIP):
try:
motionProxy=ALProxy("ALMotion",robotIP,9559)
except Exception,e:
print:"could not create a proxy!"
print:"error is ",e
try:
postureProxy=ALProxy("ALRobotPosture",robotIP,9559)
except Exception,e:
print:"could not create a proxy!"
print:"error is ",e
StiffnessOn(motionProxy)
postureProxy.goToPosture("StandInit",0.5)
space=motion.FRAME_ROBOT
coef=0.5
times=[coef,2.0*coef,3.0*coef,4.0*coef] isAbsolute=False
dy=+0.06
dz=-0.03
dwx==+0.30
effector="Torso"
path=[
[0.0,-dy,dz,-dwx,0.0,0.0],
[0.0,0.0,0.0,0.0,0.0,0.0],
[0.0,+dy,dz,+dwx,0.0,0.0],
[0.0,0.0,0.0,0.0,0.0,0.0] ]
axisMask=almath.AXIS_MASK_ALL
motionProxy.post.postionInterpolation(effector,space,path,times,isAbsolute)
#motion of arms with block process
axisMask=almath.AXIS_MASK_VEL
times=[1.0*coef,2.0*coef] dy=+0.03
effecor="RArm"
path=[
[0.0,dy,0.0,0.0,0.0,0.0],
[0.0,0.0,0.0,0.0,0.0,0.0] ] motionProxy.positionInterpolation(effector,space,path,axisMask,times,inAbsolute)
if __name__=="__main__":
robotIP="127.0.0.1"
if len(sys.argv)<=1:
print"useage default robotIP"
else:
robotIP=sys.arv[1] main(robotIP)
实例二,控制左右胳膊
#-*-encoding:UTF-8 -*-
评论0