欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

python实现nao机器人身体躯干和腿部动作操作

程序员文章站 2024-02-02 17:57:46
本文实例为大家分享了python实现nao机器人身体躯干和腿部动作的具体代码,供大家参考,具体内容如下 跟类似,代码没什么难度,可以进行扩展。 #-*-enco...

本文实例为大家分享了python实现nao机器人身体躯干和腿部动作的具体代码,供大家参考,具体内容如下

跟类似,代码没什么难度,可以进行扩展。

#-*-encoding:utf-8-*-
'''control nao's left foot,
  cartesian control:torso and foot trajectories
  '''
 
import sys
import motion
from naoqi import alproxy
 
def stiffnesson(proxy):
        pnmaes="body"
        pstiffnesslists=1.0
        ptimelists=1.0
        proxy.stiffnessinterpolation(pname,pstiffnesslists,ptimelists)
 
def main(robotip):
        '''example of cartesian foot trajectory
        '''
        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)
        #send nao to pose init
        postureproxy.gotoposture("standinit",0.5)
 
        space=motion .frame_robot
        axismask=almath.axis_mask_vel
        isabsolute=false
        path=[0.0,-0.07,-0.03,0.0,0.0,0.0]
        #lower the torso and move the size
        effector="torso"
        time=2.0
        motionproxy.positioninterpolation(effector,space,path,axismask,time,isabsolute)
 
        #lleg motion
        effector="lleg"
        path=[0.0,0.06,0.00,0.0,0.0,0.0]
        times=2.0
 
        motionproxy.positioninterpolation(effector,space,axismask,time,isabsolute)
        
if __name__=="__main__":
        robotip="127.0.0.1"
        if len(sys.argv)<=1:
               print "usage python robotip"
        else:
               robotip=sys.argv[1]
        main(robotip)

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