gpt4 book ai didi

python程序控制NAO机器人行走

转载 作者:qq735679552 更新时间:2022-09-28 22:32:09 28 4
gpt4 key购买 nike

CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.

这篇CFSDN的博客文章python程序控制NAO机器人行走由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.

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

?
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
'''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)

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

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

最后此篇关于python程序控制NAO机器人行走的文章就讲到这里了,如果你想了解更多关于python程序控制NAO机器人行走的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com