python机器人开发(python程序控制NAO机器人行走)
类别:脚本大全 浏览量:2312
时间:2021-10-13 00:38:21 python机器人开发
python程序控制NAO机器人行走最近重新学习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) |
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持开心学习网。
原文链接:https://blog.csdn.net/u011181878/article/details/21048959
您可能感兴趣
- python3函数的使用方法(Python3.5基础之函数的定义与使用实例详解参数、作用域、递归、重载等)
- python解析视频源码(基于python实现高速视频传输程序)
- python数字形式转换详解(Python3.5实现的罗马数字转换成整数功能示例)
- python怎么表示矩阵转置(Python实现的矩阵转置与矩阵相乘运算示例)
- python怎么自动刷抖音(python实现抖音点赞功能)
- pythonselenium自动化教程(python使用selenium实现批量文件下载)
- python基础编程函数参数(详解Python 函数如何重载?)
- python中怎样使用列表的sort方法(详解python中sort排序使用)
- python设置微信(利用python实现在微信群刷屏的方法)
- 怎么python爬取网页图片(详解Python静态网页爬取获取高清壁纸)
- python udp网络编程(python实现一个简单的udp通信的示例代码)
- python正则表达式入门(Python正则表达式实现简易计算器功能示例)
- python获取网关ip地址(python实现扫描局域网指定网段ip的方法)
- pythonindex函数用法(python sort、sort_index方法代码实例)
- python编写pygame游戏怎么打包(python使用pygame模块实现坦克大战游戏)
- python的几种数据结构(python中的数据结构比较)
- 吴启华与曾舜晞两代张无忌同框,戏里经典的他却没活出原著的潇洒(吴启华与曾舜晞两代张无忌同框)
- 经常发这三种 朋友圈 的人,要迅速屏蔽(经常发这三种朋友圈)
- 有种尴尬叫朋友圈忘屏蔽,大学生上演社死现场,父母亲自下场吐槽(有种尴尬叫朋友圈忘屏蔽)
- 朋友圈屏蔽你的人,可以直接看淡了(朋友圈屏蔽你的人)
- 金球奖只青睐那些会戴珠宝的女人(金球奖只青睐那些会戴珠宝的女人)
- 浙江省一个县,人口超40万,建县历史超1100年(浙江省一个县人口超40万)
热门推荐
- mysql索引为什么是b+树(mysql 使用B+树索引有哪些优势)
- mysql中date_format日期格式化
- linux部署tomcat项目(阿里云服务器linux系统搭建Tomcat部署Web项目)
- mysqljoin默认是什么(mysql-joins具体用法说明)
- C#常用的命名规范
- wxpython 弹出对话框显示图片(WxPython建立批量录入框窗口)
- sqlserver如何添加数据库(sqlserver建立新用户及关联数据库教程)
- php上传文件的要求(PHP 文件上传限制问题)
- vue项目打包上线的方法(vue项目打包以及优化的实现步骤)
- 如何正常查看mysql存储数据文件(Mysql文件存储图文详解)
排行榜
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9