您的位置:首页 > 脚本大全 > > 正文

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

更多 时间:2021-10-12 00:25:05 类别:脚本大全 浏览量:597

python用于机器人

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

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

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

  • ?
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • #-*-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)
  • 以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持开心学习网。

    原文链接:https://blog.csdn.net/u011181878/article/details/21392629

    标签:Python 机器人 NAO
    您可能感兴趣