python自动计算机器人(python实现nao机器人手臂动作控制)
类别:脚本大全 浏览量:468
时间:2021-10-13 00:46:53 python自动计算机器人
python实现nao机器人手臂动作控制本文实例为大家分享了python实现nao机器人手臂动作的具体代码,供大家参考,具体内容如下
这些天依然在看nao公司文档的东西,把读过的代码顺手敲了出来。代码依然很简单,但是为什么我要写博客呢?这其中有很大的原因在于,代码是死的,可是读着读着就感觉代码活了,而且,每次读都会有不同的感受。咱就直接看正题吧。
|
#-*-encoding:utf-8-*- import sys import motion import almath from naoqi import alproxy def stiffnesson(proxy): #we use the body name to signify the collection of all jionts pname = "body" pstiffnesslists = 1.0 ptimelists = 1.0 proxy.stiffnessinterpolation(pname,pstiffnesslists,ptimelists) def main(robotip): ''' example showing a path of two position ''' try : motionproxy = alproxy( "almotion" ,robotip, 9559 ) except exception ,e: print "could not create a proxy to almotion" print str (e) try : postureproxy = alproxy( "alrobotposture" ,robotip, 9559 ) except exception ,e: print "could not create a proxy to alrobotposture" print str (e) #set the nao stiffness on stiffnesson(motionproxy) #set the nao to standinit postureproxy.gotoposture( "standinit" , 0.5 ) effector = "larm" space = motion.frame_robot # axis_mask_vel=7 axismask = almath.axis_mask_vel isabsolute = false #since we are in relative, the current position is zero currentpos = [ 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , 0.0 ] #define the changes in relative to the current position dx = 0.03 #translation axis x dy = 0.03 #translation axis y dz = 0.00 #translation axis z dwx = 0.00 #rotation axis x dwy = 0.00 #rotation axis x dwz = 0.00 #rotation axis x targetpos = [dx,dy,dz,dwx,dwy,dwz] #go to the target and back again path = [targetpos,currentpos] times = [ 2.0 , 4.0 ] #seconds motionproxy.positioninterpolation(effector,space,path,axismask,times,isabsolute) if __name__ = = "__main()__" : robotip = "127.0.0.1" if len (sys.argv)< = 1 : print "use default :127.0.0.1" else : robotip = sys.argv[ 1 ] main(robotip) |
接下来是另一个:
|
#-*-encoding:utf-8-*- ''' cartesian control :arm trajectory example''' import sys import motion import almath from naoqi import alproxy def stiffnesson(proxy): pname = "body" pstiffnesslists = 1.0 ptimelists = 1.0 proxy.stiffnessinterpolation(pname,pstiffnesslists,ptimelists) def main(robotip): '''showing a hand ellipoid ''' try : motionproxy = alproxy( "alproxy" ,robotip, 9559 ) except exception,e: print "could not create a proxy " print "error was " ,e try : postureproxy = alproxy( "alrobotproxy" ,robotip, 9559 ) except exception ,e: print "could not create a proxy" print "error was" ,e #send nao in stiffness on setstiffnesson(motionproxy) #send nao to pose init postureproxy.gotoposture( "standinit" , 0.5 ) effector = "larm" space = motion.frame_robot path = [ [ 0.0 , - 0.05 , + 0.00 , 0.0 , 0.0 , 0.0 ], #pose1 [ 0.0 , + 0.00 , + 0.04 , 0.0 , 0.0 , 0.0 ], #pose2 [ 0.0 , + 0.04 , + 0.00 , 0.0 , 0.0 , 0.0 ], #pose3 [ 0.0 , + 0.00 , - 0.02 , 0.0 , 0.0 , 0.0 ], #pose4 [ 0.0 , - 0.05 , + 0.00 , 0.0 , 0.0 , 0.0 ], #pose5 [ 0.0 , + 0.00 , + 0.00 , 0.0 , 0.0 , 0.0 ] ] #pose6 axismask = 7 times = [ 0.5 , 1.0 , 2.0 , 3.0 , 4.0 , 4.5 ] #seconds isabsolute = false motionproxy.positioninterpolation(effector,space,path,axismask,times,isabsolute) if __name__ = = "__main__" : robotip = "127.0.0.1" if len (sys.argv)< = 1 : print "usage local ip " else : robotip = sys.argv[ 1 ] main(robotip) |
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持开心学习网。
原文链接:https://blog.csdn.net/u011181878/article/details/21392201
您可能感兴趣
- opencv 图像匹配python(OpenCV+Python识别车牌和字符分割的实现)
- python爬取酷狗收费音乐(python爬取酷狗音乐排行榜)
- 随意化快排python算法(python快排算法详解)
- python爬虫经典步骤(详解python爬虫系列之初识爬虫)
- python开启线程池(对python:threading.Thread类的使用方法详解)
- python 多线程与多进程(python 多线程串行和并行的实例)
- 2021-10-23 10:04:24
- python语言的读取图像(详解python读取image)
- python 文本分析 摘要(用Python逐行分析文件方法)
- markdown和python的关系(解决python Markdown模块乱码的问题)
- python控制流实例(如何用C代码给Python写扩展库Cython)
- 卷积神经网络python实现(Python通过TensorFlow卷积神经网络实现猫狗识别)
- python程序锁教程(在python里协程使用同步锁Lock的实例)
- 学python从零基础到开发游戏(python开发游戏的前期准备)
- python基础教学之125 装饰器简介(python3 property装饰器实现原理与用法示例)
- python选择语句形式判断回文数(Python3实现的回文数判断及罗马数字转整数算法示例)
- 今天会下雨吗(今天会下雨吗小说)
- 追连续剧,品古今联4 明代三杨,联妙诗佳(追连续剧品古今联4)
- 三杨 共辅四朝帝王,构建明帝国内阁行政圈(三杨共辅四朝帝王)
- 红色文化进国企(红色文化进国企)
- 车友的选择| 轮毂该如何选(车友的选择轮毂该如何选)
- 秦海璐炫耀和王新军热恋蜜事,不料对方吐槽她吃饱后肚子撅老高(秦海璐炫耀和王新军热恋蜜事)
热门推荐
- Extjs中文乱码
- dedecms标签怎么调用(Dedecms自定义表单“数据校验不对,程序返回错误”的解决方法)
- C#中的base和this关键字
- dedecms频道封面不能修改内容(dedecms按栏目名首字母/数字排序输出的实现方法)
- mysql字符串截取字段(MySQL如何从不固定位置提取字符串元素详解)
- zabbix 查询linux使用率高的进程(详解Linux使用ss命令结合zabbix对socket做监控)
- vue插槽实例(Vue中插槽slot的使用方法与应用场景详析)
- laravel框架如何查询空的信息(使用Laravel中的查询构造器实现增删改查功能)
- dedecms怎么调用标签(织梦DEDECMS dede:arclist,dede:list获取附加表字段内容的方法)
- php八大模式详解(php设计模式之工厂模式用法经典实例分析)
排行榜
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9