最近重新学习nao的官方文档,写点简单的程序回顾一下。主要是用python调用api,写下来保存着。

'''Walk:small example to make nao walk'''
import sys
import motion
import time
from naoqi import ALProxy
def StiffnessOn(proxy):
 #we use the 'body' to signify the collection of all joints
 pName="Body"
 pStiffnessLists=1.0
 pTimeLists=1.0
 proxy.stiffnessInterpolation(pName,pStiffnessLists,pTimeLists)
 
 def main(robotIP):
  #init proxies
  try:
   motionProxy=ALProxy("ALMotion",robotIP,9559)
  except Exception,e:
   print "could not create proxy to ALMotion"
   print"error was",e
 
  try:
   postureProxy=ALProxy("ALRobotPosture",robotIP,9559)
  except Exception,e:
   print"could not create proxy to ALRobotPosture"
   print "error is ",e
 
   #set nao in stiffness on
   StiffnessOn(motionProxy)
 
   #send nao to pose init
   postureProxy.goToPosture("StandInit",0.5);
 
   #eable arms control by walk algorithm
   motionProxy.setWalkArmsEable(True,True)
   #foot contact protection
   motionProxy.setMotionConfig([["ENABLE_FOOT_CONTACT_PROTECTION",True]])
 
   #target velocity
   X=-0.5 #backward
   Y=0.0
   Theta=0.0
   Frequency=0.0#low speed
   motionProxy.setWalkTargetVelocity(X,Y.Theta,Frequency)
   time.sleep(4.0)
 
   #target velocity
   X=0.9
   Y=0.0
   Theta=0.0
   Frenqency=1.0#max speed
   motionProxy.setWalkTargetVelocity(X,Y,Theta,Frenquency)
   time.sleep(2.0)
 
   #arms user motion
   #arms motion from user have alwalys priority than walk arms motion
   JoinNames=["LShouderPitch","LShouderRoll","LElbowYaw","LElbowRoll"]
   Arm1=[-40,25,0,-40]
   Arm1=[x*motion.TO_RAD for x in Aram1]
   
   Arm2=[-40,50,0,-80]
   Arm2=[x*motion.TO_RAD for x in Aram2]
 
   pFractionMaxSpeed=0.6
 
   motionProxy.angleInterpolationWithSpeed(JoinNames,Arms1,pFractionMaxSpeed)
   motionProxy.angleInterpolationWithSpeed(JoinNames,Arms2,pFractionMaxSpeed)
   motionProxy.angleInterpolationWithSpeed(JoinNames,Arms1,pFractionMaxSpeed)
 
   #end walk
   X=0.0
   Y=0.0
   Theta=0.0
   motionProxy.setWalkTargetVelocity(X,Y,Theta,Frequency)
 
if __name__=="__main__":
 robotIP="192.168.1.155"
 if len(sys.argv)<=1:
  print "useage pyhton motion_walk.py robotIP,default is 127.0.0.1"
 else:
   robotIp=sys.argv[1]
 main(robotIP) 

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!

稳了!魔兽国服回归的3条重磅消息!官宣时间再确认!

昨天有一位朋友在大神群里分享,自己亚服账号被封号之后居然弹出了国服的封号信息对话框。

这里面让他访问的是一个国服的战网网址,com.cn和后面的zh都非常明白地表明这就是国服战网。

而他在复制这个网址并且进行登录之后,确实是网易的网址,也就是我们熟悉的停服之后国服发布的暴雪游戏产品运营到期开放退款的说明。这是一件比较奇怪的事情,因为以前都没有出现这样的情况,现在突然提示跳转到国服战网的网址,是不是说明了简体中文客户端已经开始进行更新了呢?